youtube-dl is a small command-line program to download videos from YouTube, Dailymotion, Google Video, Photobucket, Facebook, Yahoo, Metacafe, Depositfile and a few more sites. The youtube-dl tool supports resuming interrupted downloads. If youtube-dl is killed in the middle of downloading, you can simply re-run it with the same YouTube video url. It will automatically resume the unfinished download, as long as a partial download is present in the current directory.
In this article you’ll find how to install YouTube downloader on Ubuntu 15.04/15.10 and Mint 17 linux. You’ll also learn how to download YouTube video, channel or playlist of any available quality and formats from the Linux shell.
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 -y
For any Linux distribution, you can quickly install youtube–dl on your system through the command line interface with:
$ sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
After fetching the file, you need to set a executable permission on the script to execute properly.
$ sudo chmod a+rx /usr/local/bin/youtube-dl
How to use youtube-dl
To download a video file, simply run the following command. Where “VIDEO_URL” is the url of the video that you want to download.
$ youtube-dl VIDEO_URL
Change video Format
This will download the video at the highest resolution available, something that perhaps you don’t want/need, so it’s possibile to see which formats are available with the option -F:
$ youtube-dl -F http://video_URL
$ youtube-dl -F http://www.youtube.com/watch?v=8-NXmMsed64
Now, I can choose which format download with the flag -f, so to download the webm at 360×640 I can use the command:
$ youtube-dl -f 43 http://www.youtube.com/watch?v=8-NXmMsed64
Download subtitles of videos using youtube-dl
First check if there are subtitles available for the video. To list all subs for a video, use the command beelow:
$ youtube-dl --list-subs http://www.youtube.com/watch?v=8-NXmMsed64
To download all subs, but not the video:
$ youtube-dl --all-subs --skip-download http://www.youtube.com/watch?v=8-NXmMsed64
To see all the available options, type the following commands in a terminal: “man youtube-dl” or “youtube-dl -h”.