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!
- See more at: http://www.webdesignblog.asia/software/download-youtube-videos-channels-and-playlists-with-youtube-dl/#sthash.DsXbXSzI.dpuf
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!
- See more at: http://www.webdesignblog.asia/software/download-youtube-videos-channels-and-playlists-with-youtube-dl/#sthash.DsXbXSzI.dpuf