Alex Balgavy

Just some stuff about me.

Here's my dotfiles repository.

Check out my blog.

My keys: PGP, SSH

My crypto wallets (BTC, XMR)


What links here:

Archiving a youtube channel

From a reddit post that got deleted.

So I know there are already a lot of youtube-dl scripts and examples out there, but everyone aims to achieve slightly different goals. I’ve spent a lot of time thinking about how I want to achieve my youtube archiving goals, and spurred on by the recent strikes against CodysLab and now styropyro, I decided it was time to finalize my config and start downloading. I figured it might be helpful to someone else to share my config here since the youtube-dl manpage is very lengthy and each option only has a short description on what it does, not really describing how various options interact in a lot of cases.

For my purposes, I am downloading various channels that are not really episodic, so I don’t attempt to name them as such. My goal is to preserve quality and information in as uniform a format as possible so that it will be easy to batch transform and work with in the future.

Goals

Also, a note on subtitles: I originally wanted to have all subtitles embedded, but due to a longstanding issue with youtube-dl, if the format didn’t end up as mkv (or another container that supports embedded subtitles) as a result of merging best video / best audio (or for some other reason), then subtitles will fail to embed and you will be left with no subtitles. This isn’t a risk I want to take with my archive.

And a second note on annotations: there is an additional flag to save annotations in an xml file, but since there are very few videos that completely rely on annotations, and me having low confidence in the file being very useful in the future, I decided to skip saving annotations. Saving them is as easy as adding –write-annotations to the config.

youtube-dl.conf


-i
-o "%(uploader)s (%(uploader_id)s)/%(upload_date)s - %(title)s - (%(duration)ss) [%(resolution)s] [%(id)s].%(ext)s"

# Archive Settings
--download-archive youtube-dl-archive.txt
-a youtube-dl-channels.txt

# Uniform Format
--prefer-ffmpeg
--merge-output-format mkv

# Get All Subs to SRT
--write-sub
--all-subs
--convert-subs srt

# Get metadata
--add-metadata
--write-description
--write-thumbnail

# Debug
-v

youtube-dl-channels.txt

# CodysLab
https://www.youtube.com/channel/UCu6mSoMNzHQiBIOCkHUa2Aw

# Styropyro
https://www.youtube.com/channel/UCJYJgj7rzsn0vdR7fkgjuIA

# Wendover Productions
https://www.youtube.com/channel/UC9RM-iSvTu1uPJb8X5yp3EQ

# Half as Interesting
https://www.youtube.com/channel/UCuCkxoKLYO_EQ2GeFtbM_bw

# LockPickingLawyer
https://www.youtube.com/channel/UCm9K6rby98W8JigLoZOh6FQ

youtube-dl-archive.txt

(leave this file empty - youtube-dl will add IDs of completed downloads here and skip them when you re-run the command, only downloading new videos in subsequent runs) Simply run youtube-dl –config-location youtube-dl.conf

I hope this is useful to someone else!