1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-19 19:45:07 +08:00
youtube-dl/youtube_dl/InfoExtractors/__init__.py

32 lines
796 B
Python
Raw Normal View History

2013-06-05 17:30:34 +08:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
IEs = [
('Youtube', ['YoutubePlaylistIE', 'YoutubeChannelIE',
'YoutubeUserIE', 'YoutubeSearchIE', 'YoutubeIE']),
('Generic', ['GenericIE']),
]
IE_list = []
2013-06-05 18:18:14 +08:00
IE_dict = {}
2013-06-05 17:30:34 +08:00
for module, IE_names in IEs:
2013-06-05 18:22:23 +08:00
_mod = __import__('youtube_dl.InfoExtractors.' + module,
globals(), fromlist=IE_names)
2013-06-05 17:30:34 +08:00
for IE_name in IE_names:
2013-06-05 18:18:14 +08:00
IE = getattr(_mod, IE_name)
IE_list.append(IE)
IE_dict[IE_name] = IE
2013-06-05 17:30:34 +08:00
def gen_extractors():
""" Return a list of an instance of every supported extractor """
return [ IE() for IE in IE_list ]
def get_info_extractor(IE_name):
"""Returns the info extractor class with the given ie_name"""
2013-06-05 18:26:14 +08:00
return IE_dict[IE_name + 'IE']