Download youtube video directly from the command line with youtube-dl

If you keep searching for applications to download the youtube videos or you keep searching for the firefox addons to download the embedded the video, then this is for you. Ofcouse that is the case, only if you do not want to copy it after you have watched it in the browser :). If you have already watched it then you can copy it from the Firefox cache. I will post on that later for now lets see youtube-dl.

Lets download it first:

sudo yum install youtube-dl

Now when you want to download a video then all you need to do is

youtube-dl URL

This will work only if you can watch without logging in to your account, if you need to login then you should provide your username and password, like so:

youtube-dl -u username -p password URL

The problem with this is that the file will be saved with not so useful name. If you want to save the file with appropriate name then you can save the file with the title name:

youtube-dl -t URL

There are few other options worth looking at, specially :

-f FMT, –format=FMT
video format code
-b, –best-quality  download the best quality video possible
-m, –mobile-version
alias for -f 17
-d, –high-def      alias for -f 22

If you have multiple url\’s to download then place all the url\’s in a file, and then use the command:

youtube-dl -a filename

Hope this is useful to you.