Amazon ECS API to fetch 1000 top selling books

前端 未结 4 355
感动是毒
感动是毒 2020-12-29 13:14

I need the API to fetch the top selling books on Amazon. By default it only fetches the top 10 items, but I need more than 10, near about 1000 items content by using single

4条回答
  •  礼貌的吻别
    2020-12-29 13:47

    here's how I do it - but it won't work for more than 100 items after the end of this month as Amazon are limiting ItemPage to 10.

    rescheck = Amazon::Ecs.item_search("search term here", :response_group => 'Large', :country => 'uk')
    n=0
    rescheck.total_pages.times do |n|
      n=n+1
      if n <= rescheck.total_pages
          res = Amazon::Ecs.item_search("search term here", :response_group => 'Large', :item_page =>n, :country => 'uk')
            res.items.each do |item|
    
              asin = item.get('ASIN')
              title = item.get('ItemAttributes/Title')
              brand = item.get('ItemAttributes/Brand')
    
     #etc
    

提交回复
热议问题