“Youtube-dl” is Simply Awesome To Download Entire YouTube Channel!

Recently a client asked me to download their entire youtube channel so they can host the videos internally. However, there were over 100+ videos and downloading them manually would have been a very time consuming task so I did a little bit of research discovered this simple yet very powerful command called “youtube-dl”.  You can use it to download videos straight off of YouTube.

About youtube-dl:
youtube-dl is a small command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter (2.6, 2.7, or 3.3+), and it is not platform specific. It should work in your Unix box, in Windows or in Mac OS X. It is released to the public domain, which means you can modify it, redistribute it or use it however you like.

If you ever wanted to download the entire Youtube channel using Ubuntu, Youtube-dl might just be exactly what you were looking for to do just that.

Here is how it works: 

First download it it here: http://rg3.github.io/youtube-dl/download.html or git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

Then run these two simple commands.
Option #1 – To download an entire channel use this command:

           youtube-dl -citw ytuser:<USERNAME HERE>

Option #2 – To download all videos on a single playlist use this command: 

           youtube-dl -citw <THE PLAYLIST URL HERE>

 

Optional step: Convert your .MP4 to .MP3 files 

Note that this will bulk convert multiple files so I think its pretty awesome but if you want to just download since files skip this step and go to the next one.

First install  ffmpeg at https://www.ffmpeg.org/

Then locate your download folder where all the .mp4 files are located. For example if its under “youtube-videos” you navigate there b doing this: cd /youtube-videos

Once you are in this directory run this script.

#!/bin/bash
for i in *.mp4
do
ffmpeg -i "$i" -ab 128k "${i%mp4}mp3"
done

Or if you just want to download them one by one you can just run this command.

youtube-dl --extract-audio --audio-format mp3 <video URL>

Thats about it! Its the fastest way to go about doing this without using any GUI.

The only thing is that this will save everything in the same directory so you will have to sort everything after its done.