Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-parameter: Unhandled exception in decode #32066

Closed
6 tasks done
betterthanever2 opened this issue Apr 20, 2023 · 33 comments
Closed
6 tasks done

n-parameter: Unhandled exception in decode #32066

betterthanever2 opened this issue Apr 20, 2023 · 33 comments

Comments

@betterthanever2
Copy link

betterthanever2 commented Apr 20, 2023

Checklist

  • I'm reporting a broken site support issue
  • 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 bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

[2023-04-20 10:45:46,804 - INFO] Downloading Парибок Андрей. Искусство сопряженное с психотехнологиями. Трансляция состояний и намерений. (id 21922) from https://youtu.be/i2-ViOyC7Ek
[debug] Encodings: locale cp1251, fs utf-8, out utf-8, pref cp1251
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.10.5 (CPython) - Windows-10-10.0.19045-SP0
[debug] exe versions: ffmpeg 4.2.3, ffprobe 5.1.2-full_build-www.gyan.dev
[debug] Proxy map: {}
[youtube] i2-ViOyC7Ek: Downloading webpage
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; see  https://yt-dl.
org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\pypoetry\Cache\virtualenvs\wapatools-3SjGFAFe-py3.10\lib\site-packages\youtube_dl\extractor\youtube.py", line 1672, in _n_descramble
    raise ExtractorError('Unhandled exception in decode')
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; see  https://yt-dl.org/update  on how to update. Be sure to call you
tube-dl with the --verbose flag and include its complete output.
)
[debug] Invoking downloader on 'https://rr3---sn-fpaq25g3-oa8l.googlevideo.com/videoplayback?expire=1681998348&ei=rO1AZOLpGMOM7ATZ17jIDQ&ip=109.104.175.34&id=o-AKknyKgyubMl4R9EHIXwjBdgPDw6dl3Tx7K0_vRY3z0R&itag=140&source=youtube
&requiressl=yes&mh=QJ&mm=31%2C29&mn=sn-fpaq25g3-oa8l%2Csn-3c27snel&ms=au%2Crdu&mv=m&mvi=3&pcm2cms=yes&pl=21&initcwndbps=1542500&vprv=1&mime=audio%2Fmp4&ns=6BAWLWBNpwisYfXPM4aWKiUM&gir=yes&clen=59473523&dur=3674.813&lmt=164976146
2988446&mt=1681976453&fvip=15&keepalive=yes&fexp=24007246&c=WEB&txp=1311224&n=3cemMzCD7mQvT9&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAMvN1Ck7ififLU9D
gB2gUEyMJIq-Chp90btXUIsM_4EXAiBrVtfI5tuSrr74nfCB0Bfc3CqJs4qb3O_CHCXnLgDnNA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgWPmhU0H_-_-em5QH0po1qzSn7vHNYSV8QH8FD5CUX00CIHTF3ofj_wY5cga1_z7
r_T4Gc4yi6z28HdeyCpBIeZBF'
[dashsegments] Total fragments: 6
[download] Destination: D:\au\youtube\Парибок Андрей. Искусство сопряженное с психотехнологиями. Трансляция состояний и намерений.-i2-ViOyC7Ek-20161004.m4a

Description

When attempting to download from Youtube, I get Unable to decode n-parameter: download likely to be throttled (Unhandled exception in decode error. Downloading happens at low speed ~50-80 Kib/s

@dirkf
Copy link
Contributor

dirkf commented Apr 20, 2023

Please post the whole log without cropping the top!

In this case, I can see that you're trying to get the YT video with ID i2-ViOyC7Ek, but not what options you used. Anyhow, I can reproduce the issue and will investigate.

@betterthanever2
Copy link
Author

betterthanever2 commented Apr 20, 2023

Oh, I'm sorry. I'm actually using a script here, not the CLI, so the log is not cropped. But here are the options I use:

            "format": "bestaudio/best",
            "cookiefile": "D:\\Mega\\propagit\\running\\cookies.Work.txt",
            "outtmpl": f"{save_to_path}%(title)s-%(id)s-%(upload_date)s.%(ext)s",
            "writeinfotojson": True,
            "cachedir": "D:\\",
            "postprocessors": [
                {
                    'key': 'FFmpegExtractAudio',
                    'preferredcodec': 'mp3',
                    'preferredquality': '192',
                }
            ],
            "verbose": True
        }

And this happens to every video I try to download. Started yesterday.

@dirkf
Copy link
Contributor

dirkf commented Apr 20, 2023

yt-dlp/yt-dlp#6131 (comment)

@dirkf dirkf added the bug label Apr 20, 2023
@dirkf
Copy link
Contributor

dirkf commented Apr 21, 2023

Coming soon (the above commit):

