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

February 20, 2011, 14:08

10 lines Youtube Downloader (new)

Downloads Youtube videos with wget at the best quality available with Youtube title as file name.

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

Enjoy!

Comment Responses

Jay Permalink
March 24, 2011, 02:41

Thanks Trizen. That works perfectly for me. Quick question: where is the 'best quality' part? I actually want the quickest download/lowest quality. How would I modify your query?

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.