From 2d498b19a146959295435ea2dee28730bbdb9eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 21 Nov 2015 03:12:36 +0100 Subject: [PATCH] remove 'info' parameter --- gallery_dl/extractor/__init__.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 9ad17a6a..af924aec 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -47,7 +47,7 @@ modules = [ def find(url): """Find extractor suitable for handling the given url""" - for pattern, info, klass in _list_patterns(): + for pattern, klass in _list_patterns(): match = re.match(pattern, url) if match: return klass(match) @@ -66,19 +66,11 @@ def _list_patterns(): for module_name in _module_iter: module = importlib.import_module("."+module_name, __package__) - try: - klass = getattr(module, module.info["extractor"]) - userpatterns = config.get(("extractor", module_name, "pattern"), default=[]) - for pattern in userpatterns + module.info["pattern"]: - etuple = (pattern, module.info, klass) + for klass in _get_classes(module): + for pattern in klass.pattern: + etuple = (pattern, klass) _cache.append(etuple) yield etuple - except AttributeError: - for klass in _get_classes(module): - for pattern in klass.pattern: - etuple = (pattern, klass.info, klass) - _cache.append(etuple) - yield etuple def _get_classes(module): """Return a list of all extractor classes in a module"""