]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/__init__.py
3 from ..utils
import load_plugins
6 if not os
.environ
.get('YTDLP_NO_LAZY_EXTRACTORS'):
8 from .lazy_extractors
import *
9 from .lazy_extractors
import _ALL_CLASSES
15 from .extractors
import *
18 for name
, klass
in globals().items()
19 if name
.endswith('IE') and name
!= 'GenericIE'
21 _ALL_CLASSES
.append(GenericIE
)
23 _PLUGIN_CLASSES
= load_plugins('extractor', 'IE', globals())
24 _ALL_CLASSES
= list(_PLUGIN_CLASSES
.values()) + _ALL_CLASSES
27 def gen_extractor_classes():
28 """ Return a list of supported extractors.
29 The order does matter; the first extractor matched is the one handling the URL.
35 """ Return a list of an instance of every supported extractor.
36 The order does matter; the first extractor matched is the one handling the URL.
38 return [klass() for klass
in gen_extractor_classes()]
41 def list_extractors(age_limit
):
43 Return a list of extractors that are suitable for the given age,
44 sorted by extractor ID.
48 filter(lambda ie
: ie
.is_suitable(age_limit
), gen_extractors()),
49 key
=lambda ie
: ie
.IE_NAME
.lower())
52 def get_info_extractor(ie_name
):
53 """Returns the info extractor class with the given ie_name"""
54 return globals()[ie_name
+ 'IE']