Youtube-dl, download videos from the terminal

Download video with Youtube-dl

If you are looking for a tool with which download videos from multiple platforms maybe you already know some popular options like jDownloader. The fact that there is an application as powerful as the one mentioned does not mean that there are alternatives to consider. One of the most interesting is YouTube-dl. It has been around for a long time to allow all users to download videos from almost any popular platform.

Youtube-dl is a small Python based command line tool that allows you to download videos from platforms such as: YouTube, Dailymotion, Google Video, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles and some similar sites. The Python interpreter is required to run the program. This program is open source and should run smoothly on any Unix-based, Windows, or Mac OS X system.

Youtube-dl also allows you to choose the video quality format available to download or let the program automatically download the highest quality video from the indicated portal. It also has support for downloading playlists, options to add custom or original titles to the downloaded video file. It also has support for using a proxy.

With this script you can only download the videos. Unlike other programs like mps-youtube you will not be able to play them from the terminal.

Install Youtube-dl

Ubuntu users can download and install this program from the webupd8 PPA as follows:

 sudo add-apt-repository ppa:nilarimogard/webupd8 && sudo apt update && sudo apt install youtube-dl

If you are one of those people who is reluctant to use any third-party PPA, in this case you can use the curl or wget command to install the latest version of the youtube-dl script as shown below:

 sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl

or if you are a wget lover you can use it by typing:

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl

After downloading the script, you have to set corresponding permissions:

sudo chmod a+rx /usr/local/bin/youtube-dl

How to use YouTube-dl to download videos

To download and save a video file, you just need to have the URL that interests you. Then you just have to open the terminal and run the following command:

youtube-dl https://www.youtube.com/watch?v=ySzrJ4GRF7s

To list all the available formats of the video that we want to download we will have to use the option «–list-formats» as shown below:

youtube-dl --list-formats https://www.youtube.com/watch?v=ySzrJ4GRF7s

supported formats youtube-dl

The previous command will show a list like the one in the screenshot. When you decide which one you are interested in, you just have to add the option '-f' followed by the video format code. For example, let's say I would like to download the video in mp4 format, so use the '18' format code as shown below.

youtube-dl -f 18 https://www.youtube.com/watch?v=ySzrJ4GRF7s

If what we want is to download a list of video files, you will only have to create a text file with all the YouTube links that you want to save on your computer. In this example the text file is called "youtube_links.txt":

youtube-dl-a youtube_links.txt

If you need help, the program will list all the available options if you type the following in the terminal:

youtube-dl --help

For other distributions, youtube-dl can be obtained from the download page from youtube-dl.

Update YouTube-dl

Updating this program will be necessary if when you are going to use it you find that it returns an error. If you come across a mistake, don't despair. Open a terminal and type:

sudo apt-get install python-pip && sudo pip install youtube-dl && sudo pip install --upgrade youtube-dl

Graphical interface for Youtube-dl

As I know that working from the command line still chokes many of them, we are going to add a graphical interface to this program that will simplify the use of the program. This interface is called Youtube-dlg. If we want to install it in Ubuntu, we can do it from the repository that we have previously installed. We just have to open a terminal and enter the following command:

sudo apt install youtube-dlg

Graphical interface Youtube-dlg

As you can see in the screenshot, its graphical interface is very simple. Any user will adapt to it soon. When starting the application we will have a configuration options button. From there we can indicate the route where we want to download the videos or we can select its format. From the main window and in the text box that we will find there, we can paste the URLs of the videos that we want to download. With the download button (Download) we will begin to download them to our computer.

With this we already have another good option to download videos from almost any web platform. Now it's just a matter of finding the one that best suits everyone's needs.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Gaston zepeda said

    Or if you want a graphical environment, use clipgrab?

  2.   Hilmar Miguel Say Garcia said

    Install the downloadhelper extension in Mozilla Firefox and download in different formats and qualities from the browser ...

  3.   Omar espinoza said

    4K downloader and it works like a charm

  4.   Guille said

    If I remember correctly to download in the best possible quality type directly youtube-dl -f best HereTheYoutubePage and if it is placed between «» a playlist is downloaded that is youtube-dl -f best «HereThePageOfAVideoOfTheYoutubePlaylist»

  5.   Damian Amoedo said

    This is just one more option of the many that can be found on the web. Let everyone select the one that best suits their needs. Greetings.

  6.   chencho9000 said

    Good tutorial and it is wasted to use it with the console

  7.   Bertoldo Suarez Perez said

    Something is missing from this tool, and it is necessary because on the web it is not that there are accurate solutions all the time. You need to download AUDIO of the videos, only audio (without the video). They usually do it in mp3.

  8.   jaime said

    the best of the best, on my ZORIN OS 15

  9.   Gonzalo said

    I just looked at it, in Debian and Ubuntu it can be installed using apt

    sudo apt install youtube-dl

  10.   Mari said

    It works wonderfully. Thank you so much