Compare commits

..

6 Commits

Author SHA1 Message Date
dirkf
e5a0422f8d
Merge branch 'master' into df-yt-update202503 2025-03-10 17:19:37 +00:00
dirkf
7de9312078 [JSInterp] Improve tests
* from yt-dlp/yt-dlp#12313
* also fix d7c2708
2025-03-10 11:44:06 +00:00
dirkf
673277e510
[YouTube] Fix 91b1569 2025-02-28 01:02:20 +00:00
dirkf
91b1569f68
[YouTube] Fix channel playlist extraction (#33074)
* [YouTube] Extract playlist items from LOCKUP_VIEW_MODEL_...
* resolves #33073
* thx seproDev (yt-dlp/yt-dlp#11615)

Co-authored-by: sepro <sepro@sepr0.com>
2025-02-28 00:02:10 +00:00
dirkf
711e72c292 [JSInterp] Fix bit-shift coercion for player 9c6dfc4a 2025-02-07 00:01:50 +00:00
dirkf
26b6f15d14 [compat] Make casefold private
* if required, not supported:
`from youtube_dl.casefold import _casefold as casefold`
2025-02-07 00:01:50 +00:00
2 changed files with 11 additions and 4 deletions

View File

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

View File

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