mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
Use a scalable blacklist
This commit is contained in:
parent
03bf5e618f
commit
dac8702751
@ -5,9 +5,9 @@ import pkgutil
|
|||||||
def get_resource(filename):
|
def get_resource(filename):
|
||||||
return pkgutil.get_data(__package__, 'data/' + filename)
|
return pkgutil.get_data(__package__, 'data/' + filename)
|
||||||
|
|
||||||
|
|
||||||
categories = json.loads(get_resource('categories.json').decode())
|
categories = json.loads(get_resource('categories.json').decode())
|
||||||
sorts = json.loads(get_resource('sorts.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_headers = {'User-Agent': 'pirate get'}
|
||||||
default_timeout = 10
|
default_timeout = 10
|
||||||
|
3
pirate/data/blacklist.json
Normal file
3
pirate/data/blacklist.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
"https://thebay.tv"
|
||||||
|
]
|
@ -176,9 +176,8 @@ def main():
|
|||||||
if f.getcode() != 200:
|
if f.getcode() != 200:
|
||||||
raise IOError('The proxy bay responded with an error.')
|
raise IOError('The proxy bay responded with an error.')
|
||||||
mirrors = mirrors.union([i.decode('utf-8').strip()
|
mirrors = mirrors.union([i.decode('utf-8').strip()
|
||||||
for i in f.readlines()][3:])
|
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
|
).difference(pirate.data.blacklist)
|
||||||
mirrors.discard('https://thebay.tv')
|
|
||||||
|
|
||||||
for mirror in mirrors:
|
for mirror in mirrors:
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user