当使用find函数时,Python BeautifulSoup对象不返回任何内容

2024-09-26 22:50:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从这个website获取内容;为此,我编写了以下代码:

source = requests.get(justwatch+pelicula,headers=headers)
source_content = source.content
soup2 = BeautifulSoup(source_content,'html.parser')
soup2.find_all('div', class_='price-comparison__grid__row__element')

但是,由于find_all()函数和find()函数都没有返回任何结果,因此我什么也没有得到

我错过了什么


Tags: 函数代码source内容getwebsitecontentall
1条回答
网友
1楼 · 发布于 2024-09-26 22:50:25

站点动态加载数据。从它的api和该站点的html中不包含带有class='price-comparison__grid__row__element'<div>标记。这就是为什么你会得到None。尝试python模块JustWatch

运行: pip install justwatch

相关问题 更多 >

    热门问题