source: titan/mediathek/localhoster/lib/youtube_dl/extractor/__init__.py @ 40094

Last change on this file since 40094 was 40094, checked in by obi, 7 years ago

tithek add yoztube-dl support

File size: 1.2 KB
Line 
1from __future__ import unicode_literals
2
3try:
4    from .lazy_extractors import *
5    from .lazy_extractors import _ALL_CLASSES
6    _LAZY_LOADER = True
7except ImportError:
8    _LAZY_LOADER = False
9    from .extractors import *
10
11    _ALL_CLASSES = [
12        klass
13        for name, klass in globals().items()
14        if name.endswith('IE') and name != 'GenericIE'
15    ]
16    _ALL_CLASSES.append(GenericIE)
17
18
19def gen_extractor_classes():
20    """ Return a list of supported extractors.
21    The order does matter; the first extractor matched is the one handling the URL.
22    """
23    return _ALL_CLASSES
24
25
26def gen_extractors():
27    """ Return a list of an instance of every supported extractor.
28    The order does matter; the first extractor matched is the one handling the URL.
29    """
30    return [klass() for klass in gen_extractor_classes()]
31
32
33def list_extractors(age_limit):
34    """
35    Return a list of extractors that are suitable for the given age,
36    sorted by extractor ID.
37    """
38
39    return sorted(
40        filter(lambda ie: ie.is_suitable(age_limit), gen_extractors()),
41        key=lambda ie: ie.IE_NAME.lower())
42
43
44def get_info_extractor(ie_name):
45    """Returns the info extractor class with the given ie_name"""
46    return globals()[ie_name + 'IE']
Note: See TracBrowser for help on using the repository browser.