Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Swimsuit issue

by Anonymous Monk
on Feb 26, 2002 at 01:04 UTC ( #147449=CUFP: print w/ replies, xml ) Need Help??

Yeah, the new Sport Illustrated swimsuit issue is out, get your pics while they are hot.

Here is a small script for you, will run fine on any *nix system with wget installed.

#!/usr/bin/perl -w my @names = qw (ana_beatriz audrey bridget chandra ehrinn elsa heidi isabeli josie melissa molly petra shakara vanessa veronica yamila); my $base_url = qq(http://i.cnn.net/si/features/2002/swimsuit/images/ga +llery/); my $suffix = qq(/lg/); my $ext = qq(.jpg); for my $name (@names) { for (1..10) { `wget $base_url$name$suffix$_$ext`; `mv $_$ext $name$_$ext`; } }

enjoy!

Comment on Swimsuit issue
Download Code
•Re: Swimsuit issue
by merlyn (Sage) on Feb 26, 2002 at 01:24 UTC
    Ow ow owww! Why all the forking? Here's what I used for 2002:
    use strict; $|++; use LWP::Simple; my @models = qw( ana_beatriz audrey bridget chandra ehrinn elsa heidi isabeli josie melissa molly petra shakara vanessa veronica yamila ); for my $model (@models) { for my $id (1..15) { my $url = sprintf "http://i.cnn.net/si/features/2002/swimsuit/imag +es/". "gallery/%s/lg/%d.jpg", $model, $id; my $file = "$model-$id.jpg"; print "$url => $file: "; print +mirror($url, $file), "\n"; } }
    And here they are for 2001, still grabbable:
    use strict; $|++; use LWP::Simple; my @models = qw( amy aurelie daniela elsa fernanda heidi josie lujan michelle molly noemie shakara shirley veronica yamila ); for my $model (@models) { for my $id (1..9) { my $url = sprintf "http://sportsillustrated.cnn.com/features/2001/ +swimsuit/gallery/%s/%s_%d_lg.jpg", $model, $model, $id; my $file = "$model-$id.jpg"; print "$url => $file: "; print +mirror($url, $file), "\n"; } }

    -- Randal L. Schwartz, Perl hacker

      Don't really know why, but I found this piece of Perl code very amusing:
      for my $model (@models) { # do stuff... }
      Don't take it as a vulgar comment though ;-)

      "There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith
      Bonus points: clicking on "dl code" and hitting "open from here" will do the work of downloading all them for you.

      I just meant to open the script in my editor, really :-)
      And here it is for 2003:
      use strict; $|++; use LWP::Simple; my @models = qw( may ana_beatriz yamila isabeli bridget melissa noemie juliana marisa petra sarah daniela audrey molly jessica ); for my $model (@models) { for my $id (0..15) { my $url = sprintf "http://s.a.cnn.net/si/features/2003_swimsuit/" +. "images/gallery/popup/%s_%02d.jpg", $model, $id; my $file = "$model-$id.jpg"; print "$url => $file: "; print +mirror($url, $file), "\n"; } }

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        I'd like to propose a patch to avoid looping and fetching girls when you're sure there aren't. Please, read your column on that {grin}. Many thanks to larsen for his cooperation in writing this joke.

        :))) Valerio

        32c32,37 < print +mirror($url, $file), "\n"; --- > if (mirror($url, $file) == RC_NOT_FOUND) { > print "not found\n"; > last; > } else { > print "ok\n"; > }

        update: merlyn is ALWAYS right :)

        And for 2004, only a few minor tweaks needed:
        use strict; $|++; use LWP::Simple; my @models = qw( ana angela bridget carolyn elsa fernanda frankie jessica jessicaw marisa may melissa molly noemie petra veronica yamila ); # http://s.a.cnn.net/si/features/2004_swimsuit/images/gallery/popup/ma +y_03.jpg for my $model (@models) { for my $id (0..15) { my $url = sprintf "http://s.a.cnn.net/si/features/2004_swimsuit/" +. "images/gallery/popup/%s_%02d.jpg", $model, $id; my $file = "$model-$id.jpg"; print "$url => $file: "; print +mirror($url, $file), "\n"; } }

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.


        update: check out the 2005 edition as well.
Re: Swimsuit issue
by illsorted (Scribe) on Feb 27, 2002 at 01:20 UTC
    I thank you, and my roommates thank you! - illsorted
Re: Swimsuit issue
by carthag (Scribe) on Apr 04, 2002 at 16:19 UTC
    Nice job, but perl isn't really necessary at all... Here's one for your standard unix tool curl.
    curl -O "http://i.cnn.net/si/features/2002/swimsuit/images/gallery/{an +a_beatriz,audrey,bridget,chandra,ehrinn,elsa,heidi,isabeli,josie,meli +ssa,molly,petra,shakara,vanessa,veronica,yamila}lg[1-10].jpg"
    although I think the images are gone now. Ah well. *shrugs* :)

    and if we take the updated location into account:
    curl "http://sportsillustrated.cnn.com/features/2002/swimsuit/images/g +allery/{ana_beatriz,audrey,bridget,chandra,ehrinn,elsa,heidi,isabeli, +josie,melissa,molly,petra,shakara,vanessa,veronica,yamila}/lg/[1-10]. +jpg" -o #1_#2.jpg
    which I just tested, and it works fine!
Re: Swimsuit issue
by torin (Sexton) on Apr 04, 2002 at 19:54 UTC
    They are still there, they've just moved to: http://sportsillustrated.cnn.com/features/2002/swimsuit/images/gallery/%s/lg/%d.jpg This should be obvious if you look at Randal's code for 2001.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://147449]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (14)
As of 2014-09-30 14:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (373 votes), past polls