[問題] [爬蟲] DDos protection by Cloudflare
各位大大好,
目前在爬蟲上遇到一些問題想請教大家.
環境: 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?
感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.195.4.56 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1594222480.A.01E.html
→
07/09 01:42,
3年前
, 1F
07/09 01:42, 1F
→
07/09 01:42,
3年前
, 2F
07/09 01:42, 2F
→
07/09 01:42,
3年前
, 3F
07/09 01:42, 3F
→
07/09 01:43,
3年前
, 4F
07/09 01:43, 4F
→
07/09 01:43,
3年前
, 5F
07/09 01:43, 5F
→
07/09 10:27,
3年前
, 6F
07/09 10:27, 6F
→
07/09 10:27,
3年前
, 7F
07/09 10:27, 7F
推
07/09 14:20,
3年前
, 8F
07/09 14:20, 8F