#!/opt/local/bin/perl # # # http://www.perl.com/pub/a/2006/06/01/fear-api.html # # usage: # perl shokotan-get.pl > list.txt && wget --no-directories -i list.txt use strict; use warnings; use WWW::Mechanize; use Encode qw/encode decode/; my $shokotan_url = 'http://yaplog.jp/strawberry2/'; my $mech = WWW::Mechanize->new(); &extract_shokotan_shamail($mech, $shokotan_url); sub extract_shokotan_shamail { my ($mech, $url) = @_; $mech->get($url); foreach ($mech->images) { if ($_->url() =~ /\/img\/[\d]+\/[\d_]+\.jpg$/) { print $_->url_abs() . "\n"; } } foreach ($mech->links) { my $mae = decode("utf8", '前へ'); if ($_->url() =~ /\/strawberry2\/\d+$/ && decode("sjis", $_->text()) =~ /$mae/) { &extract_shokotan_shamail($mech, $_->url_abs()); } } } exit;