#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Web::Scraper;
use LWP::UserAgent;
use URI;
use YAML;
$Web::Scraper::UserAgent = LWP::UserAgent->new(keep_alive => 1);
my $data= scraper {
process '//table/tbody/tr/td/a', href => '@href';
}->scrape(URI->new('http://libweb.city.setagaya.tokyo.jp/clis/search?ISBN=9784061317772'));
$data = scraper {
process '//div[strong]', umu => sub {
$_->as_text =~ /所蔵数:(\d+)冊 貸出数:(\d+)冊/;
$1 - $2;
};
}->scrape(URI->new($data->{href}->as_string));
print Dump($data);
[hetappi@lily work]$ perl ./setagaya.pl
---
umu: 3
[hetappi@lily work]$
ISBN10、13、ハイフン有り無し可、Shift_JIS、リクエスト2回、GET 可。