Skip to content

Commit

Permalink
Fix proxy bay 403 error
Browse files Browse the repository at this point in the history
Cloudflare was banning pirate-get for not having a user agent.
  • Loading branch information
rnhmjoj committed Apr 25, 2015
1 parent 6554bdf commit d094a97
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions pirate-get.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

default_timeout = 10

headers = {'User-Agent': 'pirate get'}
default_headers = {'User-Agent': 'pirate get'}

categories = {
Expand Down Expand Up @@ -107,13 +106,6 @@
'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
class BayParser(HTMLParser):
title = ''
Expand Down Expand Up @@ -556,9 +548,9 @@ def main():
else:
mags, mirrors = [], {'https://thepiratebay.se'}
try:
opener = request.build_opener(NoRedirection)
f = opener.open('https://proxybay.info/list.txt',
timeout=default_timeout)
req = request.Request('https://proxybay.co/list.txt',
headers=default_headers)
f = request.urlopen(req, timeout=default_timeout)
except IOError:
print('Could not fetch additional mirrors', color='WARN')
else:
Expand Down

0 comments on commit d094a97

Please sign in to comment.