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

Regarding Youtube-dl download speed is limited by the YouTube website #30097

Closed
szhaolu opened this issue Oct 13, 2021 · 27 comments
Closed

Regarding Youtube-dl download speed is limited by the YouTube website #30097

szhaolu opened this issue Oct 13, 2021 · 27 comments

Comments

@szhaolu
Copy link

szhaolu commented Oct 13, 2021

Recently, when using Youtube-dl, it was discovered that the download speed of some content was restricted. Generally, it is controlled at 80kbps/s-35kbps/s. I don't know how to fix this fault. In particular, the webm format video and audio content are faulty. Other formats have not been tested yet. How to solve it! Thanks!

@eamonne
Copy link

eamonne commented Oct 13, 2021

I came here to look in to the same issue. grabbing 4k (so webm as well) content is heavily throttled.

edit: disregard, read the other threads and issue is fixed using the yt-dlp fork/successor

@dirkf
Copy link
Contributor

dirkf commented Oct 13, 2021

Duplicate of #29326.

@kata44
Copy link

kata44 commented Oct 13, 2021

@dirkf
Not a duplicate. Before, it just happened randomly sometimes, but could easily be circumvented by restarting the download.
Now downloads are always throttled.

@dnckr
Copy link

dnckr commented Oct 13, 2021

@kata44 do you have a example video that demonstrates the issue?

Hi! One of many examples:
https://www.youtube.com/watch?v=wCSdScabxow

I can fully confirm the issue. It is ongoing since (at least) several days). Most videos that I tried during that time come in with a maximum of 80 KB/s.

Cheers!

@alex-kronish
Copy link

I'm having the same problem, for the past week or two I can't seem to get any speeds from youtube greater than 100-200 kb/s

@martin-tk
Copy link

I too noticed slow downloads from youtube since a week or two

@leohub2016
Copy link

same, slow downloads from youtube (80 kb/sec)

@mibli
Copy link

mibli commented Oct 13, 2021

I'm experiencing the same issue since a week or so. Previously I would sometimes have issue with choppy video when the video wasn't completely cached (sometimes just running desired quality and restarting it after a few minutes would fix the issue). Now it's unescapable.

@qzmtch
Copy link

qzmtch commented Oct 13, 2021

just use yt-dlp

@dirkf
Copy link
Contributor

dirkf commented Oct 13, 2021

So the Android client hack still works despite the apparently stronger throttling and should be back-ported?

@dirkf
Copy link
Contributor

dirkf commented Oct 13, 2021

@dirkf Not a duplicate. Before, it just happened randomly sometimes, but could easily be circumvented by restarting the download. Now downloads are always throttled.

No, apparently now it depends on the reporter. Maybe your IP has some history of regular large downloads? Maybe no-one, not even YT staff, knows why the throttling occurs because it depends on some deep learning algorithm?

I suggest that implementing either the challenge-response algorithm in the linked thread or (for the moment?) using the Android client bypass from yt-dlp should resolve this issue.

@bhz6344
Copy link

bhz6344 commented Oct 14, 2021

I tried different IP addresses and found that the speed limit was between 50 KB/s and 150 KB/s.

@dizys
Copy link

dizys commented Oct 14, 2021

I can confirm that this happens on our kubernetes nodes and local machines as well. The speed is limited to around 50KB/s. We operate under 1Gbps networks.

@szhaolu
Copy link
Author

szhaolu commented Oct 14, 2021

just use yt-dlp
Thank you so much for your answers! The problem is solved!

@dnckr
Copy link

dnckr commented Oct 14, 2021

I can confirm that yt-dlp works flawless with videos that get throttled via youtube-dl. But that does not solve the problem, I guess. However, nice workaround for the meantime!

@desbma
Copy link

desbma commented Oct 14, 2021

I can confirm that yt-dlp works flawless with videos that get throttled via youtube-dl. But that does not solve the problem, I guess. However, nice workaround for the meantime!

Actually it does.

This project has had its last commit more than 3 months ago, a huge amount of time for a program that depends on external changing sites. yt-dlp get commits everyday and is a drop in replacement in most cases.

On Linux you can basically symlink /usr/bin/youtube-dl to /usr/bin/yt-dlp and everything just works.

From Python code you can do: import yt_dlp as youtube_dl and be done with it.

TLDR: It's dead Jim. Move to yt_dlp.

@pukkandan
Copy link
Contributor

So the Android client hack still works despite the apparently stronger throttling and should be back-ported?
I suggest that implementing either the challenge-response algorithm in the linked thread or (for the moment?) using the Android client bypass from yt-dlp should resolve this issue.

