Tuesday, September 13, 2016

Dowloading youtube videos with a batch file with youtube-dl on Linux.

Youtube-dl is a command-line program to download videos from YouTube.com and a few more sites. You can download your favourites videos quickly and easily.

First, install Youtube-dl on your system from: https://rg3.github.io/youtube-dl/download.html

You have different ways to install the application, I used this one:

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

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

Note: Remember youtube-dl requires Python version 2.6, 2.7, or 3.2+.

Youtube-dl has a lot of different functionalities, you can see all of them with the command Youtube-dl --help but I'm going to show you just a basic command to download videos.

Allright, we've installed Youtube-dl on our system so we need to create a txt file with the youtube's links. The URLs should be arranged in a list having only one URL and nothing else on each line, with a new line for each URL in the list, please see the below example.



After created your batch file, you can test your batch running this command from the terminal:

youtube-dl -c --title --simulate --batch-file='/path/to/yourbatchfilehere.txt'




If you use --simulate, you are not running the real command, you have to remove --simulate to start downloading your videos but this command will let you know if everything is well, when you remove this option, the real output should look something like this (I using -v verbose):


Now you are able to store\watch your favourites videos directly on your computer.


I'm showing here just the simplest and fastest way to download many videos at the same time, Youtube-dl is a powerful and simple to tool to download videos from youtube, you have a lot of options to use for example to change video formats, write subtitles files, use authentication, etc. I suggest you to investigate any of these functionalities. See you next time.

We're reading!!!