]>
jfr.im git - yt-dlp.git/blob - yt_dlp/__pyinstaller/hook-yt_dlp.py
3 from PyInstaller
.utils
.hooks
import collect_submodules
, collect_data_files
6 def pycryptodome_module():
8 import Cryptodome
# noqa: F401
11 import Crypto
# noqa: F401
12 print('WARNING: Using Crypto since Cryptodome is not available. '
13 'Install with: python3 -m pip install pycryptodomex', file=sys
.stderr
)
20 def get_hidden_imports():
21 yield from ('yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated')
22 yield from ('yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated')
23 yield pycryptodome_module()
24 # Only `websockets` is required, others are collected just in case
25 for module
in ('websockets', 'requests', 'urllib3'):
26 yield from collect_submodules(module
)
27 # These are auto-detected, but explicitly add them just in case
28 yield from ('mutagen', 'brotli', 'certifi', 'secretstorage', 'curl_cffi')
31 hiddenimports
= list(get_hidden_imports())
32 print(f
'Adding imports: {hiddenimports}')
34 excludedimports
= ['youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts', 'bundle']
36 datas
= collect_data_files('curl_cffi', includes
=['cacert.pem'])