diff options
author | bashonly <88596187+bashonly@users.noreply.github.com> | 2023-06-10 17:49:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-10 22:49:12 +0000 |
commit | b4a252fba81f53631c07ca40ce7583f5d19a8a36 (patch) | |
tree | 6fc21ea8b586f9b1eafd7525da6b8bdc9b4ea7f5 /test | |
parent | 4f7b11cc1c1cebf598107e00cd7295588ed484da (diff) | |
download | hypervideo-pre-b4a252fba81f53631c07ca40ce7583f5d19a8a36.tar.lz hypervideo-pre-b4a252fba81f53631c07ca40ce7583f5d19a8a36.tar.xz hypervideo-pre-b4a252fba81f53631c07ca40ce7583f5d19a8a36.zip |
[jsinterp] Fix division (#7279)
* Fixes nsig decryption for Youtube JS player `8c7583ff`
Authored by: bashonly
Diffstat (limited to 'test')
-rw-r--r-- | test/test_jsinterp.py | 7 | ||||
-rw-r--r-- | test/test_youtube_signature.py | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py index 4d44e6efe..b01477e6f 100644 --- a/test/test_jsinterp.py +++ b/test/test_jsinterp.py @@ -28,6 +28,13 @@ class TestJSInterpreter(unittest.TestCase): def test_calc(self): self._test('function f(a){return 2*a+1;}', 7, args=[3]) + def test_div(self): + jsi = JSInterpreter('function f(a, b){return a / b;}') + self.assertTrue(math.isnan(jsi.call_function('f', 0, 0))) + self.assertTrue(math.isnan(jsi.call_function('f', JS_Undefined, 1))) + self.assertTrue(math.isinf(jsi.call_function('f', 2, 0))) + self.assertEqual(jsi.call_function('f', 0, 3), 0) + def test_empty_return(self): self._test('function f(){return; y()}', None) diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index 13120d97f..01f09de88 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -150,6 +150,10 @@ _NSIG_TESTS = [ 'https://www.youtube.com/s/player/cfa9e7cb/player_ias.vflset/en_US/base.js', 'aCi3iElgd2kq0bxVbQ', 'QX1y8jGb2IbZ0w', ), + ( + 'https://www.youtube.com/s/player/8c7583ff/player_ias.vflset/en_US/base.js', + '1wWCVpRR96eAmMI87L', 'KSkWAVv1ZQxC3A', + ), ] |