Fix lazy extractor state (Fix 4445f37a7a66b248dbd8376c43137e6e441f138e) (#12452)

Authored by: coletdjnz, Grub4K, pukkandan
This commit is contained in:
Simon Sawicki 2025-02-23 09:44:27 +01:00 committed by GitHub
parent 480125560a
commit c034d65548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -5,12 +5,14 @@ from ..globals import LAZY_EXTRACTORS
from ..globals import extractors as _extractors_context from ..globals import extractors as _extractors_context
_CLASS_LOOKUP = None _CLASS_LOOKUP = None
if not os.environ.get('YTDLP_NO_LAZY_EXTRACTORS'): if os.environ.get('YTDLP_NO_LAZY_EXTRACTORS'):
LAZY_EXTRACTORS.value = False
else:
try: try:
from .lazy_extractors import _CLASS_LOOKUP from .lazy_extractors import _CLASS_LOOKUP
LAZY_EXTRACTORS.value = True LAZY_EXTRACTORS.value = True
except ImportError: except ImportError:
LAZY_EXTRACTORS.value = False LAZY_EXTRACTORS.value = None
if not _CLASS_LOOKUP: if not _CLASS_LOOKUP:
from . import _extractors from . import _extractors

View File

@ -27,4 +27,4 @@ plugin_ies_overrides = Indirect(defaultdict(list))
# Misc # Misc
IN_CLI = Indirect(False) IN_CLI = Indirect(False)
LAZY_EXTRACTORS = Indirect(False) # `False`=force, `None`=disabled, `True`=enabled LAZY_EXTRACTORS = Indirect(None) # `False`=force, `None`=disabled, `True`=enabled