我正在尝试使用 python 3(使用 PyCharm)抓取本网站的 HTML:https : //www.idealista.com/venta-viviendas/madrid-madrid/。我只对房子的价格感兴趣,所以我将搜索范围缩小到特定范围,如下所示:import requestsfrom bs4 import BeautifulSouppage = requests.get('https://www.idealista.com/venta-viviendas/madrid-madrid/')soup = BeautifulSoup(page.text, 'html.parser')prices=soup.findAll("span", {"class": "item-price h2-simulated"})print(len(prices))print(prices)当我运行它时,我得到这个:0 []这意味着它没有找到任何东西。此外,如果我打印所有内容:print(soup) 对于这么大的页面,我得到的 html 内容很少,因此显然无法获取所有内容。
添加回答
举报
0/150
提交
取消