【问题标题】:render in html_requests return none在 html_requests 中渲染返回无
【发布时间】:2019-10-17 04:47:39
【问题描述】:

我使用了渲染,python_requests 中的链接返回None,set()

不知道问题出在哪里?

from requests_html import HTMLSession

session = HTMLSession()
r = session.get('http://saipa.iranecar.com/')
print(r.html.render())  # None

没有错误

【问题讨论】:

  • 您能详细说明一下这个问题吗?你到底想在这里访问什么?预期输出?
  • 当我尝试在其他网站返回字典。但是这个网站返回无
  • 我想从网站获取所有 html 代码。
  • 首先我使用python请求库返回一些代码,不显示所有元素然后使用request_html返回无
  • 似乎该网站正在使用生成的 javascript,并且在检查后似乎它被严重混淆以防止机器人。我建议你检查一下Selenium。

标签: python html python-requests python-requests-html


【解决方案1】:

r.html.render() 就地完成了。因此它应该在打印功能之外完成

...
r.html.render()
print (r.content)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-28
    相关资源
    最近更新 更多