Ideally, we ofc want a way to solve the js challenge. For this, we either (1) hardcode the js challenge (this is a maintainability nightmare), (2) write a more complete js interpretter (there is already a PR here, but its quite old and no longer up to spec) or (3) use some external dependancy.

But that said, the android workaround is not expected to break in the near future because google wont be able to implement the challenge in their android app without making the all prior versions of the app unusable. So any implementation of the challenge on android is expected to be a slow rollout and we can therefore expect to get a reasonable amount of notice before this starts becoming a problem

@dirkf
Copy link
Contributor

dirkf commented Oct 15, 2021

... here ...
That is, #11272 ?

Would be very useful to get that working given the limitations of the existing jsinterp.py on the one hand and, in a different way, of PhantomJS on the other.

@fireattack
Copy link

Just curious, how exactly did yt-dlp solve this issue?

@pukkandan
Copy link
Contributor

Just curious, how exactly did yt-dlp solve this issue?

A quick summary: https://code.videolan.org/videolan/vlc/-/issues/26174#note_286445

@linkfanel
Copy link

Hello, I'm the VLC maintainer of the YouTube playback feature in the VLC media player. There's been talk about javascript interpreters, and I wanted to share how you don't need to run the descrambling code through a javascript interpreter to make it work.

In VLC, extractors are website parser scripts written in Lua. We emulate the javascript descrambling code within the Lua script using ad hoc code, on the basis that it uses only a known set of structured transformations. This approach is less reliable and requires more maintenance than a generic interpreter as slight changes in the code or javascript minifier make it break every now and then; but it's worked for us for the past 8 years for signature descrambling, and we just released a version that descrambles the "n" parameter too that's required to solve this throttling. So this is a proven concept, and another possibility.

If you want to take a look, see the n_descramble() and sig_descramble() functions in:

https://code.videolan.org/videolan/vlc/-/blob/master/share/lua/playlist/youtube.lua

Of course, as long as playback in VLC works, it's always another fallback alternative to youtube-dl to use VLC as the URL extractor, and then copy-paste the working direct video file URL from VLC to pass it to curl or wget :)

@dirkf
Copy link
Contributor

dirkf commented Oct 31, 2021

@linkfanel, I've made a WIP Python n_descramble() function based on your VLC LUA code. I hope that's in the spirit of your comment above. Incidentally, it turns out that Python is somewhat more concise in this case, partly because of additional built-ins and full regex support.

Sadly I must be missing something as the descramble is getting scrambled (eg, trying to rotate "n" by a non-integer value). This is a failing transformation log for n = 6rsYMjlcSvMuBfBR with player 9216d1f7:

"n" parameter transformation: swap(data, 1913911047 -> 9) 45(17, 38)
from: -470482026 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -1886316521 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data 778601498 2145333248 1245726977 1952270083 268207944 244274044 data swap data -762271981 604636391 1087224318 -931565987 -338396815 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047 -1951114300 -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1
to:   -1886316521 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data 778601498 2145333248 1245726977 1952270083 268207944 244274044 data swap data -762271981 604636391 1087224318 -931565987 -338396815 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047 -1951114300 -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1
"n" parameter transformation: rotate(n, 1087224318 -> 14) 12(44, 29)
from: 6rsYMjlcSvMuBfBR
to:   sYMjlcSvMuBfBR6r
"n" parameter transformation: swap(data, -1886316521 -> 31) 45(26, 0)
from: ...
to:   -338396815 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data 778601498 2145333248 1245726977 1952270083 268207944 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047 -1951114300 -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1
"n" parameter transformation: remove(n, -1815897225 -> 7) 51(41, 13)
from: sYMjlcSvMuBfBR6r
to:   sYMjlcSMuBfBR6r
"n" parameter transformation: rotate(n, -762271981 -> 14) 12(41, 27)
from: sYMjlcSMuBfBR6r
to:   YMjlcSMuBfBR6rs
"n" parameter transformation: rotate(data, 1635047330 -> 14) 12(26, 11)
from: ...
to:   -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1 -338396815 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data 778601498 2145333248 1245726977 1952270083 268207944 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047 -1951114300
"n" parameter transformation: swap(n, -1874551858 -> 2) 39(17, 49)
from: YMjlcSMuBfBR6rs
to:   jMYlcSMuBfBR6rs
"n" parameter transformation: append(data, 2126741474 -> 20) 9(38, 47)
from: ...
to:   -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1 -338396815 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data 778601498 2145333248 1245726977 1952270083 268207944 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047 -1951114300 2126741474
"n" parameter transformation: rotate(data, -504396507 -> 23) 26(40, 0)
from: ...
to:   778601498 2145333248 1245726977 1952270083 268207944 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047 -1951114300 2126741474 -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1 -338396815 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data
"n" parameter transformation: swap(data, -68090711 -> 4) 7(8, 44)
from: ...
to:   268207944 2145333248 1245726977 1952270083 778601498 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047 -1951114300 2126741474 -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1 -338396815 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data
"n" parameter transformation: rotate(data, 268207944 -> 4) 14(54, 0)
from: ...
to:   1940621629 -714586149 -1723898467 data 268207944 2145333248 1245726977 1952270083 778601498 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047 -1951114300 2126741474 -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1 -338396815 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225
"n" parameter transformation: rotate(data, -1951114300 -> 30) 18(3, 25)
from: ...
to:   -1951114300 2126741474 -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1 -338396815 -691770757 rotate n 258876269 -1426380890 318754300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data 268207944 2145333248 1245726977 1952270083 778601498 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047
"n" parameter transformation: swap(data, 1245726977 -> 22) 7(33, 36)
from: ...
to:   318754300 2126741474 -504396507 n 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1 -338396815 -691770757 rotate n 258876269 -1426380890 -1951114300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data 268207944 2145333248 1245726977 1952270083 778601498 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047
"n" parameter transformation: compound1(n, "push") 15(19, 14)
from: jMYlcSMuBfBR6rs
to:   Wiw4iAgqjHlrPM7
"n" parameter transformation: swap(n, 1027812119 -> 14) 7(19, 9)
from: Wiw4iAgqjHlrPM7
to:   7iw4iAgqjHlrPMW
"n" parameter transformation: swap(n, -1902376100 -> 10) 7(6, 12)
from: 7iw4iAgqjHlrPMW
to:   liw4iAgqjH7rPMW
"n" parameter transformation: swap(data, 2145333248 -> 3) 41(33, 35)
from: ...
to:   n 2126741474 -504396507 318754300 344510945 905306344 n swap 909033134 1027812119 1686673079 append -1902376100 remove "push" compound1 -338396815 -691770757 rotate n 258876269 -1426380890 -1951114300 -68090711 -2064438462 -470482026 1913911047 1635047330 rotate -1815897225 1940621629 -714586149 -1723898467 data 268207944 2145333248 1245726977 1952270083 778601498 244274044 data swap data -762271981 604636391 1087224318 -931565987 -1886316521 rotate 2126741474 reverse -1874551858 -1238260579 498106911 1913911047
"n" parameter transformation: swap(data, 905306344 -> 19) 7(40, 5)
"n" parameter transformation: reverse(data) 50(42)
from: ...
to:   1913911047 498106911 -1238260579 -1874551858 reverse 2126741474 rotate -1886316521 -931565987 1087224318 604636391 -762271981 data swap data 244274044 778601498 1952270083 1245726977 2145333248 268207944 data -1723898467 -714586149 1940621629 -1815897225 rotate 1635047330 1913911047 -470482026 -2064438462 -68090711 -1951114300 -1426380890 258876269 n rotate -691770757 -338396815 compound1 "push" remove -1902376100 append 1686673079 1027812119 909033134 swap n 905306344 344510945 318754300 -504396507 2126741474 n
"n" parameter transformation: swap(data, 1952270083 -> 38) 13(14, 17)
from: ...
to:   -338396815 498106911 -1238260579 -1874551858 reverse 2126741474 rotate -1886316521 -931565987 1087224318 604636391 -762271981 data swap data 244274044 778601498 1952270083 1245726977 2145333248 268207944 data -1723898467 -714586149 1940621629 -1815897225 rotate 1635047330 1913911047 -470482026 -2064438462 -68090711 -1951114300 -1426380890 258876269 n rotate -691770757 1913911047 compound1 "push" remove -1902376100 append 1686673079 1027812119 909033134 swap n 905306344 344510945 318754300 -504396507 2126741474 n
"n" parameter transformation: rotate(n, 318754300 -> 10) 6(35, 51)
from: liw4iAgqjH7rPMW
to:   AgqjH7rPMWliw4i
"n" parameter transformation: rotate(n, 344510945 -> 5) 26(48, 50)
from: AgqjH7rPMWliw4i
to:   liw4iAgqjH7rPMW
"n" parameter transformation: rotate(n, -338396815 -> 5) 26(35, 0)
from: liw4iAgqjH7rPMW
to:   7rPMWliw4iAgqjH
"n" parameter transformation: rotate(data, 909033134 -> 9) 6(21, 46)
from: ...
to:   909033134 swap n 905306344 344510945 318754300 -504396507 2126741474 n -338396815 498106911 -1238260579 -1874551858 reverse 2126741474 rotate -1886316521 -931565987 1087224318 604636391 -762271981 data swap data 244274044 778601498 1952270083 1245726977 2145333248 268207944 data -1723898467 -714586149 1940621629 -1815897225 rotate 1635047330 1913911047 -470482026 -2064438462 -68090711 -1951114300 -1426380890 258876269 n rotate -691770757 1913911047 compound1 "push" remove -1902376100 append 1686673079 1027812119
"n" parameter transformation: rotate(data, -1426380890 -> 0) 15(21, 42)
"n" parameter transformation: swap(n, 258876269 -> 14) 1(2, 43)
from: 7rPMWliw4iAgqjH
to:   HrPMWliw4iAgqj7
"n" parameter transformation: rotate(n) 15(2)
WARNING: [youtube] Invalid data type encountered during YouTube video throttling parameter descrambling transformation chain, aborting. Couldn't descramble YouTube throttling URL parameter: data transfer will be throttled

Do you perhaps have a log that you could share so that I could do an A-B comparison?

@pukkandan
Copy link
Contributor

@dirkf pytube also has an implementation of the descrambling algorithm. Since it is in python too, it may be a better reference

@linkfanel
Copy link

Incidentally, it turns out that Python is somewhat more concise in this case, partly because of additional built-ins and full regex support.

I bet. In Lua no table length built-in function, no table reverse built-in function, table indices starting at 1... Here's what I get:

"n" parameter transformation: swap(data, 1913911047 -> 9) 45(17, 38)
"n" parameter transformation: rotate(n, 1087224318 -> 14) 12(44, 29)
"n" parameter transformation: SXiXBH-xzrjeioPN -> iXBH-xzrjeioPNSX
"n" parameter transformation: swap(data, -1886316521 -> 31) 45(26, 0)
"n" parameter transformation: remove(n, -1815897225 -> 7) 51(41, 13)
"n" parameter transformation: iXBH-xzrjeioPNSX -> iXBH-xzjeioPNSX
"n" parameter transformation: rotate(n, -762271981 -> 14) 12(41, 27)
"n" parameter transformation: iXBH-xzjeioPNSX -> XBH-xzjeioPNSXi
"n" parameter transformation: rotate(data, 1635047330 -> 14) 12(26, 11)
"n" parameter transformation: swap(n, -1874551858 -> 2) 39(17, 49)
"n" parameter transformation: XBH-xzjeioPNSXi -> HBX-xzjeioPNSXi
"n" parameter transformation: append(data, 2126741474 -> 20) 9(38, 47)
"n" parameter transformation: rotate(data, -504396507 -> 23) 26(40, 0)
"n" parameter transformation: swap(data, -68090711 -> 4) 7(8, 44)
"n" parameter transformation: rotate(data, 268207944 -> 4) 14(54, 0)
"n" parameter transformation: rotate(data, -1951114300 -> 30) 18(3, 25)
"n" parameter transformation: swap(data, 1245726977 -> 22) 7(33, 36)
"n" parameter transformation: compound1(n, "push") 15(19, 14)
"n" parameter transformation: HBX-xzjeioPNSXi -> i7vJfsQx3Y_gP_j
"n" parameter transformation: swap(n, 1027812119 -> 14) 7(19, 9)
"n" parameter transformation: i7vJfsQx3Y_gP_j -> j7vJfsQx3Y_gP_i
"n" parameter transformation: swap(n, -1902376100 -> 10) 7(6, 12)
"n" parameter transformation: j7vJfsQx3Y_gP_i -> _7vJfsQx3YjgP_i
"n" parameter transformation: swap(data, 2145333248 -> 3) 41(33, 35)
"n" parameter transformation: swap(data, 905306344 -> 19) 7(40, 5)
"n" parameter transformation: reverse(data) 50(42)
"n" parameter transformation: swap(data, 1952270083 -> 38) 13(14, 17)
"n" parameter transformation: rotate(n, 318754300 -> 10) 6(35, 51)
"n" parameter transformation: _7vJfsQx3YjgP_i -> sQx3YjgP_i_7vJf
"n" parameter transformation: rotate(n, 344510945 -> 5) 26(48, 50)
"n" parameter transformation: sQx3YjgP_i_7vJf -> _7vJfsQx3YjgP_i
"n" parameter transformation: rotate(n, -338396815 -> 5) 26(35, 0)
"n" parameter transformation: _7vJfsQx3YjgP_i -> jgP_i_7vJfsQx3Y
"n" parameter transformation: rotate(data, 909033134 -> 9) 6(21, 46)
"n" parameter transformation: rotate(data, -1426380890 -> 0) 15(21, 42)
"n" parameter transformation: swap(n, 258876269 -> 14) 1(2, 43)
"n" parameter transformation: jgP_i_7vJfsQx3Y -> YgP_i_7vJfsQx3j
"n" parameter transformation: rotate(n, -1723898467 -> 8) 15(2, 31)
"n" parameter transformation: YgP_i_7vJfsQx3j -> vJfsQx3jYgP_i_7
"n" parameter transformation: swap(data, 778601498 -> 48) 1(21, 25)
"n" parameter transformation: swap(data, -931565987 -> 33) 22(30, 17)
"n" parameter transformation: rotate(n, -691770757 -> 8) 15(44, 46)
"n" parameter transformation: vJfsQx3jYgP_i_7 -> jYgP_i_7vJfsQx3
"n" parameter transformation: swap(n, -1238260579 -> 11) 22(44, 11)
"n" parameter transformation: jYgP_i_7vJfsQx3 -> sYgP_i_7vJfjQx3
"n" parameter transformation: swap(data, -470482026 -> 19) 22(23, 38)
"n" parameter transformation: swap(data, 2126741474 -> 44) 1(23, 14)
"n" parameter transformation: rotate(data, 604636391 -> 51) 35(23, 44)
"n" parameter transformation: rotate(n, 244274044 -> 4) 11(53, 20)
"n" parameter transformation: sYgP_i_7vJfjQx3 -> jQx3sYgP_i_7vJf
"n" parameter transformation: reverse(n) 9(51)
"n" parameter transformation: jQx3sYgP_i_7vJf -> fJv7_i_PgYs3xQj
"n" parameter transformation: rotate(n, -714586149 -> 6) 31(51, 28)
"n" parameter transformation: fJv7_i_PgYs3xQj -> Ys3xQjfJv7_i_Pg
"n" parameter transformation: swap(n, -2064438462 -> 3) 18(51, 35)
"n" parameter transformation: Ys3xQjfJv7_i_Pg -> xs3YQjfJv7_i_Pg
"n" parameter transformation: remove(n, 498106911 -> 6) 46(53, 6)
"n" parameter transformation: xs3YQjfJv7_i_Pg -> xs3YQjJv7_i_Pg
"n" parameter transformation: swap(n, 1686673079 -> 7) 52(51, 49)
"n" parameter transformation: xs3YQjJv7_i_Pg -> vs3YQjJx7_i_Pg
"n" parameter transformation: rotate(n, 1940621629 -> 9) 11(53, 15)
"n" parameter transformation: vs3YQjJx7_i_Pg -> jJx7_i_Pgvs3YQ

Does your rotate transformation handle 0 correctly? Your data array seems fine up to that point.

@dirkf
Copy link
Contributor

dirkf commented Nov 1, 2021

Excellent, thanks. As elsewhere, there can be \n after the comma in c[_](c[_],c[_]), which doesn't affect the Lua code because js_extract() is line-oriented. Now we have success (using the example from the thread above):

# python -m youtube_dl -f best wCSdScabxow
[youtube] wCSdScabxow: Downloading webpage
[youtube] wCSdScabxow: Downloading player 7a8e03e1
[download] Destination: TGD Graf Duckula - (Folge 2) Vampir Ahoi-wCSdScabxow.mp4
[download] 100% of 138.42MiB in 04:52
#

So ~500kB/s on this tiny platform on my LAN where unconstrained downloads rarely beat 1.5MB/s.

@pukkandan said:

Ideally, we ofc want a way to solve the js challenge. For this, we either (1) hardcode the js challenge (this is a maintainability nightmare), (2) write a more complete js interpreter (there is already a PR here, but it's quite old and no longer up to spec) or (3) use some external dependancy.

Although this is close to (1) as a solution, based on VLC's experience with the signature algorithm it may not be quite such a nightmare and the approach from the n_descramble() function (and differently, the pytube code) is robust against a certain level of changes to the challenge code.

To close off the discussion here, this extractor/youtube.py is a drop-in fix for the 2021.06.06 release.

@pranshuthegamer
Copy link

so should we wait for new release?

@dirkf
Copy link
Contributor

dirkf commented Jan 31, 2022

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

Successfully merging a pull request may close this issue.