Install

sudo pip3 install yt-dlp
yt-dlp --rm-cache-dir -f bestvideo+bestaudio https://www.youtube.com/watch?v=dfvlkdfjg8t3495873495

Install and setup (old)

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

Once installed, you can update it to the latest version using this command. This is helpful when you have been using it for a few months:

youtube-dl -U

Using YouTube-dl for downloading videos: 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>
youtube-dl -f bestvideo+bestaudio "link to youtube video"
yt-dlp -f bestvideo+bestaudio -x --audio-format mp3  https://www.youtube.com/watch?v=1234567890abcd