mirror of
https://github.com/kemayo/leech
synced 2025-12-06 16:33:16 +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:
parent
0f176f5a7c
commit
d50f23d07b
1 changed files with 2 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue