Created
July 31, 2012 21:23
-
-
Save mh61503891/3220711 to your computer and use it in GitHub Desktop.
OPAC所蔵確認スクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! ruby | |
# -*- coding: utf-8 -*- | |
# OPAC所蔵確認スクリプト | |
# Usage :: $ cat isbn-keyword-list.txt | ruby opac.rb | |
# Author :: Masayuki Higashino | |
# Note :: 本スクリプトは某サイト専用です。OPACのインタフェースはWebサイ | |
# トによって異なるので某サイト以外では使えません。 | |
# | |
# CONFIG | |
OPAC_URL = 'http://www.example.net/cgi-bin/opc/seek.cgi' | |
require 'open-uri' | |
def exists?(keyword) | |
html = open(OPAC_URL + '?fword=' + keyword){|f|f.read} | |
html !~ /検索に該当する書誌情報はありませんでした/ | |
end | |
while line = gets | |
keyword = line.strip | |
puts "#{keyword}\t#{exists?(keyword)?'あり':'なし'}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment