use HTML::TreeBuilder::XPath;
# ...
for my $count ( 0 .. 417 ) {
my $url = "http://crappyfartsgohome.wikia.com/wiki/File:".$myFileName[$count];
my $request = HTTP::Request->new(GET => $url);
my $response = $browser->request($request);
if ($response->is_error()) {print $response->status_line, "\n";}
my $contents = $response->content();
my $tree = HTML::TreeBuilder::XPath->new;
$tree->parse($contents);
$tree->eof;
my @links = $tree->findnodes('//div[@class="fullImageLink"]/a');
my $image_link = $links[0];
my $image_url = $image_link->attr('href');
print "$myFileName[$count]\n$image_url\n\n";
next if $image_url =~ m/$reject1/;
next if $image_url =~ m/$reject2/;
# do stuff with image URL
}
####
Kniro-Lippies V.6 Concept.JPG
http://vignette2.wikia.nocookie.net/crappyfartsgohome/images/b/b3/Kniro-Lippies_V.6_Concept.JPG/revision/latest?cb=20140714143948
Kniro concept thing.png
http://vignette3.wikia.nocookie.net/crappyfartsgohome/images/4/43/Kniro_concept_thing.png/revision/latest?cb=20140714143947
Kniro og.png
http://vignette3.wikia.nocookie.net/crappyfartsgohome/images/3/3e/Kniro_og.png/revision/latest?cb=20140714143946