aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2025-03-07 20:00:58 +0000
committerdirkf <fieldhouse@gmx.net>2025-03-11 02:00:24 +0000
commit422b1b31cf398d60b4606fa57be8e39c1181932f (patch)
treea763ad0aa90e528562b41e29425ba766312e14b7
parent1dc27e1c3bda9cb8f44b805c89918aa7d11ffcdc (diff)
[YouTube] Temporarily redirect from tce-style player JS
-rw-r--r--youtube_dl/extractor/youtube.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 5f8c08201..9e200105e 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1607,9 +1607,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
webpage or '', 'player URL', fatal=False)
if player_url:
ytcfgs = ytcfgs + ({'PLAYER_JS_URL': player_url},)
- return traverse_obj(
+ player_url = traverse_obj(
ytcfgs, (Ellipsis, 'PLAYER_JS_URL'), (Ellipsis, 'WEB_PLAYER_CONTEXT_CONFIGS', Ellipsis, 'jsUrl'),
get_all=False, expected_type=lambda u: urljoin('https://www.youtube.com', u))
+ nplayer_url, is_tce = re.subn(r'(?<=/player_ias)_tce(?=\.vflset/)', '', player_url or '')
+ if is_tce:
+ # TODO: Add proper support for the 'tce' variant players
+ # See https://github.com/yt-dlp/yt-dlp/issues/12398
+ self.write_debug('Modifying tce player URL: {0}'.format(player_url))
+ return nplayer_url
+ return player_url
def _download_player_url(self, video_id, fatal=False):
res = self._download_webpage(