2 """Imports all optional dependencies for the project.
3 An attribute "_yt_dlp__identifier" may be inserted into the module if it uses an ambiguous namespace"""
6 import brotlicffi
as brotli
19 from os
.path
import exists
as _path_exists
21 # The certificate may not be bundled in executable
22 if not _path_exists(certifi
.where()):
27 from Cryptodome
.Cipher
import AES
as Cryptodome_AES
30 from Crypto
.Cipher
import AES
as Cryptodome_AES
35 # In pycrypto, mode defaults to ECB. See:
36 # https://www.pycryptodome.org/en/latest/src/vs_pycrypto.html#:~:text=not%20have%20ECB%20as%20default%20mode
37 Cryptodome_AES
.new(b
'abcdefghijklmnop')
41 Cryptodome_AES
._yt
_dlp
__identifier
= 'pycrypto'
53 _SECRETSTORAGE_UNAVAILABLE_REASON
= None
55 _SECRETSTORAGE_UNAVAILABLE_REASON
= (
56 'as the `secretstorage` module is not installed. '
57 'Please install by running `python3 -m pip install secretstorage`')
58 except Exception as _err
:
59 _SECRETSTORAGE_UNAVAILABLE_REASON
= f
'as the `secretstorage` module could not be initialized. {_err}'
65 # although sqlite3 is part of the standard library, it is possible to compile python without
66 # sqlite support. See: https://github.com/yt-dlp/yt-dlp/issues/544
72 except (ImportError, SyntaxError):
73 # websockets 3.10 on python 3.6 causes SyntaxError
74 # See https://github.com/yt-dlp/yt-dlp/issues/2633
79 import xattr
# xattr or pyxattr
83 if hasattr(xattr
, 'set'): # pyxattr
84 xattr
._yt
_dlp
__identifier
= 'pyxattr'
87 all_dependencies
= {k: v for k, v in globals().items() if not k.startswith('_')}
90 available_dependencies
= {k: v for k, v in all_dependencies.items() if v}
95 'available_dependencies',
96 *all_dependencies
.keys(),