Live data from Hacker News

YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

twitter.com

31–40 of 166 posts

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#31

Earlier quoted context omitted.

> I believe YouTube limits your bitrate if you don't pass a specific calculated value It's starting to become Widevine bullshit all over again.

It's their platform. They can do with it what they want.

Many channels would be more than happy to enable download options, if possible.

Hell, how is Creative Commons licence they totally give you option to select, work in case of videos that can't be downloaded in any way?

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#32
post #11

How should a programming noob interpret this? Be impressed at what was achieved here? Be concerned about security implications using the tool? Something else entirely?

It's an extremely tiny subset of JS—as an example, the only object that can be instantiated is Date. Anything other than "Date" after "new" throws an exception. It's definitely neat, but not especially useful outside of the confines of its current application, and the security concerns of such a tiny subset will be minimal.

> Anything other than "Date" after "new" throws an exception

It's even very sensitive to white space.

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#33

Earlier quoted context omitted.

> I believe YouTube limits your bitrate if you don't pass a specific calculated value It's starting to become Widevine bullshit all over again.

It's their platform. They can do with it what they want.

Just because they have the right to do it doesn't make it right.

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#34
post #19

Nowadays "javascript" refers to the scriptable, grotesquely and absurdely complex and massive web engines, aka google financed blink and geeko, then apple financed webkit, that with their SDK. The currently obfuscated javascript media players will try to break yt-dlp by leveraging the complexity and size of those scripted web engines. They will make them out of reach to small teamns or individuals and it is even "bet…

Chrome and Safari both have open source JS engines…

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#36

Earlier quoted context omitted.

> I believe YouTube limits your bitrate if you don't pass a specific calculated value It's starting to become Widevine bullshit all over again.

It's their platform. They can do with it what they want.

No post body was provided.

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#37
post #17
post #5

Earlier quoted context omitted.

You need to run some obscured JS to get decent download speeds from Youtube. Something along the lines of PoW.

It’s not like proof of work at all. It’s just a challenge and response; youtube includes a random number in the webpage for each video, and expects to see a request parameter with a particular value calculated from that random number when you request the video. If you don’t do the arithmetic it throttles you to 50kb/s. Since the calculation of the response is done in JS, and they occasionally change the formula, some…

Next step will probably be moving the calculation to webassembly or requiring the script to fetch the result via websocket or webrtc...

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#38
post #11

How should a programming noob interpret this? Be impressed at what was achieved here? Be concerned about security implications using the tool? Something else entirely?

> How should a programming noob interpret this?

The browser is client-facing and everything there is possible to reverse engineer and figure out. So if you design a web-based application, and are depending on client-side Javascript for any security or distribution enforcement, it can be helpful, but can ultimately be unwound and cracked even if obfuscated, etc.

> Be impressed at what was achieved here?

Yes. Try to download a YouTube video with out it or an online service which is probably using it internally.

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#39
post #17
post #5

Earlier quoted context omitted.

You need to run some obscured JS to get decent download speeds from Youtube. Something along the lines of PoW.

It’s not like proof of work at all. It’s just a challenge and response; youtube includes a random number in the webpage for each video, and expects to see a request parameter with a particular value calculated from that random number when you request the video. If you don’t do the arithmetic it throttles you to 50kb/s. Since the calculation of the response is done in JS, and they occasionally change the formula, some…

.. pirate determination is a thing to behold, as is crazed-repetitive digital grabs.. Its not a fair or accurate characterization to dismiss it as "making people's lives harder" .. it is remarkable that the Debian distros now include ytdl; lets do what is reasonable to make it continue

Re: YouTube-dl has an interpreter for a subset of JavaScript in 870 lines of Python

#40
post #19

Nowadays "javascript" refers to the scriptable, grotesquely and absurdely complex and massive web engines, aka google financed blink and geeko, then apple financed webkit, that with their SDK. The currently obfuscated javascript media players will try to break yt-dlp by leveraging the complexity and size of those scripted web engines. They will make them out of reach to small teamns or individuals and it is even "bet…

> That's why noscript/basic (x)html is so much important.

xhtml has been dead for a decade

Post reply on HN