Archiving YouTube Channels2025-06-21
Over the past few years YouTube has been adding more and more restrictions in place to watching videos ranging from fake buffering to adding DRM to completely blocking playback. I've used Tor Browser for years to watch my favorite content creators, but that has been impacted by these changes which made even short videos a tedious chore. So I started instead just bulk archiving my favorite channels, both as a way to watch them normally and as a way to preserve their content in the event YouTube decides to more aggressively enforce their restrictions (eg. mandatory account requirement). If you're reading this you've probably heard of yt-dlp (or its predecessor youtube-dl), however the defaults will miss quite a bit of necessary extras, so below I document strongly recommended options as well as some tips. I will get straight to the point with the whole command.
yt-dlp --format 'bestvideo+bestaudio/best' --merge-output-format=mkv --embed-chapters --embed-metadata --embed-thumbnail --convert-thumbnails jpg --write-subs --write-auto-subs --sub-langs=en --write-description --mtime --download-archive 0COMPLETED --batch-file 0SOURCESOK so how to use this command?
First have your top level directory which you will do the processing in. Save that command in a file eg. archive.sh, then create a folder for each given channel you want to save. In each channel folder you will want to create the 0SOURCES file containing the link to their channel (eg. https://www.youtube.com/@CHANNEL_HERE). Then simply invoke the script: sh ../archive.sh.
What do the options do?
--format 'bestvideo+bestaudio/best': Prefer the best quality video and best quality audio by merging two distinct streams, or falling back to best singular stream if unavailable.--merge-output-format=mkv: Put everything into an MKV container.--embed-chapters: Adds chapter markers to the MKV.--embed-metadata: Adds the video description, release date, and ID to the MKV.--embed-thumbnail: Adds the thumbnail to the MKV.--convert-thumbnails jpg: Convert the thumbnail from Google's default WebP to JPG, which is better supported by media players.--write-subs --write-auto-subs: Write subtitles, prefer real ones with fallback to automatically generated ones.--sub-langs=en: Specify the language you want for subtitles. List of codes here.--write-description: Write the video description to a.descriptionfile.--mtime: Adjust the output file timestamp to match to the server's recorded time of the content.--download-archive 0COMPLETED: This keeps a list of every video that has been downloaded to prevent rechecking/redownloading them each run.--batch-file 0SOURCES: This specifies what links to download.
Any tips?
- Always update yt-dlp first! Some distros fall behind, so best to just use their GitHub release and run
yt-dlp --updatebefore continuing. - With the external
.descriptionand.vtt(subtitles) files, you cangrepthrough them as a rough method of full text search of a channel! - Setup a Jellyfin instance and add your top-level archive directory as a 'Home Videos and Photos' collection, and it will put each channel into its own sub-folder. This lets you correctly sort them by release date and track your watch progress/history.
- If you're downloading over Tor using
torsocksyou must use the standardyt-dlpbinary, as theiryt-dlp_linuxbinary is statically linked which is incompatible and will bypasstorsocks. - Sometimes you can download videos but not their subtitles depending on your IP, so watch out for that.
- Sometimes if a video was recently added, the highest quality format is unavailable, even if it shows up on the website.
- You can sometimes find unlisted videos by downloading their playlists, duplicate the channel link in
0SOURCESand append/playlists. Be sure to comment it after, as playlist processing can easily get you rate-limited. - If yt-dlp outputs that a video is age-restricted or private you can see if archive.org has a copy, add
https://web.archive.org/web/https://www.youtube.com/watch?v=VIDEO_ID_HEREto your0SOURCESfile. Be sure to comment it after. - If you have a slow Internet connection you might want to rate limit the process so as to not make your Internet unusable, add the
--limit-rate 4Moption, changing it to however fast/slow you want it.
Comment on this: Fediverse