In Japan, people like to set up image boards which are like a simple forum where pretty much anyone can upload a picture. People can also add comments to these pictures. It's a simple and fun system.
People use these image boards to post pictures of all kinds of things, but mostly, they're used to post hotties. (No surprise there, I'm sure.) In this Cool Use For Perl(TM), WWW::Mechanize is used to crawl an image board that specializes in pictures of Sayuri Anzu who is a popular model.
This script will find download all the images posted up on this board on the first run. This script can also be run again at a later date to get new pictures that have been uploaded since the last time the script was run. It's a lot easier than doing right-click, save about 200 times, that's for sure.
#!/usr/bin/perl -w use strict; use WWW::Mechanize; use File::Basename; # load the image board my $mech = WWW::Mechanize->new(); $mech->get("http://uomimi.s3.x-beat.com/imgboard/imgboard.cgi"); # the first page has fewer forms than the rest of the pages. my $which_form = 4; # let's see how deep this goes. do { # get all the image links my @anzu = $mech->find_all_links(url_regex => qr/img-box.*\.jpg$/); foreach (@anzu) { my $filename = basename($_->url); unless (-e $filename) { # download (if we don't have it already) print "$filename\n"; $mech->get($_->url_abs, ':content_file' => $filename); $mech->back(); } else { # quit (if we've already got this) exit 0; } } # go to the next page if ($mech->form_number($which_form)) { $mech->submit; $which_form = 6; } else { $which_form = 0; } # repeat until we can't go any further } until ($which_form == 0); # vim:sts=2 sw=2 expandtab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |