]>
Commit | Line | Data |
---|---|---|
1 | import contextlib | |
2 | import os | |
3 | ||
4 | from ..plugins import load_plugins | |
5 | ||
6 | # NB: Must be before other imports so that plugins can be correctly injected | |
7 | _PLUGIN_CLASSES = load_plugins('extractor', 'IE') | |
8 | ||
9 | _LAZY_LOADER = False | |
10 | if not os.environ.get('YTDLP_NO_LAZY_EXTRACTORS'): | |
11 | with contextlib.suppress(ImportError): | |
12 | from .lazy_extractors import * # noqa: F403 | |
13 | from .lazy_extractors import _ALL_CLASSES | |
14 | _LAZY_LOADER = True | |
15 | ||
16 | if not _LAZY_LOADER: | |
17 | from ._extractors import * # noqa: F403 | |
18 | _ALL_CLASSES = [ # noqa: F811 | |
19 | klass | |
20 | for name, klass in globals().items() | |
21 | if name.endswith('IE') and name != 'GenericIE' | |
22 | ] | |
23 | _ALL_CLASSES.append(GenericIE) # noqa: F405 | |
24 | ||
25 | globals().update(_PLUGIN_CLASSES) | |
26 | _ALL_CLASSES[:0] = _PLUGIN_CLASSES.values() | |
27 | ||
28 | from .common import _PLUGIN_OVERRIDES # noqa: F401 |