Download YouTube Videos, Channels and Playlists with Youtube-DL
Today, I found a fantastic YouTube channel with loads of videos that interest me. Since I especially enjoy watching videos when I do not have an Internet connection, I tend to download videos from youtube to watch them later. However, this has always been a pain in the behind to do, especially if you are following a certain channel and would like to have the latest videos…
Well, if you are a Ubuntu user, it takes about 1 minutes to setup and start downloading.
First of all you need "youtube-dl", it's a simple command line tool to download videos from YouTube.
Get it via:
# apt-get install youtube-dl
or find your right download here:
http://rg3.github.com/youtube-dl/
Once installed, youtube-dl will download into the folder you are currently in, so I suggest creating folders first. I am giving some examples below on how I am using youtube-dl.
You could download a single youtube video by entering in the console:
# mkdir ~/YouTube/various
# cd ~/YouTube/various
# youtube-dl -citw http://www.youtube.com/watch?v=bV9L5Ht9LgY
To download the youtube channel http://www.youtube.com/user/celebrateubuntu by entering in the console:
# mkdir ~/YouTube/channels/celebrateubuntu
# cd ~/YouTube/channels/celebrateubuntu
# youtube-dl -citw ytuser:celebrateubuntu
You could download a youtube playlist like http://www.youtube.com/playlist?list=PL512E30EA478B12D9, use:
# mkdir ~/YouTube/playlists/celebrateubuntu
# cd ~/YouTube/playlists/celebrateubuntu
# youtube-dl -citw "http://www.youtube.com/view_play_list?p=PL512E30EA478B12D9"
You can download multiple videos from different URLs in batch mode! Simply put the links to the videos, channels, and/or playlists in a text file, and youtube-dl does the rest, just pass the text file on as a parameter using -a option.
# mkdir ~/YouTube/ubuntu-videos
# cd ~/YouTube/ubuntu-videos
# youtube-dl -citw -a "ubuntu-videos.txt"
——- Example of ubuntu-videos.txt ——--
http://www.youtube.com/watch?v=ZZIA0agcd_Y
http://www.youtube.com/playlist?list=PL512E30EA478B12D9
ytuser:celebrateubuntu
———————————————-
Once the download is completed, you could run the file again at any time, youtube-dl will only download (new) videos (from the playlists/channels) that have not been downloaded before. You can of course add new links to the file, run it again (in the same folder as before), and youtube-dl will only download new videos. It's a perfect way to keep an offline version of the channels/playlists you like, you could even schedule it to run/update automatically in the background.
Now comes the icing!
You can turn this into a podcast downloader for youtube videos
# mkdir ~/YouTube/videos-to-audio
# cd ~/YouTube/videos-to-audio
# youtube-dl -citwk -a "videos-to-audio.txt" --extract-audio --audio-format mp3
This would download the videos and extract the audio into a separate mp3 file. If you do not add the "k" option, the downloaded video will be deleted after the audio extraction. This is a bad idea when using the batch files to update when new videos are available in the channels/playlists, as it would re-download all videos since they are no longer present in the folder.
-citw stands for:
c -- continue interrupted download
i -- ignore errors
t -- use video title in file name
w -- do not overwrite existing files
To view all command/attributes:
# youtube-dl --help
Enjoy!
If you still use Windows, there are instructions on how to install youtube-dl on Windows present on the website I linked to above. Alternatively, you can simply google for "free youtube downloader", there are many programs with a gui to choose from, all equally lame. If you use a mac, ask on yahoo for help ;P
The one thing that air conditioners and computers have in common:
They do not work well, if you open Windows.
13906
Hi Gyro,
Thanks a lot for this post. youtube-dl is great, but the documentation don’t show mutch!
Thanks, you made my weekend! :-)
I tried “man youtube-dl”, but it only shows half the options, and it doesn’t even mention the “ytuser:xyz” feature, which is what I was looking for.
Hi Jan,
and you have made my day, thank you very much for the coffee!!
Have a great weekend
I myself has discovered an amazing online youtube multi video downloader for absolutely free.
It is surprisingly very fast & lists all the videos from youtube page from :-
1) Youtube Url
2) Search term or
3) Youtube page source code.
You can fetch the download links of any of the listed video. It displays almost all the available
“video” & “audio” links (total around 25 download links) seperately.
So, now downloading “Youtube playlist” or “Youtube Channels” has become a lot easier. No need to
remember or copy /paste urls of each video every time.
Even, this website also supports “legacy videos/country-restricted or adult videos”. So, guys check
this out yourself.
This amazing website’s url is:
http://www.ytripper.com/
Nice site.
I gave it a try, and it always comes back with a whole list of videos, so I have to find the video I was actually interested in.
A bit weird that you can’t just insert the URL of the video you want to get the download links of that video only.
Still, nice find.
thanks for sharing, it very great
Hi,
Kindly, let me know:
a) A way to download ONLY the video files that has been updated in a youtube – channel / playlist via “youtube-dl” file, here the youtube playlist is already been downloaded need to update it.
b) Also, let me know a way to download the youtube files with resp.., to it’s youtube playlist names by creating a directories according to it’s playlist name via “youtube-dl” then download the video files.
Kindly, expecting the answer for my query, Please HELP !!!.
Thanks,
Karthikeyan Mahalingam.
Hi,
you can use the option “
--no-post-overwrites
” to skip existing videos.Regarding your 2nd question, have a look here: https://github.com/rg3/youtube-dl#output-template-and-windows-batch-files