【发布时间】:2020-08-24 18:55:47
【问题描述】:
url1 = "https://www.imdb.com/user/ur34087578/watchlist"
url = "https://www.imdb.com/search/title/?groups=top_1000&ref_=adv_prv"
results1 = requests.get(url1, headers=headers)
results = requests.get(url, headers=headers)
soup1 = BeautifulSoup(results1.text, "html.parser")
soup = BeautifulSoup(results.text, "html.parser")
movie_div1 = soup1.find_all('div', class_='lister-item-content')
movie_div = soup.find_all('div', class_='lister-item mode-advanced')
#using unique tag for each movie in the respective link
print(movie_div1)
#empty list
print(movie_div)
#gives perfect list
为什么 movie_div1 给出一个空列表?我无法识别 URL 结构中的任何差异以表明代码应该不同。感谢所有潜在客户。
【问题讨论】:
-
你想从你的监视列表中提取什么?当我在网络浏览器中打开网页时,我什至找不到带有
lister-item-content类的div标签。 -
@ritiek 你打开检查然后尝试搜索了吗?
-
是的,它显示在检查中。
标签: python html web beautifulsoup web-crawler