各位大大好,
目前在爬虫上遇到一些问题想请教大家.
环境: windows 10, python 3.8.3, nodejs v12.18.2, cfscrape v2.1.1
因为爬https://www.wantgoo.com/stock/astock/techchart?stockno=8069 时,
会出现 DDos protection by Cloudflare, 所以有google 找到可以使用 cfscrape
来解决, 但使用 cfscrape的范例:
import cfscrape
scraper = cfscrape.create_scraper() # returns a CloudflareScraper instance
# Or: scraper = cfscrape.CloudflareScraper() # CloudflareScraper inherits
from requests.Session
print scraper.get("https://www.wantgoo.com/stock/2892").content # =>
"<!DOCTYPE html><html><head>..."
执行时会在 scraper.get 那一行出现以下 error:
ValueError: Unable to identify Cloudflare IUAM Javascript on website.
Cloudflare may have changed their technique, or there may be a bug in the
script.
想请教大家是否知道可以怎么解决? 或是不使用 cfscrape 可以解决 Cloudflare?
感谢