@@ -929,7 +929,7 @@ def replace_n_signatures(info):
929929 parsed_url .fragment ]
930930 )
931931 end = time .perf_counter ()
932- print (f"Decrypted nsig for { len (info ['formats' ])} formats in { end - start } s" )
932+ print (f"Decrypted nsig for { len (info ['formats' ])} formats in { end - start :.2f } s" )
933933 return False
934934
935935def decrypt_signatures (info ):
@@ -976,7 +976,7 @@ def decrypt_signatures(info):
976976 urllib .parse .urlencode (query_param_dict ),
977977 parsed_url .fragment ))
978978 end = time .perf_counter ()
979- print (f"Decrypted signatures for { len (info ['formats' ])} formats in { end - start } s" )
979+ print (f"Decrypted signatures for { len (info ['formats' ])} formats in { end - start :.2f } s" )
980980
981981 return False
982982
@@ -1010,6 +1010,8 @@ def get_js_runtime():
10101010js_runtime = get_js_runtime ()
10111011
10121012def ejs_decrypt (player_version , nsig , sig = []):
1013+ if not js_runtime :
1014+ raise NameError ("No supported js_runtime is found!\n Supported runtimes: deno, bun, node." )
10131015 player_cache = os .path .join (settings .data_dir , f'iframe_api_base_{ player_version } .js' )
10141016 processed_cache = os .path .join (settings .data_dir , f'processed_{ player_version } .js' )
10151017 code_fd , code_tempfile = tempfile .mkstemp (prefix = 'yt-ejs-' , suffix = '.js' , text = True )
@@ -1045,8 +1047,6 @@ def ejs_decrypt(player_version, nsig, sig=[]):
10451047 '''
10461048 with open (code_tempfile , 'w' ) as file :
10471049 file .write (jscode )
1048- if not js_runtime :
1049- raise NameError ("No supported js_runtime is found!\n Supported runtimes: deno, bun, node." )
10501050 result = subprocess .run ([js_runtime , code_tempfile ], capture_output = True )
10511051 result .check_returncode ()
10521052 result_json = json .loads (result .stdout .decode ())
0 commit comments