diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 4c278641..9ad17a6a 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -50,8 +50,8 @@ def find(url): for pattern, info, klass in _list_patterns(): match = re.match(pattern, url) if match: - return klass(match), info - return None, None + return klass(match) + return None # -------------------------------------------------------------------- # internals @@ -84,6 +84,6 @@ def _get_classes(module): """Return a list of all extractor classes in a module""" return [ klass for klass in module.__dict__.values() if ( - hasattr(klass, "info") and klass.__module__ == module.__name__ + hasattr(klass, "pattern") and klass.__module__ == module.__name__ ) ] diff --git a/gallery_dl/jobs.py b/gallery_dl/jobs.py index cc61c8ca..b72b6870 100644 --- a/gallery_dl/jobs.py +++ b/gallery_dl/jobs.py @@ -14,19 +14,20 @@ from .extractor.common import Message class DownloadJob(): def __init__(self, url): - self.extractor, self.info = extractor.find(url) + # self.extractor, self.info = extractor.find(url) + self.extractor = extractor.find(url) if self.extractor is None: print(url, ": No extractor found", sep="", file=sys.stderr) return self.directory = self.get_base_directory() self.downloaders = {} self.filename_fmt = config.get( - ("extractor", self.info["category"], "filename"), - default=self.info["filename"] + ("extractor", self.extractor.category, "filename"), + default=self.extractor.filename_fmt ) segments = config.get( - ("extractor", self.info["category"], "directory"), - default=self.info["directory"] + ("extractor", self.extractor.category, "directory"), + default=self.extractor.directory_fmt ) self.directory_fmt = os.path.join(*segments) @@ -51,7 +52,7 @@ class DownloadJob(): elif msg[0] == Message.Version: if msg[1] != 1: raise "unsupported message-version ({}, {})".format( - self.info.category, msg[1] + self.extractor.category, msg[1] ) # TODO: support for multiple message versions @@ -118,7 +119,8 @@ class DownloadJob(): class KeywordJob(): def __init__(self, url): - self.extractor, self.info = extractor.find(url) + # self.extractor, self.info = extractor.find(url) + self.extractor = extractor.find(url) if self.extractor is None: print(url, ": No extractor found", sep="", file=sys.stderr) return