Sometimes, YouTube tutorials are helpful for topics you are just beginning to learn about. Personally, I prefer text based documentation as it is easier to maintain for offline reference. However, the abundance of video content is hard to overlook. Consider your reliance on an internet connection to watch/re-watch a video. Also, consider your bandwidth usage, especially if you are on a metered data plan. If you found yourself without internet (or sufficient data for watching multiple videos), and therefore without access to some particular video, would you be able to remember the steps or commands from the tutorial? Let’s discuss a tool to help you save those helpful videos for offline use.
Introduction
yt-dlp is a free and open-source tool for downloading video/audio from numerous websites. By learning to use this tool, you’ll be able to keep local copies of your favorite video content. What a great way to prepare for those unexpected (or expected) times when the internet isn’t available!
Installation
If you are using Ubuntu 22.04 or Linux Mint 21, you can install yt-dlp from the system repositories using the command :
sudo apt install yt-dlp
Note : The version from the Ubuntu/Mint repositories may be significantly out of date from the official release. At the, time of this writing, the repository version is 2022.08.04, while the official version is 2023.01.06. The repository version has been working fine for me, however.
To install the official latest version of yt-dlp, here are the instructions for installing on Linux, directly from the developers :
sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp # Make executable
Keeping yt-dlp up to date is as easy as running :
yt-dlp --update
Usage
For the most basic task, downloading a single video, all you need to do is pass the video URL to yt-dlp (where XXXYYYZZZ is the video ID):
yt-dlp https://www.youtube.com/watch?v=XXXYYYZZZ
You can also download an entire playlist of videos, by passing the playlist URL to yt-dlp (where XXXYYYZZZ is the playlist ID) :
yt-dlp https://www.youtube.com/playlist?list=XXXYYYZZZ
If you have a list of video URLs from many sources, you can save that list to a file (each URL on it’s own line), and tell yt-dlp to download all the videos contained in it :
yt-dlp --batch-file /path/to/the/file
Next Steps
There are MANY more options and interesting things you can do with this tool. For more advanced usage, consult the manual for yt-dlp on your system :
man yt-dlp
You can also find much more information at the developers’ GitHub site in the README.
When you come up with some cool ways to use yt-dlp, I’d love to hear about it! Good luck, and may your videos never buffer!
73 de KG4VDK
If you found this post helpful, and would like to join me in more of these sort of technology adventures, let me know with a comment. If you’re feeling really generous, consider buying me a coffee or beer. 🙂