Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Who can help me write a perl script to extract the pictures out of this webpage? (http://www.velocityreviews.com/forums/t890805-who-can-help-me-write-a-perl-script-to-extract-the-pictures-out-of-this-webpage.html)

Glory Regained 02-13-2005 12:37 PM

Who can help me write a perl script to extract the pictures out of this webpage?
 
http://www.pierluigisurace.it/imagerie/aatw0016.htm

I like the pictures so much, but my Perl tricks are few.

Thanks in advance.




Gregory Toomey 02-13-2005 12:50 PM

Re: Who can help me write a perl script to extract the pictures out of this webpage?
 
Glory Regained wrote:

> http://www.pierluigisurace.it/imagerie/aatw0016.htm
>
> I like the pictures so much, but my Perl tricks are few.
>
> Thanks in advance.


Far easier would be to mirror it using wget:
http://www.gnu.org/software/wget/wget.html

gtoomey

Glory Regained 02-13-2005 01:43 PM

Re: Who can help me write a perl script to extract the pictures out of this webpage?
 
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";






"Glory Regained" <mygloryregained@hotm@il.com> wrote in message
news:cung54$net$1@mawar.singnet.com.sg...
> http://www.pierluigisurace.it/imagerie/aatw0016.htm
>
> I like the pictures so much, but my Perl tricks are few.
>
> Thanks in advance.
>
>
>




Sea Seagle 02-14-2005 02:13 AM

Re: Who can help me write a perl script to extract the pictures out of this webpage?
 
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.




"Gregory Toomey" <nospam@bigpond.com> wrote in message
news:3790noF581qbsU2@individual.net...
> Glory Regained wrote:
>
> > http://www.pierluigisurace.it/imagerie/aatw0016.htm
> >
> > I like the pictures so much, but my Perl tricks are few.
> >
> > Thanks in advance.

>
> Far easier would be to mirror it using wget:
> http://www.gnu.org/software/wget/wget.html
>
> gtoomey




Sea Seagle 02-14-2005 02:32 AM

Re: Who can help me write a perl script to extract the pictures out of this webpage?
 
Done. I just put binary and DLL file in same directory and it worked.

Thank you anyway.









"Sea Seagle" <SeaSeagle@hotmail.com> wrote in message
news:4210081f$1@news.starhub.net.sg...
> 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.
>
>
>
>
> "Gregory Toomey" <nospam@bigpond.com> wrote in message
> news:3790noF581qbsU2@individual.net...
> > Glory Regained wrote:
> >
> > > http://www.pierluigisurace.it/imagerie/aatw0016.htm
> > >
> > > I like the pictures so much, but my Perl tricks are few.
> > >
> > > Thanks in advance.

> >
> > Far easier would be to mirror it using wget:
> > http://www.gnu.org/software/wget/wget.html
> >
> > gtoomey

>
>




Keith Keller 02-14-2005 04:23 AM

Re: Who can help me write a perl script to extract the pictures out of this webpage?
 
[TOFU snipped]

On 2005-02-14, Sea Seagle <SeaSeagle@hotmail.com> wrote:
>
> 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


--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information



All times are GMT. The time now is 11:44 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.