我试图通过使用python和模块“requests”和“BeautifulSoup”从一个网站(https://www.evaschulze-aufgabenpool.de/index.php/s/smwP6ygck2SXRtF)获取一些数据,但似乎得到了一个不完整的html文件作为响应。例如,当我使用浏览器检查html文件时,与原始html文件相比,我用代码得到的html文件中的表标记缺少行。所以我的问题是:这是什么原因?我如何解决这个问题
下面是我用来获取表标记内数据的代码:
import requests
from bs4 import BeautifulSoup
source = requests.get("https://www.evaschulze-aufgabenpool.de/index.php/s/smwP6ygck2SXRtF").text
soup = BeautifulSoup(source, "html.parser")
for table in soup.find_all("table"):
print(table)
发生了什么事?
表的内容是动态生成的,不包括在请求的响应中。您必须等待页面/内容加载
你能做的就是使用硒
相关问题 更多 >
编程相关推荐