Compare commits

..

No commits in common. "df3c72ea92222180225fc87b03dbc63905d93aca" and "af9b3995bf701e83f598fec085308ca1014bbc97" have entirely different histories.

2 changed files with 6 additions and 5 deletions

View File

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

View File

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