The youtube-dl a tool for downloading videos from YouTube and other websites via command line. The list of all the supported websites can be found in official website. The youtube-dl is a cross-platform tool that requires the Python interpreter.
This tutorial explains how to install youtube-dl on Ubuntu 20.04.
Download youtube-dl from official website to the
sudo wget -qO /usr/local/bin/youtube-dl https://yt-dl.org/downloads/latest/youtube-dl
Set read and execute permissions for a file:
sudo chmod a+rx /usr/local/bin/youtube-dl
youtube-dl will available for all users as a system-wide command.
We can check youtube-dl version as follows:
If you get an error message
/usr/bin/env: 'python': No such file or directory, you need to create a symbolic link for
/usr/bin/python because Ubuntu 20.04 only has Python 3 by default.
sudo ln -s /usr/bin/python3 /usr/bin/python
Once created symbolic link, you can check youtube-dl version again.
To update youtube-dl to the latest version, use the following command:
sudo youtube-dl -U
Video from website can be downloaded as follows:
<VIDEO_URL> is a video URL that you want to download. For example:
In most cases, you don't need to install any external dependencies for youtube-dl. However, if you want to convert video/audio, you will need to install FFmpeg. See a post how to install it.
-x option can be used to convert video files to audio only files. This feature requires FFmpeg.
youtube-dl -x https://www.youtube.com/watch?v=C0DPdy98e4c
If you want to remove youtube-dl, run the following command:
sudo rm -rf /usr/local/bin/youtube-dl
The 2 Comments Found
I found youtube-dl extrememly slow downloading so did some searching and found a fork of youtube-dl called yt-dlp. You can follow all the commandline sequence above but switch out youtube-dl with yt-dlp. Thanks for he assist.
I created a separate post how to install yt-dlp on Ubuntu.
Leave a CommentCancel reply