How To download Youtube videos and Playlists in Ubuntu


Introduction

Today we will learn how to download YouTube videos as video or Mp3, using youtube-dl, as well as how to download full YouTube playlists.

Install

Step 1
Connect to your server as the admin user via SSH or open a command prompt.

ssh [email protected]
Step 2
We will download the latest youtube-dl to make sure we have the latest one

Note
If in the future youtube-dl stops working repeat these command to update it to the latest version
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

Step 3

Downloading as Video

Pretty Simple just run the command on the url you want to download and youtube-dl will download the video in the best quality available, try to chose a video that offers HD quality for best results.

youtube-dl https://www.youtube.com/watch?v=_Yhyp-_hX2s


Downloading as Mp3

This command will extract the audio only and save it as Mp3

youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=_Yhyp-_hX2s



Downloading Full Playlists

This is probably the most powerfull feature of youtube-dl, as it allows us to download multiple files with one command.

Note:

Make sure to get the playlist Full list URL not the individual video
example

Full Playlist URL
https://www.youtube.com/playlist?list=PL1yPx49iVsPbisAIcry9koh0d1RYEd8Wk



Downloading as video

To download the full playlist run this command

youtube-dl -cit https://www.youtube.com/playlist?list=PL1yPx49iVsPbisAIcry9koh0d1RYEd8Wk



Downloading as Mp3

To download the full playlist as Mp3 run this command

youtube-dl -cit --extract-audio --audio-format mp3 https://www.youtube.com/playlist?list=PL1yPx49iVsPbisAIcry9koh0d1RYEd8Wk



That's It if you have any questions or comments please post in the bottom of this post.

10$ off on me with This Link, if you don't have your own server visit DigitalOcean servers starting at 5$ a month
10$ off on me with

Jaco Toledo

Hi, I am a System Administrator that Lives in Jacksonville Florida and loves to experiment with anything IT, my favorite Linux Distro is Ubuntu I Love its simplicity.

Jacksonville, FL http://www.ubuntuboss.com

Subscribe to UbuntuBoss: Easy Ubuntu Tutorials | How to for Ubuntu Linux

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!