@@ -5,34 +5,8 @@ block_cipher = None
55import os
66import sys
77
8- # Try to get tls_client dependencies path
8+ # Note: tls_client binaries are now handled by hooks/hook-tls_client.py
99tls_client_binaries = []
10- try :
11- import tls_client
12- tls_client_deps = os .path .join (os .path .dirname (tls_client .__file__ ), 'dependencies' )
13-
14- # Only add binaries that actually exist
15- potential_binaries = [
16- 'tls-client-32.dll' ,
17- 'tls-client-64.dll' ,
18- 'tls-client-amd64.so' ,
19- 'tls-client-arm64.dylib' ,
20- 'tls-client-arm64.so' ,
21- 'tls-client-x86.dylib' ,
22- 'tls-client-x86.so' ,
23- ]
24-
25- for binary in potential_binaries :
26- binary_path = os .path .join (tls_client_deps , binary )
27- if os .path .exists (binary_path ):
28- tls_client_binaries .append ((binary_path , 'tls_client/dependencies' ))
29- print (f"Found tls_client binary: { binary } " )
30-
31- # Also include the entire dependencies folder as data
32- if os .path .exists (tls_client_deps ):
33- print (f"Adding tls_client dependencies folder: { tls_client_deps } " )
34- except ImportError as e :
35- print (f"Warning: Could not import tls_client: { e } " )
3610
3711
3812# Use the current Python environment's site-packages (works for venv and CI)
@@ -44,20 +18,24 @@ datas = [
4418 ('backend' , '.' ),
4519]
4620
47- # Add fake_useragent data files if they exist
48- fake_useragent_data = os .path .join (site_packages , 'fake_useragent' , 'data' )
49- if os .path .exists (fake_useragent_data ):
50- datas .append ((fake_useragent_data , 'fake_useragent/data' ))
51-
52- # Add tls_client dependencies folder if it exists
21+ # Add fake_useragent data files manually (hooks don't always catch data files)
5322try :
54- import tls_client
55- tls_client_deps_dir = os .path .join (os .path .dirname (tls_client .__file__ ), 'dependencies' )
56- if os .path .exists (tls_client_deps_dir ):
57- datas .append ((tls_client_deps_dir , 'tls_client/dependencies' ))
58- print (f"Added tls_client dependencies to datas: { tls_client_deps_dir } " )
59- except :
60- pass
23+ import fake_useragent
24+ fake_useragent_base = os .path .dirname (fake_useragent .__file__ )
25+ fake_useragent_data = os .path .join (fake_useragent_base , 'data' )
26+
27+ if os .path .exists (fake_useragent_data ):
28+ # Add the entire data directory with its contents
29+ datas .append ((fake_useragent_data , 'fake_useragent/data' ))
30+ print (f"[OK] Added fake_useragent data: { fake_useragent_data } " )
31+
32+ # Also add py.typed if it exists
33+ py_typed = os .path .join (fake_useragent_base , 'py.typed' )
34+ if os .path .exists (py_typed ):
35+ datas .append ((py_typed , 'fake_useragent' ))
36+
37+ except Exception as e :
38+ print (f"[WARNING] Could not add fake_useragent data: { e } " )
6139
6240a = Analysis (
6341 ['backend/main.py' ],
@@ -103,7 +81,12 @@ a = Analysis(
10381 # Streaming
10482 'streamlink' ,
10583 'streamlink.plugins' ,
84+ # fake_useragent and its submodules
10685 'fake_useragent' ,
86+ 'fake_useragent.data' ,
87+ 'fake_useragent.utils' ,
88+ 'fake_useragent.fake' ,
89+ 'fake_useragent.errors' ,
10790 # TLS Client
10891 'tls_client' ,
10992 'tls_client.dependencies' ,
@@ -120,9 +103,9 @@ a = Analysis(
120103 'engineio.async_drivers' ,
121104 'engineio.async_drivers.gevent' ,
122105 ],
123- hookspath = [],
106+ hookspath = ['hooks' ],
124107 hooksconfig = {},
125- runtime_hooks = [],
108+ runtime_hooks = ['hooks/runtime-hook-fake_useragent.py' ],
126109 excludes = [],
127110 cipher = block_cipher ,
128111 noarchive = False ,
0 commit comments