mirror of
https://github.com/vikstrous/pirate-get
synced 2025-04-15 00:48: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)
|
f = request.urlopen(req, timeout=timeout)
|
||||||
if f.info().get_content_type() == 'application/json':
|
if f.info().get_content_type() == 'application/json':
|
||||||
return mirror + path
|
return mirror + path
|
||||||
except urllib.error.URLError:
|
except urllib.error.URLError as e:
|
||||||
pass
|
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
|
# extract api path from main.js
|
||||||
req = request.Request(mirror + '/static/main.js',
|
req = request.Request(mirror + '/static/main.js',
|
||||||
|
Loading…
Reference in New Issue
Block a user