渋谷区立図書館調査

#!/usr/bin/perl
use strict;
use warnings;
use utf8;

use Web::Scraper;
use LWP::UserAgent;
use HTTP::Response::Encoding;
use Encode;
use YAML;
use URI;

my $ua = LWP::UserAgent->new(keep_alive => 1);
$Web::Scraper::UserAgent = $ua;

my $resp = $ua->post(
  'http://www.lib.city.shibuya.tokyo.jp/Asp/Book_Kensaku_w.asp?Page=1',
  content => 'isbn=4-10-353413-3&tos=1&tzn=1&zas=1');
my $data = scraper {
  process '//tr[td/center/text()="○"]/td/a', href => '@href'
}->scrape(decode('sjis', $resp->content));

$resp = $ua->get(
  'http://www.lib.city.shibuya.tokyo.jp/Asp/' . $data->{href});
$data = scraper {
  process '//table[tr/th/center/text()="No"]/tr/td[7]', 'umus[]' => 'text';
}->scrape(decode('sjis', $resp->content));

print Dump $data;
[hetappi@lily work]$ perl ./shibuya.pl
---
umus:
  - ' '
  - ' '
  - ' '
  - ' '
  - ' '
  - ' '
  - 貸出中
  - 貸出中
  - 貸出中
  - 貸出中
  - 貸出中
  - 貸出中
  - 貸出中
  - 貸出中
[hetappi@lily work]$ 

ISBN10 ハイフンあり可、なし、ISBN13 不可、GET 不可、リクエスト2回、Shift_JIS