From d094a973a6634d62b2b3491e0d8755e380507e16 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sun, 26 Apr 2015 01:18:37 +0200 Subject: [PATCH] Fix proxy bay 403 error Cloudflare was banning pirate-get for not having a user agent. --- pirate-get.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/pirate-get.py b/pirate-get.py index ba48126..b5c66e7 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -41,7 +41,6 @@ colored_output = True default_timeout = 10 -headers = {'User-Agent': 'pirate get'} default_headers = {'User-Agent': 'pirate get'} categories = { @@ -107,13 +106,6 @@ sorts = { '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 = '' @@ -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: