Total Pageviews

Saturday 31 December 2011

Youtube Downloading!


Have you ever thought of downloading an entire playlist of game trailers or video songs off youtube? i'm sure you have ;)

Today we will show you a very very simple method of doing it.
We would be using youtube-dl for downloading videos/playlists from youtube.

REQUIREMENTS:


  1. ->python .. since youtube-dl is written in python.
  2. ->terminal ('cmd' on Windows and 'terminal' on Linux) ... youtube-dl is a command-line utility
  3. (i.e it doesn't have a Graphical User Interface)
  4. ->valid url .. you can download a single video / entire playlist / entire channel off youtube.
  5. Fetch the appropriate link
examples:
playlist >> http://www.youtube.com/playlist?list=PL44259AA05F59EB6C
channel >> http://www.youtube.com/user/nptelhrd
video >> http://www.youtube.com/watch?v=tKTZoB2Vjuk

SETUP:
1) Download youtube-dl from here.(NOTE: some browsers may open it as a text file,
 in that case 'right-click' and 'save link as' "youtube-dl.py")
2) Open cmd/terminal and 'cd' into the directory where you downloaded youtube-dl.py
3) type :
$python youtube-dl.py "<link>"
example:
$python youtube-dl.py "http://www.youtube.com/playlist?list=PL44259AA05F59EB6C"

TIPS/TRICKS
wasn't that quite easy?! well youtube-dl has much more than this...

  • -> python youtube-dl.py - -playlist-start 1 - -playlist-end 5 "<playlist url>" | 
  • This will download only first 5 videos of the playlist
  • -> python youtube-dl.py -F  "<url>" | 
  • This will show all the available downloadable formats
  • -> python youtube-dl.py -f xx  "<url>" | 
  • This will download the format specified. 
  • Here, xx is a 2 digit code corresponding to each format.
  • -> python youtube-dl.py  - -match-title  <pattern>  "<channel/playlist url>" | 
  • will download only those videos having <pattern> in their titles
  • -> python youtube-dl.py  -h | will display help about all other options available
  • -> python youtube-dl.py  -U | This will update youtube-dl to the latest version. 
  • Updating youtube-dl is MOST IMPORTANT and you MUST do it regularly.

NOTE: If you are on any famous Linux Distro, you must be having youtube-dl in you repository.



WICKED COOL USAGE (ONLY FOR LINUX USERS)
Its kind of Boring to always type these big commands and remember/copy-paste all those weird URLs...
 thanks to 'bash' you can take help of 'alias' :)
Following is a gist of my ~/.bash_aliases file, you can (you SHOULD)
modify it according to your taste :)
alias youtube-dl='youtube-dl -cit --console-title'
alias yck='youtube-dl -F'
alias visotrailer='youtube-dl -f 45 "http://www.youtube.com/playlist?list=PL5F394CB9AB8A3519"'
alias TED='youtube-dl -f 44 "http://www.youtube.com/user/TEDtalksDirector"'
alias hdtrailers='youtube-dl -f 37 "http://www.youtube.com/user/trailers"'
alias osdc2011='youtube-dl -f 44 "http://www.youtube.com/user/osdc2011"'

-c =>resume partially downloaded files || -i => ignore errors || -t => use title in file name ||
--console-title =>show statistics in console title
After adding these lines to you ~/.bash_aliases you must either open a new terminal
or execute "$source ~/.bashrc"
now to check the available formats you can easily type in
$yck "<url>"
to start Downloading the entire channel of TEDtalksDirector you need not remember the url
of the channel,
just type in
$TED

note that it will start downloading the videos in the directory where you issue the command.
If you have previously downloaded some
videos, they won't be downloaded again only if you are in the same directory that contain the
downloaded videos (hufff...). In short
while ripping off playlists/channels make sure that you issue the command (eg TED or hdtrailers)
in the same directory everytime
to avoid repeat download of any video.

Do leave any comments/queries and share it only if you like it.
Cheers!

No comments:

Post a Comment