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.

3 comments:

hELLraIser..(iNcOgniTiOn) said...

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

Unknown said...

Anant, nice info mate.

//Jadu, unstableme.blogspot.com

Anupum Pant said...

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