mecrazycoder has asked for the wisdom of the Perl Monks concerning the following question:
use LWP; use URI::Escape; my $url; foreach $_ (@ARGV) { $_ =~ s[^.*[=/]?([\w\-]{11}).*][$1]; my $ua = LWP::UserAgent->new; #$ua->proxy(['http', 'ftp'], 'http://192.16.3.254:8080/'); $c = uri_unescape($t = $ua->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/; open(FILE, '>Test.mp4'); my $resp = $ua->get( $c ) or die; print FILE $resp->content; close(FILE); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Whats wrong with this code
by moritz (Cardinal) on Jul 22, 2011 at 13:31 UTC | |
by mecrazycoder (Sexton) on Jul 22, 2011 at 13:38 UTC | |
|
Re: Whats wrong with this code
by Anonymous Monk on Jul 22, 2011 at 13:42 UTC | |
|
Re: Whats wrong with this code
by cdarke (Prior) on Jul 22, 2011 at 13:37 UTC | |
by mecrazycoder (Sexton) on Jul 22, 2011 at 13:46 UTC | |
by Anonymous Monk on Jul 22, 2011 at 13:52 UTC | |
by mecrazycoder (Sexton) on Jul 22, 2011 at 14:00 UTC | |
by ww (Archbishop) on Jul 22, 2011 at 16:31 UTC |