python采集遇到cloudflare

1.requests请求遇到如下问题

Access denied | xxx.com used Cloudflare to restrict access

2.解决

pip install cloudscraper
import cloudscraper
scraper = cloudscraper.create_scraper()
print(scraper.get("https://study1moose.com/the-notebook-analysis-essay").text)

 

参考:https://awesomeopensource.com/projects/cloudflare-bypass?categoryPage=47

posted @ 2021-12-09 16:16  lingwang3  阅读(1159)  评论(0编辑  收藏  举报