Compare commits

..

2 Commits

Author SHA1 Message Date
dirkf
ee37ce225b x 2025-03-08 23:30:46 +00:00
dirkf
e8a0514f4f [JSInterp] Improve tests
* from yt-dlp/yt-dlp#12313
* also fix d7c2708
2025-03-08 23:16:11 +00:00
2 changed files with 4 additions and 11 deletions

View File

@ -212,16 +212,10 @@ class TestJSInterpreter(unittest.TestCase):
# undefined
self._test(jsi, NaN, args=[JS_Undefined])
# y,m,d, ... - may fail with older dates lacking DST data
jsi = JSInterpreter(
self.assertAlmostEqual(JSInterpreter(
'function f() { return new Date(%s); }'
% ('2024, 5, 29, 2, 52, 12, 42',))
self._test(jsi, (
1719625932042 # UK value
+ (
+ 3600 # back to GMT
+ (time.altzone if time.daylight # host's DST
else time.timezone)
) * 1000))
% ('2024, 5, 29, 2, 52, 12, 42',)).call_function('f'),
1719625932042 + time.timezone * 1000, places=0)
# no arg
self.assertAlmostEqual(JSInterpreter(
'function f() { return new Date() - 0; }').call_function('f'),
@ -501,7 +495,6 @@ class TestJSInterpreter(unittest.TestCase):
self._test('function f(){return 0.0 << NaN}', 0)
self._test('function f(){return null << undefined}', 0)
def test_negative(self):
self._test('function f(){return 2 * -2.0 ;}', -4)
self._test('function f(){return 2 - - -2 ;}', 0)

View File

@ -3316,7 +3316,7 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
return
return merge_dicts(self.url_result(
update_url_query('https://www.youtube.com/playlist', {'list': content_id}),
ie=YoutubeTabIE.ie_key(), video_id=content_id), {
ie=YoutubeTabIE, video_id=content_id), {
'title': traverse_obj(view_model, (
'metadata', 'lockupMetadataViewModel', 'title', 'content', T(compat_str))),
'thumbnails': self._extract_thumbnails(view_model, (