我想从this website得到平均价格。从“2021年古代战斗罐——MP21-EN143”中,表格位于“图片不可用”图像下方。
当我使用下面的代码时,我只是从URL顶部的第一个表,即“锦标赛资格”下面的表中获取内容
import pandas as pd
from bs4 import BeautifulSoup
import requests
url = 'https://yugiohprices.com/card_price?name=Triple+Tactics+Talent'
r = requests.get(url)
soup = BeautifulSoup(r.text, 'lxml')
table = soup.findAll('table',{'id':'item_stats'})
print(table)
是不是我的代码等待整个网站加载的时间不够长?在请求url后,我尝试等待了5秒钟,但它仍然在顶部显示第一个表。关于如何获取此值,有什么建议吗
发生了什么事?
站点正在动态加载您想要获取的内容-因为请求无法模拟浏览器行为,等待不起作用
如何修复?
信息来自另一个url,您可以选择:
如果您想深入了解,另一种可能更好的解决方案是selenium,这样您就可以模拟浏览器
相关问题 更多 >
编程相关推荐