Skip to content

Instantly share code, notes, and snippets.

@mh61503891
Created July 31, 2012 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mh61503891/3220711 to your computer and use it in GitHub Desktop.
Save mh61503891/3220711 to your computer and use it in GitHub Desktop.
OPAC所蔵確認スクリプト
#! 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