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

Discussion in 'Perl Misc' started by Glory Regained, Feb 13, 2005.

  1. Glory Regained, Feb 13, 2005
    #1
    1. Advertising

  2. Gregory Toomey, Feb 13, 2005
    #2
    1. Advertising

  3. 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@> wrote in message
    news:cung54$net$...
    > http://www.pierluigisurace.it/imagerie/aatw0016.htm
    >
    > I like the pictures so much, but my Perl tricks are few.
    >
    > Thanks in advance.
    >
    >
    >
    Glory Regained, Feb 13, 2005
    #3
  4. Glory Regained

    Sea Seagle Guest

    Sea Seagle, Feb 14, 2005
    #4
  5. Glory Regained

    Sea Seagle Guest

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

    Thank you anyway.









    "Sea Seagle" <> wrote in message
    news:4210081f$...
    > 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" <> wrote in message
    > news:...
    > > 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, Feb 14, 2005
    #5
  6. Glory Regained

    Keith Keller Guest

    [TOFU snipped]

    On 2005-02-14, Sea Seagle <> 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


    --
    -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
    Keith Keller, Feb 14, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,767
  2. Ryan Haskell
    Replies:
    6
    Views:
    7,908
    Ryan Haskell
    Jun 25, 2004
  3. Martin Raychev
    Replies:
    1
    Views:
    273
    Alvin Bruney [MVP]
    Mar 2, 2004
  4. plb

    extract list from webpage

    plb, Jul 25, 2003, in forum: Perl Misc
    Replies:
    5
    Views:
    130
  5. Fiaz Idris
    Replies:
    13
    Views:
    1,696
    ifiaz
    Mar 17, 2005
Loading...

Share This Page