Download youtube Videos using the CLI

Life is simple again with this great little tool! You can find out more about it from their website, https://youtube-dl.org, but as you might be able to guess – it allows one to download video and/or audio from YouTube.

I’m using Manjaro i3 so I can use the community version available in the AUR.

[andy@home-pc ~]$ pamac search youtube-dl
youtube-dl                                                                      2021.04.26-1  community 
    A command-line program to download videos from YouTube.com and a few more
    sites

The install with:

[andy@home-pc ~]$ pamac build youtube-dl

I won’t go into detail about how to use it as there is a lot of documentation already online. However I did initially struggle to figure out how I download a whole playlist at the best quality download with audio, so I’ll share that here.

First of all, make sure you have the right URL for the playlist and not just the URL to the first song in it. It should have the word list in it. For example:

https://youtu.be/JtULGlOOkuM?list=RDEMVUNIAP0MuZGYDlZMk_ewuQ

The the command would look something like:

[andy@home-pc ~]$ youtube-dl --yes-playlist -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' https://youtu.be/JtULGlOOkuM?list=RDEMVUNIAP0MuZGYDlZMk_ewuQ

Hope this saves someone some time!

Be the first to comment

Leave a Reply