不能用python cloudscraper绕过cloudflare

新手上路,请多包涵

我在尝试解析网站时遇到了 cloudflare 问题。

我得到这个代码

import cloudscraper

url = "https://author.today"
scraper = cloudscraper.create_scraper()
print(scraper.post(url).status_code)

这段代码打印我

cloudscraper.exceptions.CloudflareChallengeError: Detected a Cloudflare version 2 challenge, This feature is not available in the opensource (free) version.

我搜索了解决方法,但找不到任何解决方案。如果通过浏览器访问该网站,您可以看到

Checking your browser before accessing author.today.

在我的案例中有没有绕过 cloudflare 的解决方案?

原文由 Nickolas 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.6k
1 个回答

安装httpx

 pip3 install httpx[http2]

定义 http2 客户端

client = httpx.Client(http2=True)

提出要求

response = client.get("https://author.today")

干杯!

原文由 Zorome 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题