All pastes #493020 Raw Edit

Something

public text v1 · immutable
·published 2007-05-17 15:36 UTC
rendered paste body
#!/usr/bin/perl
#
#
#
#
`wget http://www.apple.com/trailers/`;
$date = &get_todays_date;
$file = 'index.html';
$out = 'out2.txt ';
open (TRASH, $file);
open (OUTFILE, ">out2.txt");
@gotit=<TRASH>;
for (@gotit) {
 print OUTFILE if (/Featured High Definition Trailers/ .. /-- \[END\] High Definition Trailers --/);
}

close (OUTFILE);
close (TRASH);
open (PARSE, $out);
open (OUTFILE, ">out3.txt");
@pandc=<PARSE>;
for (@pandc) {
  print OUTFILE "wget -qO - ". " http://movies.apple.com". substr("$&", 6, -2). "\n" if /href="(.+?)\/">/;
}
close (PARSE);
close (OUTFILE);
&rename_mainindex;

open (LEVEL2, "<out3.txt");
open (OUTFILE, ">out4.txt");
while(<LEVEL2>){
        $input = `$_`;
        @input = split(/\n/, $input);
                foreach $tmp(@input) {
                if ($tmp=~/(http:\/\/images.+1080p.mov)/i){
                $result=$1;
                $result=~s/1080p/h1080p/g;
#               print $result\n;
#               print $1;
                `wget "$result"`;
}
}
}
close (LEVEL2);
close (OUTFILE);

sub get_todays_date
{
       open(DT, "date +\%D |");
               chomp($rawdate = <DT>);
       close(DT);
       ($month, $day, $year) = split(/\//, $rawdate);
       $today = "$month-$day-20$year-";
       return $today;
}


sub rename_mainindex
{
       `mv $file $today$file`;
}