Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Help me with this php

Name: Anonymous 2006-04-07 10:54


It is in a funny syntax that doesn't work with my version of php

use HTML::TokeParser;
use LWP::UserAgent;
use HTTP::Response;
my $prefix = "x";

my $agent = LWP::UserAgent->new;
my $get = 'http://uh-oh.com/main.htm';;
if ($ARGV[0] eq "-v") {
        $get = 'http://www.thevidvault.com/';;
        $prefix = "v$prefix";
}
my $response = $agent->get($get);

my $content = $response->content;
my $parser = HTML::TokeParser->new(\$content);
if (!$parser) { die "Parse Not Alive?"; }
my @urls = ();
while (my $token = $parser->get_token) {
        if ($token->[0] eq "S") {
                if (lc($token->[1]) eq "a") {
                        my $url = $token->[2]->{href},"\n";
                        my $text = $parser->get_trimmed_text("/a");
                        ##if ($url =~ /thumb.*url=(.*)$/) {
                        if ($text =~ /\((\d)+\)/) {
                                print $text,$/;
                                push @urls,$url;
                        }
                }
        }
}
my $max = 20;
my $fileseach = scalar(@urls)/$max;
foreach (1..$fileseach) {
        open(FILE,">".getName($_));
        print FILE join("\n",@urls[(($_-1)*$max)..(($_)*$max)]),"\n";
        close(FILE);
}
foreach (1..$fileseach) {
        my $str = "wget -r -np -i ".getName($_)." &";
        print "$str\n";
        my $k = fork();
        unless ($k) {
                exec($str);
        }
}
sub getName {
        my $number = shift;
        return "./${prefix}${number}.urls";
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List