Friday, November 28, 2008

Rip Youtube the CLI way

There are many applications for extracting and downloading videos from youtube and other video hosts like web-based KeepVid or addons like VideoDownloader, and many others. There's also a very good technique of saving any streaming video by buffering it till 100%, navigate to the Cache folder and simply copy the video file (which is /tmp in case of linux).

But recently I got a python based CLI tool youtube-dl, which is a nifty yet a powerful must have tool. You can get it from your default repositories or for youtube-dl under Windows XP. Get it :

$ sudo yum install youtube-dl

Usage
  • Simply download :
    $ youtube-dl http://www.youtube.com/watch?v=video_id

  • Specify filename

    Manually specify :
    $ youtube-dl -o output.flv http://www.youtube.com/watch?v=video_id
    Use the original video title :
    $ youtube-dl -t http://www.youtube.com/watch?v=video_id
    Have a literal title :
    $ youtube-dl -l http://www.youtube.com/watch?v=video_id

  • Download videos which requires your youtube account privileges and confirmation :
    $ youtube-dl -u username -p password http://www.youtube.com/watch?v=video_id

    Or read account details from .netrc file :
    $ youtube-dl -n http://www.youtube.com/watch?v=video_id
    Append this line to ~/.netrc file :
    machine youtube login username password password

  • Simply print video URL instead of downloading :
    $ youtube-dl -g http://www.youtube.com/watch?v=video_id
    Or grab the Title :
    $ youtube-dl -2 http://www.youtube.com/watch?v=video_id

  • Download in silent mode (like wget) :
    $ youtube-dl -q http://www.youtube.com/watch?v=video_id &

  • Get Help :
    $ youtube-dl -h


Know more at the Official Page.

4 comments:

hELLraIser..(iNcOgniTiOn) said...

nice..i know u had cribbd abt me gettin youtube downloader..hehe..now i know y.. :)

Jadu Kumar Saikia said...

Anant, nice info mate.

//Jadu, unstableme.blogspot.com

MAYUR said...

प्रिया मित्र,
भोपाल में एक ब्लॉगर मीट करने का विचार है ,जिसमे हम ब्लोगिंग से जुड़े कई विषयों पर बात कर सकते हैं । इस ब्लॉगर मीट में अपनी उपस्तिथि दर्ज कराने और एजेंडा बनाने में मदद करने हेतु http://www.indiblogger.in/bloggermeet.php?id=34 यहाँ क्लिक कर रजिस्टर कर सकते हैं । हमें उम्मीद है की हम अपने ब्लोगों के लिए कुछ न कुछ ले के ही जायेंगे

धन्यवाद ,
मयूर

Anupum Pant said...

another gr8/simple method is adding a pwn jst before youtube in the URL :)
details: http://mrpant.com/pwn-youtube