Who can help me write a perl script to extract the pictures out of this webpage?

G

Glory Regained

Well, done with it anyway. You may put a wait statement in order not to
overburden the server.




#!/usr/bin/perl
use Win32::Internet;

$base_url = "http://www.pierluigisurace.it/imagerie/";
$base_main = "http://www.pierluigisurace.it/imagerie/aatw";
@https = <FIL1>;
close(FIL1);

$INET = new Win32::Internet();
$fl = 0;
$j = 1000000;
for($i = 0; $i <= 88; $i++) {
$frag = "00" . $i . ".htm";
if ($i < 10) {
$frag = "000" . $i . ".htm";
}
if ($i == 0) {
$frag = ".htm";
}

$html = $base_main . $frag;
$file = $INET->FetchURL($html);

@urls = split("<td align=\"left\" width=\"16%\"><A HREF=\"", $file);
foreach $url (@urls) {
if ( substr($url, 0, 12) eq "images/aatw/" ) {
# Take an etiquette nap here. :)
@reals = split("jpg", $url);
$JPG = @reals[0] . "jpg";
$JPG = $base_url . $JPG;
$file1 = $INET->FetchURL($JPG);
@JPGS = split("aatw/", $JPG);
$fn = "./images/aatw/" . $j . "_" . @JPGS[1];
$j = $j + 1;
open(DAT, ">./$fn");
binmode DAT;
print DAT ($file1);
close(DAT);
$fl = $fl + length($file1) / 1024;
if ( $fl > (4*1024*1024) ) { # My harddisk has no space now :(
print ($JPG . " Finished, total of $fl KB, now it is on Page No. $i\n")
;
exit;
}
print ($JPG . " Finished, total of $fl KB\n") ;
}
}
}
print "All Done \n";
 
S

Sea Seagle

Thank you Toomey.

I downloaded wget-1.8.2 and it's in my C:\Perl directory now.
How may I install it?
The configure.bat doesn't work.
 
S

Sea Seagle

Done. I just put binary and DLL file in same directory and it worked.

Thank you anyway.
 
K

Keith Keller

[TOFU snipped]

I downloaded wget-1.8.2 and it's in my C:\Perl directory now.
How may I install it?
The configure.bat doesn't work.

Installing wget is not related to Perl. I suggest you ask on a wget
mailing list/newsgroup what to do. (Hint: you probably need cygwin,
which is also off-topic for this newsgroup.)

--keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top