を、映画についての情報がクラスinfo
で<div>
の内部に位置しているようです。
from bs4 import BeautifulSoup
import requests
r = requests.get('https://www.themoviedb.org/discover/movie?page=1')
soup = BeautifulSoup(r.text, "html5lib")
items = soup.find_all('div', {'class' : 'info'})
for item in items:
print(item.p.a['title'])
出力:
Split
Miss Peregrine's Home for Peculiar Children
Deadpool
Captain America: Civil War
X-Men: Apocalypse
Fantastic Beasts and Where to Find Them
Arrival
Tomorrow Everything Starts
Doctor Strange
La La Land
Sing
The Great Wall
Rogue One: A Star Wars Story
Batman v Superman: Dawn of Justice
Hacksaw Ridge
Zootopia
Inferno
Star Trek Beyond
Now You See Me 2
Passengers
私はTMDBのためのAPIで構築を使用することをお勧め。こちらをご覧ください:https://www.themoviedb.org/documentation/api – David