2007-03-14

Wanna download a YouTube video?

If you want to download a YouTube video it is really easy with the shell. All you have to do is to pick up the video_id in the URL and feed it to the script. It will then fetch the valid URL to download the flv video.

But that's not why I want to blog about it because there are already scripts to download YouTube videos. The reason I'm blogging is because it is a one-liner.

wget "http://www.youtube.com/get_video?`wget -q -O - "http://youtube.com/watch?v=$1" | egrep -m1 -o 'video_id=[^&]+&l=[0-9]+&t=[^"&]+'`" -O $1.flv

Note: $1 is the video_id parameter sent to the script.

Download the script.

3 comments:

  1. The egrep has evolved since the time of that post :

    egrep -m1 -o 'video_id=[^&]+&l=[0-9]+&sk=[^&]+&fmt_map=[^&]+&t=[^"&]+'

    And a less strict regex would be 'video_id=.*&t=[^"&]+'

    ReplyDelete
  2. Great! It sounds good. Thanks for sharing.. youtube promotion packages

    ReplyDelete
  3. Making money on YouTube is possible, but it won't be a quick process. Marketing is everything in the virtual world, so promote as much as you can. Facebook, MySpace, and Twitter are other great ways to generate traffic to your YouTube account or your blog. Insightssuccess.com

    ReplyDelete