#!/usr/local/bin/ruby # cachebib_simple.rb # ver.0.2 2003.01.05-2003.01.07 # cachebib系の各書店用class # 正規な書店解析でなく、エラーを吐かせない程度の間に合せ # ※url_bibinfo(=url_isbnsearch)の定義のみ # 例えば、bookstore_x.rbをbookstore.rb程度に利用したい場合はこれで充分 =begin CacheBib_amazon CacheBib_bk1 CacheBib_yahoo CacheBib_asahiya CacheBib_jbook CacheBib_kinokuniya CacheBib_rakuten CacheBib_skysoft CacheBib_amazon_com CacheBib_a1books CacheBib_powells CacheBib_maruzen CacheBib_amazon_uk CacheBib_bookshop CacheBib_esbooks CacheBib_boople CacheBib_webcatplus CacheBib_rcom CacheBib_blogmap CacheBib_reviewlink =end #別解 #require 'cache' #require 'cachebib' #class CacheBib_simple < CacheBib #の方が良いかもしれないが、ここは簡便性を重視 #余計な中間ファイル関係(ダミーcache-file等)が出ない事も理由の一つ class CacheBib_simple attr_accessor :isbn, :affiliate_code, :shop_id attr_accessor :expire, :expire_full, :cache_dir attr_accessor :flag_read, :flag_save, :flag_net def get_data ( isbn, mode = nil ) @isbn = isbn return {'isbn'=>@isbn} end def url_bibinfo return nil end def word_delivery return ['x', 'over'] end def set_cache_id ( isbn ) end def read_cache ( file ) end def save_cache end def expire_over? return false end end # 通常 unless defined?(CacheBib_amazon) class CacheBib_amazon < CacheBib_simple def url_bibinfo return 'http://www.amazon.co.jp/exec/obidos/ASIN/' + @isbn.delete('-') + '/' + @affiliate_code.to_s + '/ref=nosim' end end end unless defined?(CacheBib_bk1) class CacheBib_bk1 < CacheBib_simple def url_bibinfo bk1_id = @affiliate_code.nil? ? '' : 'aid=' + @affiliate_code.to_s + '&' return 'http://www.bk1.co.jp/cgi-bin/srch/srch_result_book.cgi?' + bk1_id + 'idx=3&isbn=' + @isbn end end end unless defined?(CacheBib_yahoo) class CacheBib_yahoo < CacheBib_simple def url_bibinfo return 'http://books.yahoo.co.jp/bin/search_key?pp=3&p=' + @isbn end end end unless defined?(CacheBib_asahiya) class CacheBib_asahiya < CacheBib_simple def url_bibinfo return 'http://www.netdirect.co.jp/search/ISSSchDetail.asp?ISBN=' + @isbn.delete('-') end end end unless defined?(CacheBib_jbook) class CacheBib_jbook < CacheBib_simple def url_bibinfo return 'http://www.jbook.co.jp/product.asp?isbn=' + @isbn.delete('-') end end end unless defined?(CacheBib_kinokuniya) class CacheBib_kinokuniya < CacheBib_simple def url_bibinfo if @isbn =~ /^0/ return 'http://bookweb.kinokuniya.co.jp/guest/cgi-bin/booksea.cgi?ISBN=' + @isbn.delete('-') else return 'http://bookweb.kinokuniya.co.jp/guest/cgi-bin/wshosea.cgi?W-ISBN=' + @isbn.delete('-') end end end end unless defined?(CacheBib_rakuten) class CacheBib_rakuten < CacheBib_simple def url_bibinfo rakuten_id = @affiliate_code.nil? ? '' : 'http://pt.afl.rakuten.co.jp/c/' + @affiliate_code + '/?url=' return rakuten_id + 'http://books.rakuten.co.jp/bsearch/RBtitles.jsp?KEY=' + @isbn end end end unless defined?(CacheBib_skysoft) class CacheBib_skysoft < CacheBib_simple def url_bibinfo if @isbn =~ /^0/ return 'http://www.skysoft.co.jp/GetTitleDetail.asp?C=2&ISBN=' + @isbn.delete('-') else return 'http://www.skysoft.co.jp/GetTitleDetail.asp?ISBN=' + @isbn end end end end # ISBN0 unless defined?(CacheBib_amazon_com) class CacheBib_amazon_com < CacheBib_simple def url_bibinfo return 'http://www.amazon.com/exec/obidos/ASIN/' + @isbn.delete('-') + '/' end end end unless defined?(CacheBib_a1books) class CacheBib_a1books < CacheBib_simple def url_bibinfo return 'http://www.a1books.com/cgi-bin/a1Search?searchBy=isbn&searchStr=' + @isbn.delete('-') end end end unless defined?(CacheBib_powells) class CacheBib_powells < CacheBib_simple def url_bibinfo return 'http://www.powells.com/search/DTSearch/search?isbn=' + @isbn.delete('-') end end end unless defined?(CacheBib_maruzen) class CacheBib_maruzen < CacheBib_simple def url_bibinfo return 'http://www.maruzen.co.jp/cgi-bin/cgirelay/mis-ir-y1?isbn-1=' + @isbn.delete('-') end end end # ISBN1 unless defined?(CacheBib_amazon_uk) class CacheBib_amazon_uk < CacheBib_simple def url_bibinfo return 'http://www.amazon.co.uk/exec/obidos/ASIN/' + @isbn.delete('-') end end end unless defined?(CacheBib_bookshop) class CacheBib_bookshop < CacheBib_simple def url_bibinfo return 'http://www.bookshop.co.uk/ser/serpge.asp?I=' + @isbn.delete('-') end end end # 他 unless defined?(CacheBib_esbooks) class CacheBib_esbooks < CacheBib_simple def url_bibinfo return 'http://www.esbooks.co.jp/search?isbn=' + @isbn end end end unless defined?(CacheBib_boople) class CacheBib_boople < CacheBib_simple def url_bibinfo return 'http://www.boople.com/servlet/AFsearch?iis=' + @isbn.delete('-') end end end unless defined?(CacheBib_webcatplus) class CacheBib_webcatplus < CacheBib_simple def url_bibinfo return 'http://webcatplus.nii.ac.jp/assoc.cgi?mode=equal0&isbn=' + @isbn end end end unless defined?(CacheBib_rcom) class CacheBib_rcom < CacheBib_simple def url_bibinfo return 'http://popup7.tok2.com/home2/tanoshii/r_com/hq.htm' end end end unless defined?(CacheBib_blogmap) #-----blogmap----- class CacheBib_blogmap < CacheBib_simple def url_bibinfo return 'http://bm.ishinao.net/detail.html/' + @isbn.delete('-') end end end unless defined?(CacheBib_reviewlink) #-----書評リンク----- class CacheBib_reviewlink < CacheBib_simple require 'cgi' attr_accessor :url, :url_head, :flag_refer def get_data ( isbn, mode = nil ) @isbn = isbn return {'isbn'=>@isbn, 'reviewer'=>@affiliate_code, 'url'=>@url} end def url_bibinfo url = 'http://ippo.s5.xrea.com/x/rl/index.cgi?cmd=book&code=ISBN' + isbn.delete('-').upcase if @flag_refer url << "&reviewer=#{CGI.escape(@affiliate_code.toeuc)}" unless @affiliate_code.nil? url << "&url=#{CGI.escape(@url_head + @url)}" if !@url.nil? && !@url_head.nil? end return url end def tag tags = [] tags << "ISBN#{@isbn}" tags << "reviewer=#{@affiliate_code}" unless @affiliate_code.nil? tags << "url=#{@url}" tag_info = tags.join(":") return '' end end end if __FILE__ == $0 liststr =<