mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
Fix proxy bay 403 error
Cloudflare was banning pirate-get for not having a user agent.
This commit is contained in:
parent
6554bdf4d5
commit
d094a973a6
@ -41,7 +41,6 @@ colored_output = True
|
|||||||
|
|
||||||
default_timeout = 10
|
default_timeout = 10
|
||||||
|
|
||||||
headers = {'User-Agent': 'pirate get'}
|
|
||||||
default_headers = {'User-Agent': 'pirate get'}
|
default_headers = {'User-Agent': 'pirate get'}
|
||||||
|
|
||||||
categories = {
|
categories = {
|
||||||
@ -107,13 +106,6 @@ sorts = {
|
|||||||
'Default': 99}
|
'Default': 99}
|
||||||
|
|
||||||
|
|
||||||
class NoRedirection(request.HTTPErrorProcessor):
|
|
||||||
def http_response(self, _, res):
|
|
||||||
return res
|
|
||||||
|
|
||||||
https_response = http_response
|
|
||||||
|
|
||||||
|
|
||||||
# create a subclass and override the handler methods
|
# create a subclass and override the handler methods
|
||||||
class BayParser(HTMLParser):
|
class BayParser(HTMLParser):
|
||||||
title = ''
|
title = ''
|
||||||
@ -556,9 +548,9 @@ def main():
|
|||||||
else:
|
else:
|
||||||
mags, mirrors = [], {'https://thepiratebay.se'}
|
mags, mirrors = [], {'https://thepiratebay.se'}
|
||||||
try:
|
try:
|
||||||
opener = request.build_opener(NoRedirection)
|
req = request.Request('https://proxybay.co/list.txt',
|
||||||
f = opener.open('https://proxybay.info/list.txt',
|
headers=default_headers)
|
||||||
timeout=default_timeout)
|
f = request.urlopen(req, timeout=default_timeout)
|
||||||
except IOError:
|
except IOError:
|
||||||
print('Could not fetch additional mirrors', color='WARN')
|
print('Could not fetch additional mirrors', color='WARN')
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user