1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 08:35:32 +00:00

[ie/youtube] Fix nsig and signature extraction for player 643afba4 (#12684)

Closes #12677, Closes #12682
Authored by: seproDev, bashonly

Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
sepro
2025-03-21 21:58:10 +01:00
committed by GitHub
parent 2ee3a0aff9
commit 9b868518a1
4 changed files with 83 additions and 24 deletions

View File

@ -462,6 +462,16 @@ class TestJSInterpreter(unittest.TestCase):
]:
assert js_number_to_string(test, radix) == expected
def test_extract_function(self):
jsi = JSInterpreter('function a(b) { return b + 1; }')
func = jsi.extract_function('a')
self.assertEqual(func([2]), 3)
def test_extract_function_with_global_stack(self):
jsi = JSInterpreter('function c(d) { return d + e + f + g; }')
func = jsi.extract_function('c', {'e': 10}, {'f': 100, 'g': 1000})
self.assertEqual(func([1]), 1111)
if __name__ == '__main__':
unittest.main()