All pastes #193243 Raw Edit

madvirii

public text v1 · immutable
·published 2006-10-06 18:12 UTC
rendered paste body
#!/usr/bin/perl -w
use WWW::Mechanize;

#Create an Object
my $mech = WWW::Mechanize->new();


foreach my $number ("0" .. "100") {

	my $ARGV;
	my $url = $ARGV;
	$mech->get( $url );
	my $link;
	if ($link = $mech->find_link(tag => "a", url_regex => qr/\.jpg$/i)) {
    		$mech->get($link);
		$mech->get( $link, ":content_file" => "$number.jpg");
	}
	elsif ($link = $mech->find_link(tag => "a", url_regex => qr/\.png$/i)) {
		$mech->get($link);
		$mech->get( $link, ":content_file" => "$number.png");
	}
	elsif ($link = $mech->find_link(tag => "a", url_regex => qr/\.gif$/i)) {
	$mech->get($link);
	$mech->get( $link, ":content_file" => "$number.gif");
	}
	else {
   		print "Image not found\n";
	}

}