]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/__init__.py
4 from ..utils
import load_plugins
7 if not os
.environ
.get('YTDLP_NO_LAZY_EXTRACTORS'):
8 with contextlib
.suppress(ImportError):
9 from .lazy_extractors
import * # noqa: F403
10 from .lazy_extractors
import _ALL_CLASSES
14 from .extractors
import * # noqa: F403
15 _ALL_CLASSES
= [ # noqa: F811
17 for name
, klass
in globals().items()
18 if name
.endswith('IE') and name
!= 'GenericIE'
20 _ALL_CLASSES
.append(GenericIE
) # noqa: F405
22 _PLUGIN_CLASSES
= load_plugins('extractor', 'IE', globals())
23 _ALL_CLASSES
= list(_PLUGIN_CLASSES
.values()) + _ALL_CLASSES
26 def gen_extractor_classes():
27 """ Return a list of supported extractors.
28 The order does matter; the first extractor matched is the one handling the URL.
34 """ Return a list of an instance of every supported extractor.
35 The order does matter; the first extractor matched is the one handling the URL.
37 return [klass() for klass
in gen_extractor_classes()]
40 def list_extractors(age_limit
):
41 """Return a list of extractors that are suitable for the given age, sorted by extractor name"""
43 lambda ie
: ie
.is_suitable(age_limit
),
44 gen_extractors()), key
=lambda ie
: ie
.IE_NAME
.lower())
47 def get_info_extractor(ie_name
):
48 """Returns the info extractor class with the given ie_name"""
49 return globals()[ie_name
+ 'IE']