$ python -m youtube_dl -v -F 'i2-ViOyC7Ek'
[debug] System config: [u'--prefer-ffmpeg']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-F', u'i2-ViOyC7Ek']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: 211cbfd5d
[debug] Python version 2.7.18 (CPython) - Linux-4.4.0-210-generic-i686-with-Ubuntu-16.04-xenial
[debug] exe versions: avconv 4.3, avprobe 4.3, ffmpeg 4.3, ffprobe 4.3
[debug] Proxy map: {}
[youtube] Extracting URL: i2-ViOyC7Ek
[youtube] i2-ViOyC7Ek: Downloading webpage
[debug] [youtube] Decrypted nsig crYhSJ5EIbtdN2OEP => jykH2eTdaP_Dqw
[debug] [youtube] Decrypted nsig cHQcRxq_Yj4Gi4qJ- => EKFC_eOif5yd2A
[info] Available formats for i2-ViOyC7Ek:
format code  extension  resolution note
249          webm       audio only tiny   47k , webm_dash container, opus @ 47k (48000Hz), 20.86MiB
250          webm       audio only tiny   59k , webm_dash container, opus @ 59k (48000Hz), 26.04MiB
251          webm       audio only tiny  117k , webm_dash container, opus @117k (48000Hz), 51.40MiB
140          m4a        audio only tiny  129k , m4a_dash container, mp4a.40.2@129k (44100Hz), 56.72MiB
160          mp4        256x144    144p   38k , mp4_dash container, avc1.4d400c@  38k, 25fps, video only, 16.73MiB
278          webm       256x144    144p   62k , webm_dash container, vp9@  62k, 25fps, video only, 27.53MiB
242          webm       426x240    240p   78k , webm_dash container, vp9@  78k, 25fps, video only, 34.32MiB
133          mp4        426x240    240p   85k , mp4_dash container, avc1.4d4015@  85k, 25fps, video only, 37.27MiB
134          mp4        640x360    360p  131k , mp4_dash container, avc1.4d401e@ 131k, 25fps, video only, 57.58MiB
243          webm       640x360    360p  134k , webm_dash container, vp9@ 134k, 25fps, video only, 58.99MiB
244          webm       854x480    480p  208k , webm_dash container, vp9@ 208k, 25fps, video only, 91.29MiB
135          mp4        854x480    480p  289k , mp4_dash container, avc1.4d401e@ 289k, 25fps, video only, 126.78MiB
247          webm       1280x720   720p  440k , webm_dash container, vp9@ 440k, 25fps, video only, 192.94MiB
136          mp4        1280x720   720p  628k , mp4_dash container, avc1.4d401f@ 628k, 25fps, video only, 275.33MiB
248          webm       1920x1080  1080p  596k , webm_dash container, vp9@ 596k, 25fps, video only, 261.49MiB
137          mp4        1920x1080  1080p 2500k , mp4_dash container, avc1.640028@2500k, 25fps, video only, 1.07GiB
18           mp4        640x360    360p  260k , avc1.42001E@ 260k, 25fps, mp4a.40.2@  0k (44100Hz)
22           mp4        1280x720   720p  757k , avc1.64001F@ 757k, 25fps, mp4a.40.2@  0k (44100Hz) (best)
$

@dirkf
Copy link
Contributor

dirkf commented Apr 21, 2023

You can just pull the jsinterp.py from my repo, or apply the diff, if you want to integrate this into your Python script ASAP.

@tasoss
Copy link

tasoss commented Apr 21, 2023

@dirkf thanks for the fix.
i have used your master's code to download https://www.youtube.com/watch?v=fassuEegOQo but i'm getting errors.
any ideas?

@dirkf
Copy link
Contributor

dirkf commented Apr 21, 2023

How should I guess? Do tell, what errors. The patch is only in my personal branch ATM while it's under test. A viable config should be yt-dl current master master with the jsinterp.py replaced by the one from the commit linked above.

@tasoss
Copy link

tasoss commented Apr 21, 2023

It would be quicker to try to download than paste the error here.
Anyway thanks.

@dirkf
Copy link
Contributor

dirkf commented Apr 21, 2023

Your URL is working fine here: hence the question.

@dirkf dirkf closed this as completed in 211cbfd Apr 21, 2023
@tasoss
Copy link

tasoss commented Apr 21, 2023

This is what i get when i replace jsinterp.py in the official repo.

