繁体   English   中英

为什么 render / requests-html 不抓取动态内容?

[英]Why render / requests-html doesn't scrape dynamic content?

长话短说:从 Selenium 切换到 Requests(-html)。

工作正常但不是在所有情况下。

页面: https://www.winamax.fr/paris-sportifs/sports/1/1/1

加载后,它会为英语游戏的动态内容收费(例如:谢菲尔德联队 - 西汉姆)。

但是当我尝试这样做时:

from requests_html import HTMLSession
session = HTMLSession()
r = session.get('https://www.winamax.fr/paris-sportifs/1/1/1')
r.html.render()
print(r.html.text) # I also tried print(r.html.html)

游戏不显示在 output 中。

为什么? 谢谢 !

添加超时,它应该工作,抱歉,这必须是评论,但我不能评论..

from requests_html import HTMLSession
session = HTMLSession()
r = session.get('https://www.winamax.fr/paris-sportifs/sports/1/1/1')
r.html.render(timeout=20)
print(r.html.html)
session.close()

暂无
暂无

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

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