]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/compat/__init__.py
[cleanup] Misc fixes and cleanup
[yt-dlp.git] / yt_dlp / compat / __init__.py
index c02e843d49d19d074ba751ec7ab319ab1c39c43d..35875ed20ed2ee67c10c0a1042cc07fd37b69fd9 100644 (file)
@@ -9,8 +9,13 @@
 
 
 # XXX: Implement this the same way as other DeprecationWarnings without circular import
-passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
-    DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=2))
+try:
+    passthrough_module(__name__, '._legacy', callback=lambda attr: warnings.warn(
+        DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=2))
+    HAS_LEGACY = True
+except ModuleNotFoundError:
+    # Keep working even without _legacy module
+    HAS_LEGACY = False
 del passthrough_module