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

[jsinterp] Fix extract_object (#13580)

Fixes sig extraction for YouTube player `e12fbea4`

Authored by: seproDev
This commit is contained in:
sepro
2025-06-30 15:50:33 +02:00
committed by GitHub
parent 1b88384634
commit 958153a226
3 changed files with 10 additions and 1 deletions

View File

@ -478,6 +478,10 @@ class TestJSInterpreter(unittest.TestCase):
func = jsi.extract_function('c', {'e': 10}, {'f': 100, 'g': 1000})
self.assertEqual(func([1]), 1111)
def test_extract_object(self):
jsi = JSInterpreter('var a={};a.xy={};var xy;var zxy={};xy={z:function(){return "abc"}};')
self.assertTrue('z' in jsi.extract_object('xy', None))
def test_increment_decrement(self):
self._test('function f() { var x = 1; return ++x; }', 2)
self._test('function f() { var x = 1; return x++; }', 1)