#!/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