mirror of
https://github.com/vikstrous/pirate-get
synced 2025-04-13 00:28:38 +02:00
readd cloudflare check
This commit is contained in:
parent
2b659305ec
commit
f9f491ea65
@ -115,8 +115,10 @@ def find_api(mirror, timeout):
|
||||
f = request.urlopen(req, timeout=timeout)
|
||||
if f.info().get_content_type() == 'application/json':
|
||||
return mirror + path
|
||||
except urllib.error.URLError:
|
||||
pass
|
||||
except urllib.error.URLError as e:
|
||||
res = e.fp.read().decode()
|
||||
if e.code == 503 and 'cf-browser-verification' in res:
|
||||
raise IOError('Cloudflare protected')
|
||||
|
||||
# extract api path from main.js
|
||||
req = request.Request(mirror + '/static/main.js',
|
||||
|
Loading…
Reference in New Issue
Block a user