How to install and use youtube-dl

How to install and use youtube-dl


A few days ago youtube-dl repository was blocked on GitHub. The takedown request was made by DMCA.

If you don't know, youtube-dl is a python script to download videos and audios from YouTube and other websites. I had this post in the backlog for a few months. But after the news above came out, I want to summarize how to install and use youtube-dl with the necessary packages.


To install youtube-dl on Ubuntu run:

sudo curl -L -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

You need a ffmpeg package. It is used to convert video and audio files after the download is done.

sudo apt-get install ffmpeg

You also need to install AtomicParsley if you want to embed thumbnails in audio files.

sudo apt install atomicparsley


To download a video:

youtube-dl $YOUTUBE_LINK

To download an mp3 file with thumbnail:

youtube-dl -x -embed-thumbnail --format mp3 $YOUTUBE_LINK

Note: format can be only mp3 or m4a at the moment. If one of the formats is unavailable, try another. The error will look similar to:

ERROR: requested format not available

To download a playlist:

youtube-dl -x --format m4a --embed-thumbnail --yes-playlist $YOUTUBE_PLAYLIST_URL

No links yet.