ruby Amazon API和精装本与平装本

r9f1avp5  于 2023-03-01  发布在  Ruby
关注(0)|答案(2)|浏览(94)

当使用他们的API搜索亚马逊时,有没有办法区分精装书、平装书、Kindle和预购书?
我正在使用Ruby和Amazon Product gem,并一直在搜索他们的文档,寻找这方面的信息,但还没有找到任何东西。
我遇到了一些我正在努力解决的起点。似乎有一种方法可以通过这里描述的RrelatedItems ResponseGroup获得这些信息。KindleStore层次结构似乎相关。
绑定可能是我需要关注的领域,亚马逊的API提供了一种使用图书的AlternativeVersion ResponseGroup类型访问ASIN的AlternativeVersions的方法。

jq6vz3qz

jq6vz3qz1#

我将假设您知道如何正确设置Amazon Product Gem请求对象。从那里,您可以做...

search = req.search( 'Ender\'s Game' )
search.each('Item') do |item|
  asin = item["ASIN"]
  title = item['ItemAttributes']['Title']
  hash = {
    :response_group => ['ItemAttributes']
    }
  items = req.find( asin, hash )
  items.each('Item') do |ia|
    puts "[#{asin}]: #{title} => [#{ia['ItemAttributes']['Binding']}]"
  end
end

其产生如下输出

[0812550706]: Ender's Game (Ender, Book 1) => [Mass Market Paperback]
[0765362430]: The Ender Quartet Box Set: Ender's Game, Speaker for the Dead, Xenocide, Children of the Mind => [Mass Market Paperback]
[0812550757]: Speaker for the Dead (Ender, Book 2) => [Mass Market Paperback]
[0765342405]: Ender's Shadow (Ender, Book 5) => [Paperback]
[B003G4W49C]: Ender's Game => [Kindle Edition]
[0785135820]: Ender's Game: Command School => [Hardcover]
[0785135804]: Ender's Game: Battle School (Ender's Game Gn) => [Hardcover]
[0765362449]: The Ender's Shadow Series Box Set: Ender's Shadow, Shadow of the Hegemon, Shadow Puppets, Shadow of the Giant => [Paperback]
[0785136096]: Ender's Game: Formic Wars: Burning Earth => [Hardcover]
[0812565959]: Shadow of the Hegemon (Ender, Book 6) => [Mass Market Paperback]
pgx2nnw8

pgx2nnw82#

你可以试着看看BrowseNodes,比如如果你看到kindle store BrowseNode,你就知道这是一本kindle的书。

相关问题