Live data from Hacker News

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

twitter.com

1–10 of 166 posts

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

#6
post #2

What purpose does it serve?

They need to run a JavaScript function to download YouTube videos at normal speeds.

Edit: it's also required to download music, otherwise it will just fail

Source:

- https://github.com/ytdl-org/youtube-dl/issues/29326#issuecom...

- https://github.com/ytdl-org/youtube-dl/blob/d619dd712f63aab1...

- https://github.com/ytdl-org/youtube-dl/commit/cf001636600430...

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

#7
post #2

What purpose does it serve?

I'd have to read up on the specifics as well, but I think basically Youtube uses a lot of obfuscated, rapidly and automatically changing Javascript code to fetch the video data. A project like youtube-dl has to run this code to be able to download videos, because that's what's happening in the browser as well.

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

#8
post #2

What purpose does it serve?

It's used in the YouTube extractor: https://github.com/ytdl-org/youtube-dl/blob/d619dd712f63aab1...

I believe YouTube limits your bitrate if you don't pass a specific calculated value; it's possible youtube-dl has to parse and eval JS to get it.

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

#9
post #2

What purpose does it serve?

It's used in the YouTube extractor: https://github.com/ytdl-org/youtube-dl/blob/d619dd712f63aab1... I believe YouTube limits your bitrate if you don't pass a specific calculated value; it's possible youtube-dl has to parse and eval JS to get it.

> 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.

Post reply on HN