Python 为什么呈现/请求html不';不刮动态内容?

Python 为什么呈现/请求html不';不刮动态内容?,python,python-requests,python-requests-html,Python,Python Requests,Python Requests Html,长话短说:从Selenium切换到请求(-html) 工作正常,但不是在所有情况下 第页: 加载后,它会对动态内容进行收费,包括英国比赛(例如:谢菲尔德联队-西汉姆) 但当我尝试这样做时: 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.t

长话短说:从Selenium切换到请求(-html)

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

第页:

加载后,它会对动态内容进行收费,包括英国比赛(例如:谢菲尔德联队-西汉姆)

但当我尝试这样做时:

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)
游戏不会显示在输出中


为什么??谢谢

添加超时,应该可以,抱歉,这必须是评论,但我无法评论

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()

这回答了你的问题吗?仅仅是因为页面中不包含“输出”。在浏览器中,它通过Javascript添加到页面的DOM中。请求不运行Javascript。Selenium使用浏览器工作。但是请求html它不应该处理JavaScript支持吗???我试图找到带有数据的ajax json,但运气不好(不确定如何执行),当我运行时,我得到了这个
RuntimeWarning
C:\Applications\uuuuuuuu\python372\lib\site packages\pyee\\u base.py:81:RuntimeWarning:coroutine'Browser.\u targetCreated'从未等待过f(*args,**kwargs)RuntimeWarning:启用tracemalloc以获取对象分配回溯。
然后什么都没有发生,它永远不会停止运行。即使使用CTRL+C,我也无法停止该过程。