tasoss@starla:~/youtube-dl$ ./youtube-dl --verbose "https://www.youtube.com/watch?v=fassuEegOQo"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--verbose', u'https://www.youtube.com/watch?v=fassuEegOQo']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 2.7.18 (CPython) - Linux-5.15.108-x86_64-12th_Gen_Intel-R-_Core-TM-_i7-12700KF-with-slackware-15.0
[debug] exe versions: ffmpeg N-110228-g4dffa564d1, ffprobe N-110228-g4dffa564d1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] fassuEegOQo: Downloading webpage
WARNING: [youtube] Unable to decode n-parameter: download likely to be throttled (Unsupported JS expression in: u'if(0!=e.length){d=(d%e.length+e.length)%e.length;var f=e[0];e[0]=e[d];e[d]=f}'; 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 "./youtube-dl/youtube_dl/extractor/youtube.py", line 1670, in _n_descramble
ret = func(n_param)
File "./youtube-dl/youtube_dl/extractor/youtube.py", line 1648, in
return lambda s: jsi.extract_function_from_code(*func_code)([s])
File "./youtube-dl/youtube_dl/jsinterp.py", line 674, in resf
ret, should_abort = self.interpret_statement(code.replace('\n', ''), var_stack, allow_recursion - 1)
File "./youtube-dl/youtube_dl/jsinterp.py", line 294, in interpret_statement
ret, should_abort = self.interpret_statement(try_expr, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 294, in interpret_statement
ret, should_abort = self.interpret_statement(try_expr, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 366, in interpret_statement
ret, should_abort = self.interpret_statement(sub_expr, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 455, in interpret_statement
right_expr, expr, local_vars, allow_recursion), should_return
File "./youtube-dl/youtube_dl/jsinterp.py", line 197, in _operator
right_val = self.interpret_expression(right_expr, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 590, in interpret_expression
ret, should_return = self.interpret_statement(expr, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 274, in interpret_statement
inner, should_abort = self.interpret_statement(inner, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 455, in interpret_statement
right_expr, expr, local_vars, allow_recursion), should_return
File "./youtube-dl/youtube_dl/jsinterp.py", line 197, in _operator
right_val = self.interpret_expression(right_expr, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 590, in interpret_expression
ret, should_return = self.interpret_statement(expr, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 579, in interpret_statement
for v in self._separate(m.group('args'))]
File "./youtube-dl/youtube_dl/jsinterp.py", line 590, in interpret_expression
ret, should_return = self.interpret_statement(expr, local_vars, allow_recursion)
File "./youtube-dl/youtube_dl/jsinterp.py", line 581, in interpret_statement
return local_vars[fname](argvals, allow_recursion=allow_recursion), should_return
File "./youtube-dl/youtube_dl/jsinterp.py", line 674, in resf
ret, should_abort = self.interpret_statement(code.replace('\n', ''), var_stack, allow_recursion - 1)
File "./youtube-dl/youtube_dl/jsinterp.py", line 587, in interpret_statement
'Unsupported JS expression ' + (expr[:40] if expr != stmt else ''), expr=stmt)
Exception: Unsupported JS expression in: u'if(0!=e.length){d=(d%e.length+e.length)%e.length;var f=e[0];e[0]=e[d];e[d]=f}'; 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] Default format spec: bestvideo+bestaudio/best
WARNING: Requested formats are incompatible for merge and will be merged into mkv.

@dirkf
Copy link
Contributor

dirkf commented Apr 21, 2023

Please try the brand new master code (#31530 provides updating instructions if you're not just checking it out with git, but the unofficial nightly builds won't be updated yet). Also, perhaps first, try --no-cache-dir and if that works --rm-cache-dir. The problem expression is in the player code that is processed correctly here.

@tasoss
Copy link

tasoss commented Apr 21, 2023

Ok thanks again!
ps: Commit 211cbfd fixes the problem.

@betterthanever2
Copy link
Author

Thank you, @dirkf !

@betterthanever2
Copy link
Author

betterthanever2 commented May 11, 2023

@dirkf I started to get the same problem again, with the same symptoms. Should I open a new issue?

@dirkf
Copy link
Contributor

dirkf commented May 11, 2023

I was able to repro with player cfa9e7cb, but now that's gone away. Check if the problem persists and post a verbose log if so.

cfa9e7cb.json
{"youtube-dl_version": "2021.12.17", "data": [["a"], "var b=a.split(\"\"),c=[1376333568,1823589072,-2144372238,\"\\u228b,}(\\\\\",1116357199,908545500,1787938,1551227465,1773490075,1224122792,function(d,e,f,h,l){return e(f,h,l)},\n-2065760685,function(d,e){e=(e%d.length+d.length)%d.length;d.splice(e,1)},\n1865143271,1123975766,-1841155129,-317410287,-91071786,null,function(d,e){for(e=(e%d.length+d.length)%d.length;e--;)d.unshift(d.pop())},\nfunction(d,e,f,h,l,m,n,p,q){return f(h,l,m,n,p,q)},\n1663147904,-846121055,-1357017406,-1764057255,function(){for(var d=64,e=[];++d-e.length-32;)switch(d){case 58:d=96;continue;case 91:d=44;break;case 65:d=47;continue;case 46:d=153;case 123:d-=58;default:e.push(String.fromCharCode(d))}return e},\n-630894549,1908399050,function(d,e){d.push(e)},\n-1872254917,1363217966,\"throw\",b,-1350318754,1668003369,1937163366,1463729574,1330313634,function(d,e,f,h,l,m,n,p){return e(f,h,l,m,n,p)},\n1212186150,function(d,e){if(0!=e.length){d=(d%e.length+e.length)%e.length;var f=e[0];e[0]=e[d];e[d]=f}},\n-765838684,\"reverse\",-817534470,null,function(){for(var d=64,e=[];++d-e.length-32;){switch(d){case 91:d=44;continue;case 123:d=65;break;case 65:d-=18;continue;case 58:d=96;continue;case 46:d=95}e.push(String.fromCharCode(d))}return e},\n626846541,-1367950889,-2112796328,-768513684,null,-1082956352,-1494415394,function(d){for(var e=d.length;e;)d.push(d.splice(--e,1)[0])},\n258269991,-400755099,-1925694323,b,-1598976963,916834761,-924149546,-210204449,1409185050,373906233,function(d,e,f,h,l,m){return e(h,l,m)},\n816354752,function(d){d.reverse()},\n-171453855,function(){for(var d=64,e=[];++d-e.length-32;)switch(d){case 46:d=95;default:e.push(String.fromCharCode(d));case 94:case 95:case 96:break;case 123:d-=76;case 92:case 93:continue;case 58:d=44;case 91:}return e},\n202221142,1012107866,-808618296,-881960835,function(){for(var d=64,e=[];++d-e.length-32;){switch(d){case 58:d-=14;case 91:case 92:case 93:continue;case 123:d=47;case 94:case 95:case 96:continue;case 46:d=95}e.push(String.fromCharCode(d))}return e},\n-755943633,function(d,e){0!=e.length&&(d=(d%e.length+e.length)%e.length,e.splice(0,1,e.splice(d,1,e[0])[0]))},\nb,-842097180,function(d,e,f){var h=f.length;e.forEach(function(l,m,n){this.push(n[m]=f[(f.indexOf(l)-f.indexOf(this[m])+m+h--)%f.length])},d.split(\"\"))},\n-1764057255,function(d,e){d=(d%e.length+e.length)%e.length;e.splice(-d).reverse().forEach(function(f){e.unshift(f)})},\n1494470409];c[18]=c;c[44]=c;c[50]=c;try{try{5!=c[71]&&(0>=c[36]||((((0,c[75])(c[77],c[76])!==(0,c[75])(c[16],c[32]))<<(((0,c[75])(c[Math.pow(8,5)%24- -21],c[50]),c[78])(c[42],c[-209318+new Date(\"1970-01-01T04:01:07.000+04:00\")/1E3*Math.pow(5,5)],(0,c[25])()),(0,c[75])(c[72],c[32]),c[28])(c[18],c[11590+Math.pow(1,4)+-11543])%(0,c[40])(c[49],c[44]),(0,c[80])(c[54],c[32]),c[19])(c[18],c[9]),0))&&(0,c[69])(((((0,c[26])(c[62],c[5],(0,c[21])()),(0,c[43])(c[5],c[17]),c[43])(c[24],c[8]),c[26])(c[73],c[24],\n(0,c[21])()),c[43])(c[81],c[29]),c[33957+Math.pow(5,2)+-33941],((0,c[Math.pow(8,4)%256+43])(c[5],c[38]),c[269%(new Date(\"1970-01-01T11:33:54.000+11:30\")/1E3)+Math.pow(2,4)-25])(c[62],c[5],(0,c[56])())*(0,c[43])(c[24],c[6]),c[14],c[49]),3>=c[19]?((((0,c[41])((0,c[50])(c[75],c[82]),c[32],c[20],c[72]),c[52])(c[72],c[22]),(0,c[37])(c[31],c[7]),(0,c[1])(c[21],c[56]),(0,c[-117*Math.pow(1,1)+118])(c[65],c[12]),c[42])(c[33]),((0,c[40])(c[new Date(\"1969-12-31T21:30:36.000-02:30\")/1E3]),c[13])(c[32],c[36]),\nc[53])(c[52],c[75]):(0,c[73])((((0,c[75])((0,c[40])(c[43]),c[15],c[51],c[17],(0,c[20])()),c[18])(c[34],c[17]),c[13])(c[72],c[0])>>>(0,c[81])(c[17],c[37]),(0,c[40])(c[61]),c[29],(0,c[15])(c[1*Math.pow(7,4)-2339],c[36],(0,c[68])())%(0,c[15])(c[62],c[36],(0,c[68])()),c[18],(0,c[15])(c[51],c[61],(0,c[48])()),c[47],c[17])}catch(d){(0,c[81])(c[36],c[59]),(0,c[15])(c[62],c[61],(0,c[68])())}finally{0!=c[82]&&(c[54]<Math.pow(3,2)-20+21||((0,c[53])(c[80],c[17-382%Math.pow(1,1)]),NaN))&&(0,c[new Date(\"1969-12-31T20:16:21.000-03:45\")/\n1E3])(c[17],c[78])}try{-1!==c[70]&&(6==c[72]||((0,c[29])((0,c[75])((0,c[75])((0,c[18])(c[50],c[61]),c[74],c[17],c[45]),c[27],c[61]),c[15],(0,c[74])(c[49],c[54]),c[13],c[70],(0,c[54])()),0))&&(0,c[6])((((0,c[49])(c[2],c[51],(0,c[19])()),c[61])(c[12]),c[25])(c[77],c[22]),c[26],(0,c[4])(c[9],c[12]),c[49],c[31+Math.pow(5,1)-34],c[51],(0,c[19])()),c[64]>new Date(\"1970-01-01T02:15:07.000+02:15\")/1E3?(0,c[52])(c[28+Math.pow(4,4)%244],c[77]):(0,c[52])(c[11],c[34]),-5>c[69]&&(5==c[Math.pow(8,2)+42-95]&&((0,c[49])(c[2],\nc[51],(0,c[54])()),1)||(0,c[4])(c[36],c[12])),5!=c[62]&&(10>c[55]?((0,c[52])(c[48],c[70]),c[47])(c[39],c[34]):((0,c[76])(c[29],c[78],(0,c[26])()),c[60-505%Math.pow(8,1)])(c[14],c[41]))}catch(d){(((0,c[59])(c[14],c[24]),c[31])(c[69],c[39]),c[76])(c[29],c[78],(0,c[81])()),(0,c[76])(c[40],c[39],(0,c[81])())}finally{-7<=c[35]&&(3===c[56]&&((0,c[53])((0,c[74])(c[34],c[14])+(0,c[18])(c[14]),c[76],c[29],c[39],(0,c[3])()),\"[/,\")||(0,c[53])((0,c[53])((0,c[18])(c[78]),c[31],c[Math.pow(4,5)%207+-142],c[61]),\nc[79],c[45],c[61])),9>c[19]&&(-9===c[1]||((0,c[7])((0,c[52])(c[21],c[35]),c[2],(0,c[37])(c[Math.pow(6,1)%234- -1],c[67]),c[22],c[11]),\"\"))&&((0,c[65])(c[20],c[63]),(0,c[82])(c[35],c[20],(0,c[52])())>(0,c[82])(c[46],c[45],(0,c[32])())),(-8===c[18]||((0,c[80])(c[76],c[67]),0))&&(0,c[38])(c[57],c[26]),-8!=c[-48+Math.pow(3,4)%252]&&(-1!=c[50]&&((0,c[32])((0,c[38])(c[76],c[71]),c[10],c[39],c[40]),1)||((0,c[80])(c[4]),c[38])(c[40],c[81])),-10!=c[0]&&(-7>=c[17]?(0,c[-17085+Math.pow(1,4)- -17116])((0,c[10])(c[51],\nc[40]),c[58],c[23],c[40]):((0,c[55])(c[8],c[76],(0,c[25])()),c[38])(c[57],c[44]))}}catch(d){return\"enhanced_except_n5gB4Of-_w8_\"+a}return b.join(\"\")"]}

@betterthanever2
Copy link
Author

@dirkf
options:

        options = {
            "format": "bestaudio/best",
            "cookiefile": "D:\\Mega\\propagit\\running\\cookies.txt",
            "outtmpl": f"{save_to_path}%(title)s-%(id)s-%(upload_date)s.%(ext)s",
            "writeinfotojson": True,
            "cachedir": "D:\\",
            "postprocessors": [
                {
                    'key': 'FFmpegExtractAudio',
                    'preferredcodec': 'mp3',
                    'preferredquality': '192',
                }
            ],
            "verbose": True
        }

Log:

[debug] Encodings: locale cp1251, fs utf-8, out utf-8, pref cp1251
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.10.5 (CPython) - Windows-10-10.0.19045-SP0
[debug] exe versions: ffmpeg 4.2.3, ffprobe 5.1.2-full_build-www.gyan.dev
[debug] Proxy map: {}
[youtube] 3gbIsY-eOq0: Downloading webpage
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; see  https://yt-dl.
org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\pypoetry\Cache\virtualenvs\wapatools-3SjGFAFe-py3.10\lib\site-packages\youtube_dl\extractor\youtube.py", line 1672, in _n_descramble
    raise ExtractorError('Unhandled exception in decode')
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; see  https://yt-dl.org/update  on how to update. Be sure to call you
tube-dl with the --verbose flag and include its complete output.
)
[debug] Invoking downloader on 'https://rr14---sn-axq7sn7z.googlevideo.com/videoplayback?expire=1683820437&ei=NbtcZMWkAcilyAWG0r7gAQ&ip=77.73.67.50&id=o-AAWjWQnE1MCwvL8rBHsN5bG8p_ClcpLErJqbwaA3N2ma&itag=140&source=youtube&requir
essl=yes&mh=Do&mm=31%2C26&mn=sn-axq7sn7z%2Csn-c0q7lnz7&ms=au%2Conr&mv=m&mvi=14&pl=25&gcr=lv&initcwndbps=1461250&vprv=1&svpuc=1&mime=audio%2Fmp4&ns=wdJ8UDl7lBJWC6_tCCxEgncN&gir=yes&clen=485510&dur=29.930&lmt=1670444063949440&mt=1
683798550&fvip=4&keepalive=yes&fexp=24007246&c=WEB&txp=6318224&n=MbBwnC1JWVZ4AsC8bj&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhALbS1_aRwgR
Hh_AtO-2khOY_OybUOWSCw2puxEELrG81AiAyX7brfuKIF_yx3-BBAdssVbPb5nZiPO53VnfllXSHjg%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgdMUdCzGQngl1quBa1vl-8nUlvY3HlH5dmVsgjMHbv6UCIQCWtnsblt25hLxXDdgbYfmu
tsBYUwQ8oF0eDtHkSYMMcA%3D%3D'
[dashsegments] Total fragments: 1
[download] Destination: D:\au\youtube\#shorts 3 ЭКЗАМЕНА ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.m4a
[download] 100% of 474.13KiB in 00:10
[ffmpeg] Correcting container in "D:\au\youtube\#shorts 3 ЭКЗАМЕНА ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.m4a"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:\au\youtube\#shorts 3 ЭКЗАМЕНА ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.m4a" -c copy -f mp4 "file:D:\au\youtube\#shorts 3 ЭКЗАМЕН
А ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.temp.m4a"
[debug] ffmpeg command line: ffprobe -show_streams "file:D:\au\youtube\#shorts 3 ЭКЗАМЕНА ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.m4a"
[ffmpeg] Destination: D:\au\youtube\#shorts 3 ЭКЗАМЕНА ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.mp3
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:\au\youtube\#shorts 3 ЭКЗАМЕНА ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.m4a" -vn -acodec libmp3lame "-b:a" 192k "file:D:\au\youtu
be\#shorts 3 ЭКЗАМЕНА ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.mp3"
Deleting original file D:\au\youtube\#shorts 3 ЭКЗАМЕНА ВМЕСТО 7! Вступительная кампания в 2023 году-3gbIsY-eOq0-20221207.m4a (pass -k to keep)

@dirkf
Copy link
Contributor

dirkf commented May 11, 2023

OK, looks like 3gbIsY-eOq0 is coming with the problem player whereas fassuEegOQo is still sending yesterday's player 65ceadf9.

@dirkf
Copy link
Contributor

dirkf commented May 11, 2023

The problem player code is trying to left-shift false (0, in this context) by NaN.

The correct (!) JS result for this is 0, and also for NaN << 0. null and undefined are already correctly handled in bit operations, but we are still throwing like Python when a NaN value is used.

The problem player isn't being served to me regularly, but I'll keep checking to verify that the consequent fix solves the issue.

@dirkf
Copy link
Contributor

dirkf commented May 11, 2023

Success:

$ python3.9 -m youtube_dl -v -F '3gbIsY-eOq0'
[debug] System config: ['--prefer-ffmpeg']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-F', '3gbIsY-eOq0']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: d0b1f995c
[debug] Python 3.9.16 (CPython 32bit) - Linux-4.4.0-210-generic-i686-with-glibc2.23 (OpenSSL 1.1.1t  7 Feb 2023, glibc 2.23)
[debug] exe versions: avconv 4.3, avprobe 4.3, ffmpeg 4.3, ffprobe 4.3
[debug] Proxy map: {}
[youtube] 3gbIsY-eOq0: Downloading webpage
> /home/df/Documents/src/youtube-dl/youtube_dl/extractor/youtube.py(1662)_n_descramble()
-> sig_id = ('nsig_value', n_param)
(Pdb) p player_url
'https://www.youtube.com/s/player/cfa9e7cb/player_ias.vflset/en_US/base.js'
(Pdb) c
[debug] [youtube] Decrypted nsig Ym5AQeQbA2N56kd-ov => PBcV05aInCFS6w
...
[debug] [youtube] Decrypted nsig gQQRhkv9X8BrpB06v6 => PUMGuyQl8dp_Ag
...
[info] Available formats for 3gbIsY-eOq0:
format code  extension  resolution note
249          webm       audio only tiny   51k , webm_dash container, opus  (48000Hz), 186.89KiB
250          webm       audio only tiny   60k , webm_dash container, opus  (48000Hz), 220.88KiB
251          webm       audio only tiny  113k , webm_dash container, opus  (48000Hz), 412.58KiB
140          m4a        audio only tiny  129k , m4a_dash container, mp4a.40.2 (44100Hz), 474.13KiB
160          mp4        144x256    144p   63k , mp4_dash container, avc1.4d400c, 25fps, video only, 231.75KiB
278          webm       144x256    144p   80k , webm_dash container, vp9, 25fps, video only, 294.58KiB
242          webm       240x426    240p  128k , webm_dash container, vp9, 25fps, video only, 468.80KiB
133          mp4        240x426    240p  141k , mp4_dash container, avc1.4d4015, 25fps, video only, 515.75KiB
243          webm       360x640    360p  224k , webm_dash container, vp9, 25fps, video only, 819.92KiB
134          mp4        360x640    360p  264k , mp4_dash container, avc1.4d401e, 25fps, video only, 965.64KiB
244          webm       480x854    480p  364k , webm_dash container, vp9, 25fps, video only, 1.30MiB
135          mp4        480x854    480p  588k , mp4_dash container, avc1.4d401e, 25fps, video only, 2.10MiB
247          webm       720x1280   720p  643k , webm_dash container, vp9, 25fps, video only, 2.29MiB
136          mp4        720x1280   720p 1117k , mp4_dash container, avc1.64001f, 25fps, video only, 3.98MiB
248          webm       1080x1920  1080p 1133k , webm_dash container, vp9, 25fps, video only, 4.04MiB
137          mp4        1080x1920  1080p 2039k , mp4_dash container, avc1.640028, 25fps, video only, 7.26MiB
18           mp4        270x480    240p  421k , avc1.42001E, 25fps, mp4a.40.2 (48000Hz), 1.50MiB
22           mp4        720x1280   720p 1246k , avc1.64001F, 25fps, mp4a.40.2 (44100Hz) (best)
$

The relevant change:

     return update_and_rename_wrapper
 
 
+_NaN = float('nan')
+
+
 def _js_bit_op(op):
 
     def zeroise(x):
-        return 0 if x in (None, JS_Undefined) else x
+        return 0 if x in (None, JS_Undefined, _NaN) else x
 
     @wraps_op(op)
     def wrapped(a, b):

@betterthanever2
Copy link
Author

thank you, @dirkf !

@betterthanever2
Copy link
Author

betterthanever2 commented May 12, 2023

but I'm still getting the error... :(
here's a new log:

[2023-05-12 09:51:42,857 - INFO] Downloading На Тыднях Германii ў Мiнску адбудзецца каля 20 мерапрыемстваў (id 77274) from https://youtu.be/N8bFmZPP4Cg
[debug] Encodings: locale cp1251, fs utf-8, out utf-8, pref cp1251
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.10.5 (CPython) - Windows-10-10.0.19045-SP0
[debug] exe versions: ffmpeg 4.2.3, ffprobe 5.1.2-full_build-www.gyan.dev
[debug] Proxy map: {}
[youtube] N8bFmZPP4Cg: Downloading webpage
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; see  https://yt-dl.
org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\pypoetry\Cache\virtualenvs\wapatools-3SjGFAFe-py3.10\lib\site-packages\youtube_dl\extractor\youtube.py", line 1672, in _n_descramble
    raise ExtractorError('Unhandled exception in decode')
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; see  https://yt-dl.org/update  on how to update. Be sure to call you
tube-dl with the --verbose flag and include its complete output.
)
[debug] Invoking downloader on 'https://rr5---sn-axq7sn76.googlevideo.com/videoplayback?expire=1683895904&ei=AOJdZKuXAt7vyQXG-6O4DA&ip=77.73.67.5&id=o-AHLbWl1T-8lu_8JcMT7kZa8VQkezBj1HhAfvwGfxA_sF&itag=140&source=youtube&requires
sl=yes&mh=ZI&mm=31%2C26&mn=sn-axq7sn76%2Csn-c0q7lnly&ms=au%2Conr&mv=m&mvi=5&pl=25&gcr=lv&initcwndbps=856250&vprv=1&svpuc=1&mime=audio%2Fmp4&ns=lNU6GfvBNROUkPcNH38vhXQN&gir=yes&clen=5416216&dur=334.622&lmt=1570006085796303&mt=168
3873908&fvip=4&keepalive=yes&fexp=24007246&c=WEB&txp=2311222&n=dg5QR_gstkgYsFQJqC&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgBtueHWtX-LAt9
FVYDWxOOym7bnaLoCK6f44LReQwV84CIHHnExEQsX1Ry4GtPQZvx8IWwySiiWMSqWGw-8cu8155&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgC1o0XTK2MWY6iF5pkKmWvyX25wgo6YqJMggAO0UV-rkCIFkkZfRGhjePPBrDqtVc633h55kQMXekWF
WPvNegxV7d'
[dashsegments] Total fragments: 1
[download] Destination: D:\au\youtube\На Тыднях Германii ў Мiнску адбудзецца каля 20 мерапрыемстваў-N8bFmZPP4Cg-20191002.m4a
[download]  16.7% of ~5.17MiB at 44.94KiB/s ETA 01:38

UPD: not getting the error anymore... Not sure what it was.

@betterthanever2
Copy link
Author

betterthanever2 commented May 12, 2023

Ok, I'm getting this on some videos. Since all the logs are the same, I'm gonna add here some video IDs this thing occurs on:

  • https://youtu.be/TlkLD0flJpw
  • https://youtu.be/auayqXwgp5A
  • https://youtu.be/J6vjGEA6BRk
  • https://youtu.be/6PgYgnVusyM
  • https://youtu.be/6o87rGLylSw

@dirkf
Copy link
Contributor

dirkf commented May 12, 2023

Fixed in a85a875.

Use --no-cache-dir to force display of the player ID. If you see "Unable to decode n-parameter" and player cfa9e7cb, you need to ensure that you have the master code committed last night. If you see it with some other player, please report.

The URLs above all showed cfa9e7cb for me and successfully decrypt the nsig.

@betterthanever2
Copy link
Author

is it "nocachedir": True when with scripts?

@dirkf
Copy link
Contributor

dirkf commented May 12, 2023

$ python3.9 ./devscripts/cli_to_api.py --no-cache-dir
{'cachedir': False}
$ 

@betterthanever2
Copy link
Author

if you don't mind me asking, what is the relationship between cache dir and displaying player ID?

@dirkf
Copy link
Contributor

dirkf commented May 12, 2023

It's just that, currently, the player ID is only shown in the debug output when first downloading the player JS, and not when fetching from cache.

@gamer191
Copy link

The correct (!) JS result for this is 0, and also for NaN << 0. null and undefined are already correctly handled in bit operations, but we are still throwing like Python when a NaN value is used.

For future proofing, should Infinity also be zeroised? Any number << Infinity equals the original number. That said, I don't know how to test jsinterp, so I'm just assuming it doesn't already do that?

@dirkf
Copy link
Contributor

dirkf commented May 12, 2023

test/test_jsinterp.py !

Currently, Infinity is seen by jsinterp as a variable name with no value, so it's undefined, which is already handled. If we needed to recognise Infinity (as with NaN), the change you suggested would be required.

Actually, the fix I used has a subtle potential bug. The comment at l.132 points out that "NaN cannot be checked by membership". NaN values obtained by float('nan') (or, in Py3, evaluation of math.nan) are all != themselves (and also != any number). However, in the fix code every instance of JS NaN is changed into the same float('nan'), and any other NaN is the same value returned from one of the built-in operators: at least this is true for the tests and for the problem player. The Python in operator tests for both identity (is) and equality (==), and the former succeeds for NaN in [NaN]. So the test in zeroise() does work, whereas the fragment shown above on its own might not.

dirkf referenced this issue May 12, 2023
* also add _NaN
* also pull function naming from yt-dlp
@betterthanever2
Copy link
Author

@dirkf it happened again (
Here's debug output:

[2023-06-09 11:25:08,098 - INFO] Downloading Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера (id 176020) from https://youtu.be/RLu3u5JLmxc
[debug] Encodings: locale cp1251, fs utf-8, out utf-8, pref cp1251
[debug] youtube-dl version 2021.12.17
[debug] Python 3.10.5 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 - OpenSSL 1.1.1n  15 Mar 2022
[debug] exe versions: ffmpeg 4.2.3, ffprobe 5.1.2-full_build-www.gyan.dev
[debug] Proxy map: {}
[youtube] RLu3u5JLmxc: Downloading webpage
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; see  https://yt-dl.
org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last):
  File "C:\Users\USER\AppData\Local\pypoetry\Cache\virtualenvs\wapatools-3SjGFAFe-py3.10\lib\site-packages\youtube_dl\extractor\youtube.py", line 1674, in _n_descramble
    raise ExtractorError('Unhandled exception in decode')
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; see  https://yt-dl.org/update  on how to update. Be sure to call you
tube-dl with the --verbose flag and include its complete output.
)
[debug] Invoking downloader on 'https://rr4---sn-5uh5o-f5fs.googlevideo.com/videoplayback?expire=1686320710&ei=5uGCZP21KZWr7QS_jrqwBw&ip=149.102.244.24&id=o-ACNe-Zdf61URrQEXTf4R_A_JdSARg6In1G9ZX6OhEdzA&itag=140&source=youtube&re
quiressl=yes&mh=Kp&mm=31%2C29&mn=sn-5uh5o-f5fs%2Csn-f5f7lnld&ms=au%2Crdu&mv=m&mvi=4&pl=27&initcwndbps=1985000&spc=qEK7B_rFFeYLNMG8r4qOz2A-1G4gzUagbKBiuECqlw&vprv=1&svpuc=1&mime=audio%2Fmp4&ns=IYOHGHX8j-96iA_oU5rlXqkN&gir=yes&cle
n=3592920&dur=221.959&lmt=1680295581744853&mt=1686298866&fvip=4&keepalive=yes&fexp=24007246%2C24363393%2C51000011&beids=24350018&c=WEB&txp=5318224&n=t3ladBVapsiB7SzaCJ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2
Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAMtKUFOnM0YfIynljS5vrV2_M6sF-XuTcktAZxIpHVW1AiEAwjGjN9srL1kSyRZ1-7WNW3_oL5dUkuds-_80IXaG0KY%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsi
g=AG3C_xAwRQIhALpYb74TeodRAbr9E-1EKY_u8iVM0vGO8mb9SeSSkr8zAiAH19Fq0KOgvo47yVo6QSpmJ9QKbceqInL7ZaibBqdzxw%3D%3D'
[dashsegments] Total fragments: 1
[download] Destination: D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.m4a
[download] 100% of 3.43MiB in 00:46
[ffmpeg] Correcting container in "D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.m4a"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.m4a" -c copy -f mp4
"file:D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.temp.m4a"
[debug] ffmpeg command line: ffprobe -show_streams "file:D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.m4a"
[ffmpeg] Destination: D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.mp3
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.m4a" -vn -acodec lib
mp3lame "-b:a" 192k "file:D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.mp3"
Deleting original file D:\au\youtube\Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера-RLu3u5JLmxc-20230331.m4a (pass -k to keep)
[2023-06-09 11:26:01,198 - INFO] Download successful. youtube_vids was updated with new status for Армии РФ и КНР на одной стороне. Что осталось за кадром нашего обзора 28 марта и подтвердилось вчера (id 176020) record

As before, downloading is done with a script, options being:

        options = {
            "format": "bestaudio/best",
            "cookiefile": "D:\\Mega\\propagit\\running\\cookies.Work.txt",
            "outtmpl": f"{save_to_path}%(title)s-%(id)s-%(upload_date)s.%(ext)s",
            "writeinfotojson": True,
            # "cachedir": "D:\\",
            "postprocessors": [
                {
                    'key': 'FFmpegExtractAudio',
                    'preferredcodec': 'mp3',
                    'preferredquality': '192',
                }
            ],
            "verbose": True
        }

@dirkf
Copy link
Contributor

dirkf commented Jun 9, 2023

See #32292.

@betterthanever2
Copy link
Author

@dirkf it happened again(

[youtube] O_GD_NrkT88: Downloading player b7910ca8
WARNING: [youtube] Unable to decode n-parameter: download likely to be throttled (Unable to extract Initial JS player n function alias (Usa[0]); please report this issue on https://yt-dl.org/bug . Make sure you are using the lat
est version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

@dirkf
Copy link
Contributor

dirkf commented Jun 23, 2023

Already fixed in master: #32292 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants