1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2025-12-06 08:22:56 +01:00

Special exception for hitting a cloudflare captcha page

Fanfiction.net is currently doing this, so let's at least acknowledge it

Refs #53
This commit is contained in:
David Lynch 2021-02-12 16:02:55 -06:00
parent 0f176f5a7c
commit d50f23d07b

View file

@ -137,6 +137,8 @@ class Site:
def _soup(self, url, method='html5lib', retry=3, retry_delay=10, **kw):
page = self.session.get(url, **kw)
if not page:
if page.status_code == 403 and page.headers.get('Server', False) == 'cloudflare' and "captcha-bypass" in page.text:
raise SiteException("Couldn't fetch, probably because of Cloudflare protection", url)
if retry and retry > 0:
delay = retry_delay
if 'Retry-After' in page.headers: