How to Download Youtube Video or Audio Tracks from the Linux Terminal

In the past I’ve published some articles regarding how to download music from youtube with the program YouTube to MP3, or videos with the programs xVideoServiceThief and flareget, they all accomplish the work with graphical interfaces, and this can be a great plus for many users, but others could prefer a simple command line program that can easily download videos and optionally extract the audio in a specific format: youtube-dl.

youtube-dl is a small command-line program to download videos from YouTube.com and a lot more sites. It requires the Python interpreter (2.6, 2.7, or 3.3+), and it is not platform specific. It should work in your Linux box, in Windows or in Mac OS X. It is released to the public domain, which means you can modify it, redistribute it or use it however you like.
Installation
youtube-dl it’s available on the repository of the main distribution so, if you want, you can install the package with your package manager, for Debian based distributions such as Ubuntu and Mint the command is:

sudo apt-get install youtube-dl

But these packages could not keep the pace with the changes/update made on the youtube website, so in this particular case I suggest to download the binary directly from the official website
Looking at that page today the command to download the latest version it’s:

sudo curl https://yt-dl.org/downloads/2014.01.03/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl

If you do not have curl, you can alternatively use a recent wget:

sudo wget https://yt-dl.org/downloads/2014.01.03/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl

As example today I could use the official Mint 16 version, that it’s based on a release of the 29 of august 2013:

mint-desktop ~ # apt-cache policy youtube-dl
youtube-dl:
Installed: 2013.08.29-1
Candidate: 2013.08.29-1
Version table:
*** 2013.08.29-1 0
500 http://archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages
100

Read more at Linux Aria

Comments are closed.