Download Youtube videos on Linux

You can download easily with a command-line program called youtube-dl.
Link to site

Install:

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

Download a single movie in mp4 format and best quality

Tip: create a video folder and open the terminal from this folder to execute the statements.

youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 <video-url>

Download a batch of movies in mp4 format and best quality

First create a file named something like videos.batch and place on every line a video that you would like to download, like:

https://www.youtube.com/watch?v=I_izvAbhExY
https://www.youtube.com/watch?v=5uHityNBtFY

Now you can download everything at once with the following command:

youtube-dl -a videos.batch -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4

Download just music in the best possible quality

youtube-dl -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 <Video-URL>
Last update: November 9th at 10:05pm