From dac87027518089b307609c33b726e1fa1d25c3da Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Mon, 31 Aug 2015 02:26:18 +0000 Subject: [PATCH] Use a scalable blacklist --- pirate/data.py | 2 +- pirate/data/blacklist.json | 3 +++ pirate/pirate.py | 5 ++--- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 pirate/data/blacklist.json diff --git a/pirate/data.py b/pirate/data.py index 73869d1..8c8390f 100644 --- a/pirate/data.py +++ b/pirate/data.py @@ -5,9 +5,9 @@ import pkgutil def get_resource(filename): return pkgutil.get_data(__package__, 'data/' + filename) - categories = json.loads(get_resource('categories.json').decode()) sorts = json.loads(get_resource('sorts.json').decode()) +blacklist = set(json.loads(get_resource('blacklist.json').decode())) default_headers = {'User-Agent': 'pirate get'} default_timeout = 10 diff --git a/pirate/data/blacklist.json b/pirate/data/blacklist.json new file mode 100644 index 0000000..089b9f7 --- /dev/null +++ b/pirate/data/blacklist.json @@ -0,0 +1,3 @@ +[ +"https://thebay.tv" +] \ No newline at end of file diff --git a/pirate/pirate.py b/pirate/pirate.py index d5c0505..221770f 100755 --- a/pirate/pirate.py +++ b/pirate/pirate.py @@ -176,9 +176,8 @@ def main(): if f.getcode() != 200: raise IOError('The proxy bay responded with an error.') mirrors = mirrors.union([i.decode('utf-8').strip() - for i in f.readlines()][3:]) - # This mirror messes up links in the search results page - you need to load a second page to get the magnet link - mirrors.discard('https://thebay.tv') + for i in f.readlines()][3:] + ).difference(pirate.data.blacklist) for mirror in mirrors: try: