Author Topic: How to Use YouTube-dl to Download Full Play lists  (Read 3158 times)

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
How to Use YouTube-dl to Download Full Play lists
« on: March 24, 2017, 03:17:34 am »
How to Use YouTube-dl to Download Full Playlists

In this tutorial, we’re going to be exploring how to use youtube-dl to down load a full YouTube playlist content, with one simple command from your terminal console.

The package, youtube-dl is a very simple, very lightweight and extremely powerful command-line tool to download video and audio from YouTube.  The youtube-dl package is in the repository.  It can also be downloaded by using a third party PPA, (not recommended), or directly from youtube-dl using the non-interactive network downloader package, wget.  One of the things that must be noted with youtube-dlGoogle updates their anti-download security system quite often.  To counter this, the devs at youtube-dl continuously update youtube-dl.  They do this much more frequently than the devs maintaining the Ubuntu repos.  If you’ve installed youtube-dl from the repos, you’ll quite often find it won’t work until the next Ubuntu update.  To get around this, I recommend downloading youtube-dl directly and updating it manually each time you use it.  The choice is your.  Instructions for both methods will be available.  I won’t be covering the installation by 3rd party PPA in this tutorial.

If you're new to Linux, or are hesitant to use the terminal.  This tutorial should make you want to explore terminal usage further.  This tutorial is a quite long.  It's not because it's difficult.  It's because it's quited detailed.  Okay, let's get to it and have some youtube-dl and terminal  fun  ;).

To install youtube-dl from the repository, please open a terminal window with the following keystrokes: Ctrl+Alt+t.  Enter, (Copy & Paste) the following command into the terminal window:

TipLinux is case sensitive.  To reduce the possibility of typographical errors, please left click the Code: [Select] function to highlight the line of code.  This is located above the command on the far left side.  Use the right mouse button and select: Copy from the menu.  With your mouse cursor inside the active terminal window.  Paste the contents by clicking the right mouse button and selecting: Paste from the menu.  For Chromium Browser and Google Chrome users.  There is no need to copy, just highlight the code with the Code: [Select] function.  With your mouse cursor inside the active terminal window, simply click on the centre mouse button/wheel to paste the contents ;).

Note: For enhanced security, passwords are entered invisibly.   There’s NO indication of any user input.  By default "sudo" doesn't echo ANYTHING to screen (not even ******).  This way, anyone looking over your shoulder doesn't even get to see the length of your password.  You may enter an incorrect password 3 times before you have to repeat the command you’re trying to execute.

Code: [Select]
sudo apt update && sudo apt install youtube-dlHit enter/return, enter your user password if asked and follow the onscreen instruction.   

To install youtube-dl directly, please open a terminal window with the following keystrokes: Ctrl+Alt+t.  Enter, (Copy & Paste) the following command into the terminal window:
Code: [Select]
sudo wget -O /usr/local/bin/youtube-dlHit enter/return, enter your user password if asked and follow the onscreen instruction.  It now need to be made executable.  Enter, (Copy & Paste) the following command into the terminal window:
Code: [Select]
sudo chmod a+rx /usr/local/bin/youtube-dlTo manually update youtube-dl, simply enter the following command before using the application:
Code: [Select]
sudo youtube-dl -U
Congratulations, you’ve successfully installed youtube-dl to your computer  ;).

Note: youtube-dl is a command-line tool, it’ll not show in the menu structure.


If you’re already familiar with youtube-dl, you can skip this part of the tutorial.  However, you may still find it useful as a refresher  ;).

Here we’re going to download a video using youtube-dl in its most basic form.  First make a new sub-directory called: youtube-dl-test in your ~/Video folder.  Enter, (Copy & Paste) the following command into the terminal window:
Code: [Select]
mkdir -v ~/Video/youtube-dl-testHit Enter/Return.  Now we’ll move to that new sub-directory.  Enter, (Copy & Paste) the following command into the terminal window:
Code: [Select]
cd ~/Video/youtube-dl-testHit Enter/Return

For a fun example, we'll download Justin Johnson playing a 3-string guitar made out of a garden spade.  Please start the video and from the lower right corner, right click on the: YouTube logo, Watch on

The link will open to the YouTube video page in a new browser window, as seen below:

Click on Image to Enlarge

Below the video screen, find the Share button.  Click on this and a blue highlighted link will become visible.  See image below:

Click on Image to Enlarge

Right click on the link and select: Copy from the menu.  Back in the active terminal window, enter, (Copy & Paste) the following command:
Code: [Select]
sudo youtube-dl -U && youtube-dl Before you hit Enter/Return, finish the command by pasting the URL you just copied into the terminal window with the following key strokes: Ctrl+Shift+v.  The finished command should look like this:
Code: [Select]
sudo youtube-dl -U && youtube-dl Enter/Return and enter you password if asked.  YouTube-dl will update to the newest version and then download the video at the highest quality by default.  Once that has completed, you may watch the video with your favourite video player.

As you can see youtube-dl is very cool and very easy to use.  It does a whole lot more than just downloading one video at a time though.  Say you want to download and save a whole playlist in one go.  YouTube-dl can easily do this.


The subject download for this tutorial, is a playlist of 32 short videos entitled, Linux Commands for Beginners.  For this tutorial, we're going to use a YouTube channel called: LearnLinux.TV.

Click on Image to Enlarge

In the window, find the Playlist tab and left click on it.  A new window will open up:

Click on Image to Enlarge

Find the playlist entitled: Linux Commands For Beginners.  Left click on this and new window will open up.

Click on Image to Enlarge

Click on the Share tab and copy the link displayed.  In the active terminal window, make sure you're still in the directory:
Code: [Select]
~/Video/youtube-dl-testIf you're not, run the following command:
Code: [Select]
cd ~/Video/youtube-dl-testTo download all 32 of the videos with one command, we could simply run this command containing the link you've just copied:
Code: [Select]
youtube-dl ""(note how the URL is encapsulated with quotation marks. The apostrophy mark can also be used.  It mus be only one or the other though).  Let not do that, when we can make the download a lot more interesting by adding some additional options, called switches.  These switches can be found in the, youtube-dl --help pages. To view these pages, run either of the following commands in a terminal window:
Code: [Select]
youtube-dl -hor
Code: [Select]
youtube-dl --helpTo exit the help page, simply hit q on your keyboard.  As you can see, there are a huge amount of options available.  For this tutorial, we're only going to be using the following command into the terminal window:
Code: [Select]
youtube-dl -cit ""We're going to add the output switches -c, -i and -t, or just -cit, (note: -t is no longer an option in the --help page.  The -o is the equivalant modifier switch.  It doesn't appear to work though.  The -t modifier switch does still work).  Adding these output switches is really cool  8).  Below is information about these switches.

The -c, or --continue modifier switch, "Force resume of partially downloaded files. By default, youtube-dl will resume downloads if possible."  This means if you stop the download for whatever reason.  It'll resume from where it left off when restarted.  That's very useful  ;).

The -i, or--ignore-errors modifier switch, "Continue on download errors, for example to skip unavailable videos in a playlist." This means if errors are encountered in any of the video files being downloaded, youtube-dl will move to the next one in the list.  This can save a lot of time  ;).

The -t, or --title modifier switch, "use title in file name."  This means downloaded file will have the name of the title of the video included in the file name.  Without it, youtube-dl generates a random file name that makes no sense to humans.  This is very useful when you're cataloging your downloads.  When using this switch you'll see this warning: "WARNING: --title is deprecated. Use -o "%(title)s-%(id)s.%(ext)s" instead."  The -o switch doesn't seem to work.

The -o, or --output modifier, "Output filename template, see the "OUTPUT TEMPLATE" for all the info".  I can't get this to work.  If anyone can, please let me know and I'll include it in this tutorial..

Run the command provided above.  For a test, wait a minute and cancel it with the keystrokes: Ctrl +c.  Rerun the same youtube-dl command again.  It'll pickup from where it left off.  Check the downloading files in the Nemo file manager and you'll see all the video titles are included in the file names.  Once the downloads have completed, you'll be able to view the whole playlist or the videos individually with your favourite video player  :).

That's how to download a full YouTube playlist using youtube-dl.  Be sure to experiment with the different switches.  There are lots of different youtube-dl tutorials online exploring the different functions of this powerful little package.   I hope you found this tutorial both interesting and useful - have fun  ;).

« Last Edit: March 24, 2017, 03:41:03 am by AndyInMokum »
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline cavy

  • Trusted User
  • Member
  • *****
  • Posts: 477
  • Karma: 97
  • Caveman
    • View Profile
  • Peppermint version(s): Peppermint Ten
Re: How to Use YouTube-dl to Download Full Play lists
« Reply #1 on: March 24, 2017, 04:03:55 am »
Awesome Andy  :D

Hopefully I can stock up on some more video clicks, before they pull the plug again   8)
“We know what we are, but not what we may be.”

Various machines to sample the delights of Linux

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: How to Use YouTube-dl to Download Full Play lists
« Reply #2 on: March 24, 2017, 05:37:35 am »
You do realise there's a GUI front end for youtube-dl called youtube-dlg ?

Direct download link for the latest (at time of posting) version for 16.04:
that's packaged by Webupd8, read more here:
or a link to the package repo here (if you don't want to add the PPA, or want to check the direct link is still the current latest version for xenial):

or the source code is here:
« Last Edit: March 24, 2017, 05:43:45 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint