News for hackers. Stuff that matters.
Re:YouTube-dl has an interpreter for a subset of JavaScript ... by elaus on Saturday September 10, 2022 @02:36PM (#32793309)
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 ... by temp_account_32 on Saturday September 10, 2022 @02:48PM (#32793439)
For those interested further, in some of the past few weeks youtube-dl had stopped working intermittently for multiple hours at a time, and it was precisely related to this code.

We have a custom-made Discord music bot on our server which uses ytdl to stream songs so we can listen together, and at one point we were listening and suddenly got some obscure JavaScript error.

We began joking that there's some bug in the code which breaks it after 6PM, but later found out that Google had changed some of the obfuscated JS and this basically broke this part of code, which prevented us from fetching the song information.

Re:YouTube-dl has an interpreter for a subset of JavaScript ... by londons_explore on Saturday September 10, 2022 @04:58PM (#32794534)
If you start a youtube video and then pause it and resume a few days later, you'll notice that the youtube page plays for ~30 seconds (ie. whats buffered) and then the page refreshes. I'd guess this refresh is to pick up the new javascript and any updates to the HTML code.

It's kinda annoying if you have a lot of youtube tabs open for a long time and come back to them.

Re:YouTube-dl has an interpreter for a subset of JavaScript ... by bitexploder on Saturday September 10, 2022 @03:15PM (#32793732)
What is interesting is it seems to be constant cat and mouse. I download a YT vid. It crawls. Update yt-dlp, it flies again. I love yt-dlp and use it a lot.
Re:YouTube-dl has an interpreter for a subset of JavaScript ... by lupire on Saturday September 10, 2022 @04:21PM (#32794295)
But why not just use a normal JS engine called from Python?