You're viewing a comment by Trizen and its responses.

September 26, 2011, 16:11

My pleasure. I came back with few shorter youtube-downloaders.

For Perl>=5.14.1
use LWP;use URI::Escape;$u=\&uri_unescape;for(@ARGV){($y,$_)=m[(.+m)/.+[=/]([\w-]{11})] or next;&$u(($l=new LWP::UserAgent)->
get("$y/get_video_info?&video_id=$_")->content)=~/ap=url=([^&]+).+&title=([^&]+)/;$l->mirror(&$u($1),&$u("$2.mp4"=~y#+/# #r))}

For all versions of Perl
use LWP;use URI::Escape;$u=\&uri_unescape;for(@ARGV){($y,$_)=m[(.+m)/.+[=/]([\w-]{11})] or next;&$u(($l=new LWP::UserAgent)->get(
"$y/get_video_info?&video_id=$_")->content)=~/ap=url=([^&]+).+&title=([^&]+)/;$l->mirror(&$u($1),do{$t=&$u($2);$t=~y#+/# #;"$t.mp4"})}

One-liner version:
perl -MLWP -MURI::Escape -e '$u=\&uri_unescape;for(@ARGV){($y,$_)=m[(.+m)/.+[=/]([\w-]{11})] or next;&$u(($l=new LWP::UserAgent)->get("$y/get_video_info?&video_id=$_")->content)=~/ap=url=([^&]+).+&title=([^&]+)/;$l->mirror(&$u($1),do{$t=&$u($2);$t=~y#+/# #;"$t.mp4"})}'

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type first 3 letters of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.