mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-01-21 19:27:37 +01:00
3d939b68fe
# Conflicts: # yt_dlp/YoutubeDL.py # yt_dlp/__init__.py # yt_dlp/options.py # yt_dlp/plugins.py # yt_dlp/postprocessor/__init__.py # yt_dlp/utils/_utils.py
35 lines
937 B
Python
35 lines
937 B
Python
import inspect
|
|
import os
|
|
|
|
from ..globals import LAZY_EXTRACTORS
|
|
from ..globals import extractors as _extractors_context
|
|
|
|
_CLASS_LOOKUP = None
|
|
if not os.environ.get('YTDLP_NO_LAZY_EXTRACTORS'):
|
|
try:
|
|
from .lazy_extractors import _CLASS_LOOKUP
|
|
LAZY_EXTRACTORS.set(True)
|
|
except ImportError:
|
|
LAZY_EXTRACTORS.set(None)
|
|
|
|
if not _CLASS_LOOKUP:
|
|
from . import _extractors
|
|
|
|
_CLASS_LOOKUP = {
|
|
name: value
|
|
for name, value in inspect.getmembers(_extractors)
|
|
if name.endswith('IE') and name != 'GenericIE'
|
|
}
|
|
_CLASS_LOOKUP['GenericIE'] = _extractors.GenericIE
|
|
|
|
# We want to append to the main lookup
|
|
_current = _extractors_context.get()
|
|
for name, ie in _CLASS_LOOKUP.items():
|
|
_current.setdefault(name, ie)
|
|
|
|
|
|
def __getattr__(name):
|
|
value = _CLASS_LOOKUP.get(name)
|
|
if not value:
|
|
raise AttributeError(f'module {__name__} has no attribute {name}')
|
|
return value
|