mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
update extractor blacklist to also allow classes
This commit is contained in:
parent
b6797032e3
commit
f10ffc0839
@ -98,7 +98,7 @@ def find(url):
|
||||
"""Find suitable extractor for the given url"""
|
||||
for pattern, klass in _list_patterns():
|
||||
match = pattern.match(url)
|
||||
if match and klass.category not in _blacklist:
|
||||
if match and klass not in _blacklist:
|
||||
return klass(match)
|
||||
return None
|
||||
|
||||
@ -113,11 +113,15 @@ def extractors():
|
||||
|
||||
class blacklist():
|
||||
"""Context Manager to blacklist extractor modules"""
|
||||
def __init__(self, categories):
|
||||
self.categories = categories
|
||||
def __init__(self, categories, extractors=None):
|
||||
self.extractors = extractors or []
|
||||
for _, klass in _list_patterns():
|
||||
if klass.category in categories:
|
||||
self.extractors.append(klass)
|
||||
print(self.extractors)
|
||||
|
||||
def __enter__(self):
|
||||
_blacklist.extend(self.categories)
|
||||
_blacklist.update(self.extractors)
|
||||
|
||||
def __exit__(self, etype, value, traceback):
|
||||
_blacklist.clear()
|
||||
@ -127,7 +131,7 @@ class blacklist():
|
||||
# internals
|
||||
|
||||
_cache = []
|
||||
_blacklist = []
|
||||
_blacklist = set()
|
||||
_module_iter = iter(modules)
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ class RecursiveExtractor(Extractor):
|
||||
|
||||
def items(self):
|
||||
blist = self.config(
|
||||
"blacklist", ("directlink",) + util.SPECIAL_EXTRACTORS)
|
||||
"blacklist", {"directlink"} | util.SPECIAL_EXTRACTORS)
|
||||
page = self.request(self.url).text
|
||||
yield Message.Version, 1
|
||||
with extractor.blacklist(blist):
|
||||
|
@ -183,7 +183,7 @@ CODES = {
|
||||
"zh": "Chinese",
|
||||
}
|
||||
|
||||
SPECIAL_EXTRACTORS = ("oauth", "recursive", "test")
|
||||
SPECIAL_EXTRACTORS = {"oauth", "recursive", "test"}
|
||||
|
||||
|
||||
def build_predicate(predicates):
|
||||
|
@ -20,7 +20,7 @@ SKIP = {
|
||||
# temporary issues
|
||||
"batoto", # R.I.P.
|
||||
"imgyt", # server maintenance
|
||||
"luscious",
|
||||
"gelbooru",
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user