Unsurprisingly, we here at Big Bad Tech have a low opinion of Google.
Maybe you do too, but you like watching videos and feel like giving up YouTube hurts you more than it hurts Google. Or maybe you just want to make sure you never lose access to your favorite videos when the content police decide they don’t like what they see.
Either way, I hope this tutorial gives you what you want.
In my quest to get away from giant tech companies, one of the first things I looked for was a way to download YouTube videos of creators who were unlikely to survive too many purges on the site. I had used a few websites to download audio from the videos and some even let me download full video files, but the process was tedious and couldn’t be automated to deal with a large number of videos.
I eventually found ytdl (YouTube downloader), but the software has since gone obsolete. Thankfully for us, there’s a replacement based on it called yt-dlp.
What is yt-dlp?
yt-dlp is a command-line executable that downloads videos directly from YouTube, skipping advertising, metrics, tracking, and all the rest.
If you use yt-dlp, I suspect the creators of the videos you are downloading will not receive as much revenue, but neither will Google. If there’s a way to give direct financial support to the people creating the videos you want, I recommend doing that. The goal here isn’t to steal from people making videos but to exploit Google’s services for your benefit.
The software is easy to download and run. Head here and download the version you need for your operating system. The program is just a binary or executable file. I recommend creating a folder called ytdlp and putting the file in there, because you’ll be creating some other files as well.
There are three things that make yt-dlp powerful:
- You can specify exactly what you want
- You can automate it
- You can avoid duplicated downloads
Lets look at each of these in detail.
First, you can define exactly what you want yt-dlp to grab from YouTube. The tool supports configuration files, which means you can create different setups depending on what you want. If you need audio, create a configuration file defining the audio quality and file type. If you need high quality video, you can create a configuration file for that. If you need thumbnails, or you want files to be downloaded and organized based on the channel they’re from, you can specify that as well. See below for a sample configuration file that I think works well.
Second, you can automate the whole process. By creating a batch/bash file, you can simply add videos to playlists on YouTube and then, when you want to download them, double-click on a file. You can even set this up to run as a process, though I won’t go into the details of how to do that here. What this all means is that downloading videos is a trivial one-step process, limited mostly by your ISP’s bandwidth limits.
Third, you can set up an archive file that records the unique names of each video you’ve downloaded. yt-dlp will then skip those files in the future, meaning you can continue using the same playlists to keep track of the videos you want; the tool will handle any duplicates for you. Since the tool is smart enough to be able to restart a video that is partially downloaded, you don’t need to worry about a partial download breaking the archive. It just works.
I recommend something like this:
- An archive.txt file
- A yt-dlp.conf file
- A downloads folder
- Create a playlists.txt
- On Windows, a Run.bat file; on Linux, a Run.sh file
In your yt-dlp folder, wherever you choose, create a downloads folder. Then, create an archive.txt file. That’s it for those.
My base configuration file (yt-dlp.conf) looks like this (feel free to check out the site you downloaded yt-dlp from for other options):
# Save all videos to download folder -o "./download/%(playlist_title)s/%(playlist_index)s - %(title)s.%(ext)s" # download playlist --yes-playlist # Download new videos only --download-archive "./archive.txt" # Download best quality -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' --add-metadata --write-info-json --write-thumbnail
The Run.bat/Run.sh should just have this:
yt-dlp.exe --config-location .\yt-dlp.conf --batch-file playlists.txt
Last, but not least, you’ll want to list your playlists in the playlists.txt file. You can either grab public playlists on YouTube or create your own unlisted playlists. Private won’t work because the tool can’t see them (although it is possible to set up the tool to log into your account, I haven’t found a need to do that).
Your playlists.txt file should just have the full URL to a playlist on each line. You can use # signs to indicate lines that are comments to help organize it.
It’s pretty easy to get up and running with this. If you want to take it to the next level, stick around for a tutorial on setting up Plex so you can stream the videos yourself to your devices.