Hacker News new | ask | show | jobs
by tentacleuno 1619 days ago
> This serves as a valuable lesson, though: archive everything from YouTube channels you like!

Just threw together a script to do just this, if anyone wants it:

  download () {
    local directory="/archives/YouTube Archives/$1"
    mkdir -p "$directory"
    pushd "$directory"
    # youtube-dl --download-archive https://youtube.com/$2 -o "%(title).%(ext)"
    youtube-dl --playlist-reverse -o '%(playlist_index)s - %(title)s.%(ext)s' --write-annotations --download-archive .archive --add-metadata --write-info-json --write-thumbnail -f bestvideo[ext=vp9]+bestaudio[ext=opus]/bestvideo+bestaudio --merge-output-format mkv --all-subs --embed-subs -i --embed-thumbnail "https://youtube.com/$2"
    popd
  }

  download "Jim Can't Swim" c/JCSCriminalPsychology
  # etc. etc.
Throw this into a weekly cronjob and you should be golden!
1 comments

The only thing that function does is create a directory, and you could just as well have done an mkdir output && youtube-dl -o output/ I would also advise against using the mkv container, and use mp4 instead.
> "I would also advise against using the mkv container, and use mp4 instead."

Why? What exactly is wrong with Matroska? Almost every media player these days supports it just fine (as has been the case for a while now) and it's a great deal more featureful than the mp4 container. (Embedded subtitles, file attachment support for extended cover art and related files, DVD-type menu support, etc.)