
Hello. A user from another thread showed interest in this so I figured I will share it.
YT-DLP is an amazing tool and it is very much worth learning it. I have been using it pretty much as soon as it released for several purposes:
- YouTube channels/playlists archival (not limited to Youtube)
- Videos archival from various Websites
- Music archival
I also archive all the associated metadata with all of those medias I can archive. However, it can be quite bearen to use it as-is: you want the best quality available, you want to avoid downloading something twice and, moreover, you probably want an easy way to automate it.
Therefore, I created a while back a wrapper for YT-DLP: I called it yt-archive: https://gitlab.com/astsu777/dotfiles/-/blob/master/local/bin/yt-archive
It is a BASH script that I initially wrote to archive content from YouTube but I also use it for content from other platforms. It can very easily allow you to archive a direct link or a batch of links from a text file. It can also just download metadata from downloaded medias. This wrapper will:
- Detect the best quality available for a video and embed it into a MKV container (if possible, otherwise it is usually MP4)
- It will embed metadata such as subtitles, thumbnail, various metadata like description, author, uploaded date, etc... It will also write all the metadata into a JSON file
- It will create a text file with the videos that it has processed already to avoid duplicates
- Can skip videos shorter than 1 minute (useful to skip shorts)
I also have the same version of the script but it leverages a VPN: https://gitlab.com/astsu777/dotfiles/-/blob/master/local/bin/yt-archive-vpn
This version requires Docker and will do the following:
- Load a Wireguard VPN configuration file randomly from a directory (NordVPN, Mullvad, etc... they all provide them) and establish a VPN connection (it also checks if Internet access via the VPN is working)
- It will download three videos (customizable with the variable BATCH_SIZE) from a text file (it can be a single link to a YouTube channels)
- Once the batch is completed, it will drop the VPN and establish another VPN connection from a random Wireguard VPN config file
- Batch is downloaded, etc...
Both of those scripts can probably be enhanced but they fit my requirements well and they work. I run this on a daily basis via a scheduled task and I archive dozens of YouTube channels/playlists with it. Then, everything is loaded into Jellyfin.
EDIT: I am fully aware that front-ends like MeTube/TubeArchivist exists and they work well. However, I find them too limiting for my use-case. I also wrote those scripts before any of those frontends became popular (I maintained them since) and never felt the need to have a WebUI to make this more simple.