各位大大好,
目前在爬蟲上遇到一些問題想請教大家.
環境: 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?
感謝