出版社で検索するプログラム
ソース
publisherに日経BP社を設定して検索し1ページを表示する。
require 'rubygems' require 'amazon/ecs' Amazon::Ecs.options = { :aWS_access_key_id => ["ここにアクセスキーIDを設定"], :associate_tag => "ここにアソシエイトIDを設定", :country => :jp } #デバッグを有効、アクセスURLが表示される #Amazon::Ecs.debug = true page = 1 res = Amazon::Ecs.item_search('',{:item_page => page, :response_group => 'Medium', :publisher => '日経BP社'}) print "res.is_valid_request? : #{res.is_valid_request?}\n" print "res.has_error? : #{res.has_error?}\n" print "res.error :" #{res.error}\n" print "res.total_pages : #{res.total_pages}\n" print "res.total_results : #{res.total_results}\n" print "res.item_page : #{res.item_page}\n" print "res.items.size : #{res.items.size}\n" res.items.each do |item| print "asin : #{item.get('asin')}\n" print "itemattributes/title : #{item.get('itemattributes/title')}\n" atts = item.search_and_convert('itemattributes') print "title : #{atts.get('title')}\n" print "author : #{atts.get('author')}\n" print "publisher : #{atts.get('publisher')}\n" end
グラムの実行結果
res.is_valid_request? : true res.has_error? : false res.error :res.total_pages : 273 res.total_results : 2723 res.item_page : 1 res.items.size : 10 asin : 4822246280 itemattributes/title : ETF投資入門 上場投信・徹底活用ガイド title : ETF投資入門 上場投信・徹底活用ガイド author : 太田 創 publisher : 日経BP社 asin : 4822232581 itemattributes/title : カノウユミコの野菜がおいしい!一生ものレシピ (日経BPムック) (日経BPムック) title : カノウユミコの野菜がおいしい!一生ものレシピ (日経BPムック) (日経BPムック) author : 日経ヘルス publisher : 日経BP社 asin : 4822740315 itemattributes/title : ビジョナリー・カンパニー ― 時代を超える生存の原則 title : ビジョナリー・カンパニー ― 時代を超える生存の原則 author : ジェームズ・C. コリンズ publisher : 日経BP社 asin : 4822242633 itemattributes/title : ビジョナリー・カンパニー 2 - 飛躍の法則 title : ビジョナリー・カンパニー 2 - 飛躍の法則 author : ジェームズ・C. コリンズ publisher : 日経BP社 asin : 4822246418 itemattributes/title : 資本主義と自由 (NIKKEI BP CLASSICS) title : 資本主義と自由 (NIKKEI BP CLASSICS) author : ミルトン・フリードマン publisher : 日経BP社 asin : 4822246671 itemattributes/title : 市場リスク 暴落は必然か title : 市場リスク 暴落は必然か author : リチャード・ブックステーバー publisher : 日経BP社 asin : B001987C9Y itemattributes/title : 日経 Health premie (ヘルス プルミエ) 2008年 07月号 [雑誌] title : 日経 Health premie (ヘルス プルミエ) 2008年 07月号 [雑誌] author : publisher : 日経BP社 asin : B001987C9O itemattributes/title : 日経ソフトウエア 2008年 07月号 [雑誌] title : 日経ソフトウエア 2008年 07月号 [雑誌] author : publisher : 日経BP社 asin : 4822216462 itemattributes/title : 70分DVD付き 体の中からキレイになる 龍村修のヨガ教室 title : 70分DVD付き 体の中からキレイになる 龍村修のヨガ教室 author : 龍村 修 publisher : 日経BP社 asin : 4822245217 itemattributes/title : 頭のよい子が育つ家 title : 頭のよい子が育つ家 author : 四十万 靖 publisher : 日経BP社