fix 'whitelist' option for BaseExtractor instances

This commit is contained in:
Mike Fährmann
2021-02-15 21:58:33 +01:00
parent fbfcbcbf57
commit 65ca923b4e
2 changed files with 18 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ import sys
import time
import errno
import logging
import operator
import collections
from . import extractor, downloader, postprocessor
from . import config, text, util, output, exception
@@ -440,7 +441,21 @@ class DownloadJob(Job):
if wlist is not None:
if isinstance(wlist, str):
wlist = wlist.split(",")
blist = {e.category for e in extractor._list_classes()}
# build a set of all categories
blist = set()
add = blist.add
update = blist.update
get = operator.itemgetter(0)
for extr in extractor._list_classes():
category = extr.category
if category:
add(category)
else:
update(map(get, extr.instances))
# remove whitelisted categories
blist.difference_update(wlist)
return blist