Compare commits

...

2 Commits

Author SHA1 Message Date
df3c72ea92 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	connectors.py
2020-02-21 17:12:45 +01:00
d3635f7175 Blacklist is now dynamic 2020-02-21 17:11:07 +01:00
2 changed files with 5 additions and 6 deletions

View File

@ -21,6 +21,7 @@ ADMIN_USERNAME = environ.get('ADMIN_USERNAME', 'admin')
ADMIN_PASSWORD = environ.get('ADMIN_PASSWORD', 'secret')
APP_PORT = environ.get('FLASK_PORT', 5000)
CACHE_TIMEOUT = environ.get('CACHE_TIMEOUT', 60 * 60)
BLACKLIST_WORDS = environ.get('BLACKLIST_WORDS', '').split(',')
app = Flask(__name__)
app.name = 'PyNyaaTa'

View File

@ -12,7 +12,7 @@ import requests
from bs4 import BeautifulSoup
from requests import ReadTimeout
from config import IS_DEBUG, CACHE_TIMEOUT
from config import IS_DEBUG, CACHE_TIMEOUT, BLACKLIST_WORDS
from models import AnimeLink
@ -79,8 +79,6 @@ ConnectorCache = Cache()
class Connector(ABC):
blacklist_words = ['Chris44', 'Vol.', '[zza]', '.ssa']
@property
@abstractmethod
def color(self):
@ -248,7 +246,7 @@ class Nyaa(Connector):
url = urls[0]
has_comment = False
if any(word.lower() in url.string.lower() for word in self.blacklist_words):
if any(word.lower() in url.string.lower() for word in BLACKLIST_WORDS):
continue
valid_trs = valid_trs + 1
@ -315,7 +313,7 @@ class Pantsu(Connector):
url = tds[1].a
url_safe = ''.join(url.strings)
if any(word.lower() in url_safe.lower() for word in self.blacklist_words):
if any(word.lower() in url_safe.lower() for word in BLACKLIST_WORDS):
continue
valid_trs = valid_trs + 1
@ -401,7 +399,7 @@ class YggTorrent(Connector):
if check_downloads or check_seeds:
url = tds[1].a
if any(word.lower() in url.string.lower() for word in self.blacklist_words):
if any(word.lower() in url.string.lower() for word in BLACKLIST_WORDS):
continue
valid_trs = valid_trs + 1