Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Swimsuits2010

by merlyn (Sage)
on Feb 09, 2010 at 18:54 UTC ( [id://822254]=note: print w/replies, xml ) Need Help??


in reply to Swimsuits2009
in thread Swimsuits2004

Updated for 2010:
#!/usr/bin/perl use strict; $|++; use LWP::Simple; -d "RESULTS" or mkdir "RESULTS", 0755 or die "cannot mkdir RESULTS: $! +"; my $all_model_index = get "http://sportsillustrated.cnn.com/2010_swims +uit/models/"; while ($all_model_index =~ m{"(/2010[^"]+/)index2\.html"}g) { doit("$1"); } exit 0; my %done; sub doit { my $base = shift; return if $done{$base}++; print "$base =>\n"; my $model_index = get "http://sportsillustrated.cnn.com/$base/index2 +.html"; unless ($model_index) { $model_index = get "http://sportsillustrated.cnn.com/$base/"; } while ($model_index =~ m{\"(http://i.cdn.turner.com/si/pr/subs/swims +uit/images/)([\w.\-]+)_t.jpg\"}g) { my $url = "$1$2.jpg"; my $file = "RESULTS/$2.jpg"; if (-e $file) { print "$url => $file: "; print "skip\n"; } else { print "$url => $file: "; print mirror($url, $file), "\n"; } } }

-- Randal L. Schwartz, Perl hacker

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Replies are listed 'Best First'.
Swimsuits2011
by merlyn (Sage) on Feb 16, 2011 at 10:13 UTC
    And for 2011:
    #!/web/perl use strict; $|++; use LWP::Simple; -d "RESULTS" or mkdir "RESULTS", 0755 or die "cannot mkdir RESULTS: $! +"; my $all_model_index = get "http://sportsillustrated.cnn.com/2011_swims +uit/models/"; while ($all_model_index =~ m{"(/2011[^"]+/)"}g) { doit("$1"); } exit 0; my %done; sub doit { my $base = shift; return if $done{$base}++; print "$base =>\n"; my $model_index = get "http://sportsillustrated.cnn.com/$base/index2 +.html"; unless ($model_index) { $model_index = get "http://sportsillustrated.cnn.com/$base/"; } while ($model_index =~ m{\"(http://i.cdn.turner.com/si/pr/subs/swims +uit/images/)([\w.\-]+)_t.jpg\"}g) { my $url = "$1$2.jpg"; my $file = "RESULTS/$2.jpg"; if (-e $file) { print "$url => $file: "; print "skip\n"; } else { print "$url => $file: "; print mirror($url, $file), "\n"; } } }

    -- Randal L. Schwartz, Perl hacker

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

      And for 2012:
      #!/web/perl use strict; $|++; use LWP::Simple; -d "RESULTS" or mkdir "RESULTS", 0755 or die "cannot mkdir RESULTS: $! +"; my $all_model_index = get "http://sportsillustrated.cnn.com/2012_swims +uit/models/"; while ($all_model_index =~ m{"(/2012[^"]+/)"}g) { doit("$1"); } doit("/2012_swimsuit/painting/$_/") for qw(alex-morgan natalie-coughlin natalie-gulbis); exit 0; my %done; sub doit { my $base = shift; return if $done{$base}++; print "$base =>\n"; # (print "[TEMP SKIPPED]", "\n"), return unless $base =~ /paint/; my $model_index = get "http://sportsillustrated.cnn.com/$base/index2 +.html"; unless ($model_index) { $model_index = get "http://sportsillustrated.cnn.com/$base/"; } while ($model_index =~ m{(\w+)\.html.*?\"(http://i.cdn.turner.com/si +/pr/subs/swimsuit/images/.*?[\w.\-]+)_t.jpg\"}g) { my $url = "$2.jpg"; my $file = "RESULTS/$1.jpg"; if (-e $file) { print "$url => $file: "; print "skip\n"; } else { print "$url => $file: "; print mirror($url, $file), "\n"; } } }

      -- Randal L. Schwartz, Perl hacker

      The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

      ... RESULTS/11_cintia-dicker_41.jpg ...
      Hooray

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://822254]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found