News for hackers. Stuff that matters.
Re:Show HN: Khan-dl – Khan Academy Course Downloader by TeeMassive on Sunday February 14, 2021 @03:58PM (#26136201)
Not OP, but I had a YouTube playlist that really was a collection of memories since I began university 10 years ago. Lots of things that are related to precious memories I had there: memes, inside jokes (so many Skyrim references), etc.

It had over a thousand videos from what I remember in 2015. Now there's barely ~600 left. Lots of them got deleted due to copyright, the Vox Adpocallispe (thx Carlos Maza) and cancel culture.

I just downloaded all the remaining video using youtube-dl but I should have done that before, now it feels I lost something important in those memories that I will never get back.

Here's the command I used, took me a while and might save other people a few hours:

pip install --upgrade pip

pip install youtube-dl

youtube-dl.exe -i -f bestvideo+bestaudio --merge-output-format mp4 "https://www.youtube.com/playlist?list=XXXXXXXXXXXXXXXXXXXXXX..."

Obviously if you're not on Windows remove the .exe

This will download an entire playlist at the highest video and audio quality and will not crash if a video has an error.

Re:Show HN: Khan-dl – Khan Academy Course Downloader by fao_ on Sunday February 14, 2021 @09:30PM (#26138411)
It will show "deleted video". If you copy the link of that and search the unique portion, you will often find google or other sites referencing the name of it, which you can use to find a reuploaded version
Re:Show HN: Khan-dl – Khan Academy Course Downloader by userbinator on Sunday February 14, 2021 @05:16PM (#26136785)
Note: even on Windows you don't need to specify .exe, unless there also happens to be a .com or .bat with the same name in the PATH.
Re:Show HN: Khan-dl – Khan Academy Course Downloader by rhizome on Sunday February 14, 2021 @06:17PM (#26137238)
It's a good idea to add -w/--no-overwrite (or --output TEMPLATE with autonumber) to that command line so you don't clobber your existing files, for safety.

EDIT: YT does not send a 0byte file for deleteds, only a "video unavailable" error.

Re:Show HN: Khan-dl – Khan Academy Course Downloader by voltagex_ on Sunday February 14, 2021 @08:42PM (#26138123)
bestaudio and bestvideo get it very wrong - have a look at the output of -F and you'll see it selecting the 720P version (?)
Re:Show HN: Khan-dl – Khan Academy Course Downloader by crtasm on Monday February 15, 2021 @05:55PM (#26148716)
"best: Select the best quality format represented by a single file with video and audio."

Not the same as bestvideo+bestaudio which will merge separate sources.

Re:Show HN: Khan-dl – Khan Academy Course Downloader by WolfRazu on Sunday February 14, 2021 @07:40PM (#26137724)
best video+bestaudio are the default format, so that argument can be omitted in the future if you want.