爬虫绕过cloudflare验证

换另外一个python库:cloudflare-scrape

  • pip install cfscrape
import cfscrape

scraper = cfscrape.create_scraper()  # returns a CloudflareScraper instance
# Or: scraper = cfscrape.CloudflareScraper()  # CloudflareScraper inherits from requests.Session
print(scraper.get("http://...",headers={'user-agent':'...'}).text)  # => "<!DOCTYPE html><html><head>..."

tip:

posted @ 2021-09-10 03:08  三个零  阅读(5921)  评论(1编辑  收藏  举报