Blacklist is now dynamic
This commit is contained in:
parent
69e9d10ad8
commit
d3635f7175
@ -21,6 +21,7 @@ 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'
|
||||||
|
@ -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
|
from config import IS_DEBUG, CACHE_TIMEOUT, BLACKLIST_WORDS
|
||||||
from models import AnimeLink
|
from models import AnimeLink
|
||||||
|
|
||||||
|
|
||||||
@ -79,8 +79,6 @@ ConnectorCache = Cache()
|
|||||||
|
|
||||||
|
|
||||||
class Connector(ABC):
|
class Connector(ABC):
|
||||||
blacklist_words = ['Chris44', 'Vol.', '[zza]']
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def color(self):
|
def color(self):
|
||||||
@ -248,7 +246,7 @@ class Nyaa(Connector):
|
|||||||
url = urls[0]
|
url = urls[0]
|
||||||
has_comment = False
|
has_comment = False
|
||||||
|
|
||||||
if any(word in url.string for word in self.blacklist_words):
|
if any(word in url.string for word in BLACKLIST_WORDS):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
valid_trs = valid_trs + 1
|
valid_trs = valid_trs + 1
|
||||||
@ -315,7 +313,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 in url_safe for word in self.blacklist_words):
|
if any(word in url_safe for word in BLACKLIST_WORDS):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
valid_trs = valid_trs + 1
|
valid_trs = valid_trs + 1
|
||||||
@ -401,7 +399,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 in url.string for word in self.blacklist_words):
|
if any(word in url.string for word in BLACKLIST_WORDS):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
valid_trs = valid_trs + 1
|
valid_trs = valid_trs + 1
|
||||||
|
Reference in New Issue
Block a user