in reply to I keep getting "b/bc/Wiki.png" instead of the actual thing I want
OUTPUT:use HTML::TreeBuilder::XPath; # ... for my $count ( 0 .. 417 ) { my $url = "http://crappyfartsgohome.wikia.com/wiki/File:".$myFileN +ame[$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 }
Note that I changed $reject1 to 'OKAY_I_SERIOUSLY_CANNOT.png'Kniro-Lippies V.6 Concept.JPG http://vignette2.wikia.nocookie.net/crappyfartsgohome/images/b/b3/Knir +o-Lippies_V.6_Concept.JPG/revision/latest?cb=20140714143948 Kniro concept thing.png http://vignette3.wikia.nocookie.net/crappyfartsgohome/images/4/43/Knir +o_concept_thing.png/revision/latest?cb=20140714143947 Kniro og.png http://vignette3.wikia.nocookie.net/crappyfartsgohome/images/3/3e/Knir +o_og.png/revision/latest?cb=20140714143946
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: I keep getting "b/bc/Wiki.png" instead of the actual thing I want
by Nyro46 (Initiate) on Apr 07, 2016 at 01:01 UTC | |
by james28909 (Deacon) on Apr 07, 2016 at 01:14 UTC | |
by Nyro46 (Initiate) on Apr 07, 2016 at 01:26 UTC | |
by GrandFather (Saint) on Apr 07, 2016 at 02:34 UTC | |
by Nyro46 (Initiate) on Apr 07, 2016 at 02:37 UTC | |
|