youtube-dl: [YouTube] New player 8c7583ff breaks native jsinterp.py

Checklist

  • I’m reporting a broken site support
  • I’ve verified that I’m running youtube-dl version 2021.12.17
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar issues including closed ones

Verbose log

yt-dl -vf 140-0 "byV5cdjspXs" --fixup never => 

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--ffmpeg-location', '.\\FFmpeg', '--external-downloader-args', '-v 8 -stats', '-vf', '140-0', 'byV5cdjspXs', '--fixup', 'never']
[debug] Encodings: locale cp1253, fs mbcs, out cp737, pref cp1253
[debug] youtube-dl version 2023.06.08.40298 (single file build)
[debug] Python 3.4.4 (CPython x86 32bit) - Windows-Vista-6.0.6003-SP2 - OpenSSL1.0.2d 9 Jul 2015
[debug] exe versions: ffmpeg n6.1-dev-1149-N-111033-gf11515c, ffprobe n6.1-dev-1149-N-111033-gf11515c, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] byV5cdjspXs: Downloading webpage
[youtube] Confirming age
[youtube] byV5cdjspXs: Downloading API JSON
[youtube] byV5cdjspXs: Downloading player 8c7583ff
WARNING: [youtube] Unable to decode n-parameter: download likely to be throttled
 (Unhandled exception in decode; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. 
 Traceback (most recent call last):
  File "D:\a\youtube-dl\youtube-dl\youtube_dl\extractor\youtube.py", line 1674, in _n_descramble
youtube_dl.utils.ExtractorError: 
Unhandled exception in decode; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.)
[debug] Invoking downloader on 'https://rr2---sn-4vguioxu-n3bz.googlevideo.com/videoplayback?expire=1686291610&ei=OnCCZM-VJ4zJ1gKevYuIDQ&ip=<redacted>&id=o-ADQ0W8pDv3oefStG68y67zTjGmnnUHkgpj8ijQpfp-eu&itag=140&source=youtube&requiressl=yes&mh=XT&mm=31%2C29&mn=sn-4vguioxu-n3bz%2Csn-nv47znel&ms=au%2Crdu&mv=m&mvi=2&pl=22&initcwndbps=835000&vprv=1&svpuc=1&mime=audio%2Fmp4&ns=gvLiz7maHkcpvyXJzg-t-88N&gir=yes&clen=9079821&dur=560.994&lmt=1650706237448239&mt=1686269580&fvip=4&keepalive=yes&fexp=24007246%2C24363393&beids=24350018&c=TVHTML5_SIMPLY_EMBEDDED_PLAYER&txp=5432434&n=DCYoFlCUN53KtD_oBe&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAKk2EtmJm4EZMhc0LH7PWqH9_Sjjv4cEeNNU5mq8_YYOAiEApRKNmY8hOPTmzh79MAupAbvjDnIYzGhQ6mhWDAlWFMo%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAP436cD-FVgJQr_R_5g7K6hU5D_Q_g0lHSlBcbWlGaXBAiEAk4qhmNFD46_MBEAnupU6xkJCfib7BTrRbFAqjJsFu5U%3D'
[dashsegments] Total fragments: 1
[download] Destination: Sex, Pleasure, Kink and BDSM _ Love Against The Odds _ Channel 4-byV5cdjspXs.m4a
[download]   2.6% of ~8.66MiB at 40.43KiB/s ETA 03:33
ERROR: Interrupted by user

Description

A short while after Jun 9th 2023 00:00 GMT, youtube (Google 😡 ) have started serving their new yt-player, 8c7583ff , selectively (for me) on age-gated content of the Channel 4 (UK) yt channel: https://www…youtube.com/@Channel4Documentaries

Other videos (on that same channel, as well as on the rest of youtube, at this time at least 😉 ) seem to still be using previous yt-player b128dda0, which doesn’t break the native JS interpreter; but I suppose this is CDN-propagation related, it’s conceivable this new 8c7583ff player will soon be the “norm” in all of youtube 😭 …

NB: My Windows build,

[debug] youtube-dl version 2023.06.08.40298 (single file build)

has been compiled from master HEAD (b8a86dc) ; I hope this latest breakage doesn’t turn out to be “a hard nut to crack” 😜 …

Thanks for your efforts, kind regards 😃 …

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 22 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Simple fix:

diff --git a/youtube_dl/jsinterp.py b/youtube_dl/jsinterp.py
index dc580943e..77551123d 100644
--- a/youtube_dl/jsinterp.py
+++ b/youtube_dl/jsinterp.py
@@ -82,7 +82,7 @@ def _js_arith_op(op):
 
 
 def _js_div(a, b):
-    if JS_Undefined in (a, b) or not (a and b):
+    if JS_Undefined in (a, b) or not (a or b):
         return _NaN
     return operator.truediv(a or 0, b) if b else float('inf')
 

Lesmiscore’s been inactive for a few weeks now. Don’t count on a manual fix immediately. Perhaps @dirkf should fork it as https://github.com/ytdl-org/youtube-dl-nightly or something.

It needs a workflow token because of the arses mentioned above.

In this case the blame subcommand of git is well named. Thanks to G and bashonly for debugging my typo.

Well, it’s reached the UK now.

The last expression being evaluated before the error is new Date("1970-01-01T09:15:00.000+09:15")/1E3. I’ll dig further.

It needs a workflow token because of the arses mentioned above.

The issue in the original workflow was that actions/checkout needed to be passed a workflow-enabled token but wasn’t being passed any explicit token

Try this: https://github.com/ytdl-org/ytdl-nightly/releases/tag/2023.07.03.19419

Thanks @pukkandan for the poke. As it wasn’t completely trivial, I had a slight justification for not having done it before.

Obvs it was tested to work before being committed! But using pukkandan’s test, since I’d only seen one case of the new player.

And now pushed to master, which was a lot more difficult than it needed to be because the arses responsible for the setup-python GH action decided to spend time breaking the action by removing Py2.7 instead of fixing some real problem.

Luckily @MatteoH2O1999 had already created a work-around action, and we may also get the ?much-missed? Python 3.3, 3.4 tests back soon as well.

Sure, the roll-out will be by CDN which must be correlated with (IP) geography. The uploader_id change took several days to appear here.

Thanks, not yet seen in UK:

--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1628,8 +1628,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
             if real_nfunc:
                 return real_nfunc
         return self._parse_json(self._search_regex(
-            r'var %s\s*=\s*(\[.+?\]);' % (re.escape(nfunc), ), jscode,
-            'Initial JS player n function name ({nfunc}[{idx}])'.format(**locals())), nfunc, transform_source=js_to_json)[int(idx)]
+            r'var %s\s*=\s*(\[.+?\])[;,]' % (re.escape(nfunc), ), jscode,
+            'Initial JS player n function name ({nfunc}[{idx}])'.format(**locals())),
+            nfunc, transform_source=js_to_json)[int(idx)]
 
     def _extract_n_function(self, video_id, player_url):
         player_id = self._extract_player_info(player_url)

… Can confirm the fix by bashonly works as advertised 👍 :

yt-dl -vf 140-0 "byV5cdjspXs" --fixup never => 

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--ffmpeg-location', '.\\FFmpeg', '--external-downloader-args', '-v 8 -stats', '-vf', '140-0', 'byV5cdjspXs', '--fixup', 'never']
[debug] Encodings: locale cp1253, fs mbcs, out cp737, pref cp1253
[debug] youtube-dl version 2023.06.11.0 (single file build)
[debug] Python 3.4.4 (CPython x86 32bit) - Windows-Vista-6.0.6003-SP2 - OpenSSL 1.0.2d 9 Jul 2015
[debug] exe versions: ffmpeg n6.1-dev-1149-N-111033-gf11515c, ffprobe n6.1-dev-1149-N-111033-gf11515c, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] byV5cdjspXs: Downloading webpage
[youtube] Confirming age
[youtube] byV5cdjspXs: Downloading API JSON
[debug] [youtube] Decrypted nsig W4cqVwlYooslsAXNQC => 9I3x0u7t3sakpA
[debug] [youtube] Decrypted nsig Fqo_VnXKp8F6HtAkbh => XUAO48p7bNno1A
[debug] Invoking downloader on 'https://rr2---sn-4vguioxu-n3bz.googlevideo.com/videoplayback?itag=140&gir=yes&sig=AOq0QJ8wRgIhAM6D0ztDWY3PiW2zrd1VkgKVUEr7SBKFUSaYzF-p2EqxAiEAwOZxmhT5DO9hAenf1HxA69TuyLgoe3j33zd46mMagpw%3D&ns=r037iHOMZ-tFqATFNJVa7FcN&lsig=AG3C_xAwRQIhAOq7xtv0v2db6RneP3-WZHKKoHGPgujPW-ymJOg6rSrPAiA6yF2ccg3fFcW0YYt6LgbxKAs7YaaUEpSpPOyBxD_3jQ%3D%3D&pl=21&initcwndbps=911250&mh=XT&dur=560.994&n=9I3x0u7t3sakpA&mm=31%2C29&id=o-AMRSPtDeqsS6A0AwES1baLKKcCozMEgDC5y4vaO9iZXU&source=youtube&mv=m&ms=au%2Crdu&expire=1686468648&fexp=24007246%2C24363393&svpuc=1&mime=audio%2Fmp4&keepalive=yes&txp=5432434&mn=sn-4vguioxu-n3bz%2Csn-nv47lnsy&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&mt=1686446730&clen=9079821&requiressl=yes&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&ip=<redacted>&fvip=1&vprv=1&lmt=1650706237448239&ei=yCOFZIKzEZKN1gK_lIeIBg&mvi=2&c=TVHTML5_SIMPLY_EMBEDDED_PLAYER'
[dashsegments] Total fragments: 1
[download] Destination: Sex, Pleasure, Kink and BDSM _ Love Against The Odds _ Channel 4-byV5cdjspXs.m4a
[download] 100% of 8.66MiB in 00:03

Many thanks, indeed ❤️ …