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

March 08, 2011, 19:41

Or with support for multiple URLs or video codes:

use LWP;
use URI::Escape;
foreach $_ (@ARGV) {
$_ =~ s[^.*[=/]?([\w\-]{11}).*][$1];
$c = uri_unescape($t = 'LWP::UserAgent'->new->get("http://www.youtube.com/get_video_info?&video_id=$_&el=detailpage&ps=default&eurl=&gl=US&hl=en")->content);
$t =~ /&title=([^&]+)&/ ? $t = uri_unescape($1) : '';
$t =~ s[\+|/][ ]g ? $t = quotemeta $t : '';
$c =~ s/.*fmt_url_map=[\d\|]+([^,]+).*/$1/;
system qq[wget "$c" -O $t.mp4];
}

* Sorry for the double post...

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.