1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[common] use 'cf-mitigated' header to detect challenges

This commit is contained in:
Mike Fährmann 2024-09-07 20:16:06 +02:00
parent 4b04ccb3a1
commit 0db3c11ab0
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -196,6 +196,10 @@ class Extractor():
server = response.headers.get("Server")
if server and server.startswith("cloudflare") and \
code in (403, 503):
mitigated = response.headers.get("cf-mitigated")
if mitigated and mitigated.lower() == "challenge":
self.log.warning("Cloudflare challenge")
break
content = response.content
if b"_cf_chl_opt" in content or b"jschl-answer" in content:
self.log.warning("Cloudflare challenge")