繁体   English   中英

用 beautifulsoup 刮擦时找不到表

[英]Can't find table when scraping with beautifulsoup

我有

r = requests.get("https://baseballsavant.mlb.com/leaderboard/custom?year=2021&type=batter&filter=&sort=5&sortDir=desc&min=q&selections=r_total_stolen_base,sprint_speed,&chart=false&x=r_total_stolen_base&y=r_total_stolen_base&r=no&chartType=beeswarm")
soup = BeautifulSoup(r.content, "html.parser")

table = soup.find("tbody")
print(table)

它返回None ,即使显然有一个表标签

您的sort URL 参数设置为5 (第五列),但查询选择仅返回 3 列,因此访问该 URL 时没有显示表。

尝试将?sort=设置为0123

设置为 2 的示例: https://baseballsavant.mlb.com/leaderboard/custom?year=2021&type=batter&filter=&sort=2&sortDir=desc&min=q&selections=r_total_stolen_base,sprint_speed,&chart=false&x=r_total_stolen_warmbase&r_total_stolen_warmbase&r=rno=

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM