From 5a5f27e7a2f623ada4afde8b090b41d5db2db72c Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Wed, 5 Jun 2013 12:50:29 +0200 Subject: [PATCH] Accept simple strings in IEs --- youtube_dl/InfoExtractors/__init__.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/youtube_dl/InfoExtractors/__init__.py b/youtube_dl/InfoExtractors/__init__.py index d84e37e8a..1e0d49b10 100755 --- a/youtube_dl/InfoExtractors/__init__.py +++ b/youtube_dl/InfoExtractors/__init__.py @@ -3,19 +3,30 @@ from __future__ import absolute_import - +""" +List here the InfoExtractors. +The order matter! URLs will be handled by the first IE to match. +List either the name of the file, like 'Foo', containing 'FooIE' or +a tuple like (FILENAME, [IE_name, IE_name, ...]) +""" IEs = [ ('Youtube', ['YoutubePlaylistIE', 'YoutubeChannelIE', 'YoutubeUserIE', 'YoutubeSearchIE', 'YoutubeIE']), - ('Generic', ['GenericIE']), + 'Generic', ] IE_list = [] IE_dict = {} -for module, IE_names in IEs: +for entry in IEs: + if type(entry) == type(''): + module, IE_names = entry, [entry + 'IE'] + else: + module, IE_names = entry + _mod = __import__('youtube_dl.InfoExtractors.' + module, globals(), fromlist=IE_names) + for IE_name in IE_names: IE = getattr(_mod, IE_name) IE_list.append(IE)