Skip to content

Commit

Permalink
[test:youtube_signature] Add nsig test for player 3bb1f723
Browse files Browse the repository at this point in the history
Authored by: bashonly
  • Loading branch information
bashonly committed Dec 6, 2024
1 parent d106181 commit 5c08250
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/test_youtube_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@
'https://www.youtube.com/s/player/b12cc44b/player_ias.vflset/en_US/base.js',
'keLa5R2U00sR9SQK', 'N1OGyujjEwMnLw',
),
(
'https://www.youtube.com/s/player/3bb1f723/player_ias.vflset/en_US/base.js',
'VJm3Qt8oaR7JZFaG_23', 'gg5tzBVPlOUNMgA',
),
]


Expand Down Expand Up @@ -254,8 +258,11 @@ def signature(jscode, sig_input):


def n_sig(jscode, sig_input):
funcname = YoutubeIE(FakeYDL())._extract_n_function_name(jscode)
return JSInterpreter(jscode).call_function(funcname, sig_input)
ie = YoutubeIE(FakeYDL())
funcname = ie._extract_n_function_name(jscode)
jsi = JSInterpreter(jscode)
func = jsi.extract_function_from_code(*ie._fixup_n_function_code(*jsi.extract_function_code(funcname)))
return func([sig_input])


make_sig_test = t_factory(
Expand Down

0 comments on commit 5c08250

Please sign in to comment.