From 1452a3a9593bb980844f0124777b4e42234bf882 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Wed, 5 Jun 2013 12:18:14 +0200 Subject: [PATCH] edit __init__.py to handle suggestions --- youtube_dl/InfoExtractors/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/youtube_dl/InfoExtractors/__init__.py b/youtube_dl/InfoExtractors/__init__.py index 70b667818..c8317bf96 100755 --- a/youtube_dl/InfoExtractors/__init__.py +++ b/youtube_dl/InfoExtractors/__init__.py @@ -12,11 +12,13 @@ IEs = [ IE_list = [] +IE_dict = {} for module, IE_names in IEs: - _mod = __import__('youtube_dl.InfoExtractors.' + module, - globals(), locals(), IE_names) + _mod = __import__('youtube_dl.InfoExtractors.' + module, globals(), IE_names) for IE_name in IE_names: - IE_list.append(getattr(_mod, IE_name)) + IE = getattr(_mod, IE_name) + IE_list.append(IE) + IE_dict[IE_name] = IE def gen_extractors(): @@ -25,4 +27,4 @@ def gen_extractors(): def get_info_extractor(IE_name): """Returns the info extractor class with the given ie_name""" - return next(IE for IE in IE_list if IE.__name__ == IE_name + 'IE') + return IE_dict[IE_name]