Skip to content

Instantly share code, notes, and snippets.

@geekdadley
Last active December 27, 2015 08:59
Show Gist options
  • Select an option

  • Save geekdadley/7300818 to your computer and use it in GitHub Desktop.

Select an option

Save geekdadley/7300818 to your computer and use it in GitHub Desktop.
Use flvcd to automatically download youku page in a batch.
#!/usr/bin/perl
# download flv pieces and put them at current dir with name as 01,02,03,etc.
# So less than 100 pieces are expected
use strict;
if(@ARGV != 1)
{
print "download_youku <URL>\n";
exit 1;
}
my ($original_youku) = @ARGV;
my $flvcdpage = `curl "http://www.flvcd.com/parse.php?kw=$original_youku&flag=one&format=super 1 >>/dev/null 2>>/dev/null"`;
chomp($flvcdpage);
my @urls = ($flvcdpage =~ m/<BR><a href=\"(.*?)\" target=\"_blank\" onclick=\"_alert/g);
my $name=1;
foreach(@urls)
{
system(sprintf("wget --user-agent='chrome' $_ -O %02d.flv",$name));
#(printf("wget --user-agent='chrome' $_ -O %02d.flv\n",$name));
$name++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment