Amazon search returns only 10 items

I am trying to get information about books from Amazon and pass on this information. to my own web application. The problem is that she returned only 10 results. How can I get results after the first 10?

+3
source share
1 answer

I assume that you are using the ItemSearch operation from the Amazon Advertising Advertising API.

Your request should look like this:

http://ecs.amazonaws.com/onca/xml?
Service=AWSECommerceService&
AWSAccessKeyId=[AWS Access Key ID]&
Operation=ItemSearch&
Keywords=Edward%20Tufte&
SearchIndex=Books
&Timestamp=[YYYY-MM-DDThh:mm:ssZ]
&Signature=[Request Signature]

This should return an answer that looks like this:

<TotalResults>132</TotalResults>
<TotalPages>14</TotalPages>
<Item>
  <ASIN>...</ASIN>
  <DetailPageURL>...</DetailPageURL>
  <ItemAttributes>...</ItemAttributes>
</Item>
<Item>
  <ASIN>...</ASIN>
  <DetailPageURL>...</DetailPageURL>
  <ItemAttributes>...</ItemAttributes>
</Item>
<Item>
  <ASIN>...</ASIN>
  <DetailPageURL>...</DetailPageURL>
  <ItemAttributes>...</ItemAttributes>
</Item>
...

ItemSearch ; 1-10 ( 1). , . Amazon ItemSearch , itemPage.

sudo, "Edward Tufte", Amazon ( 400 ):

keywords="Edward Tufte"

# itemSearch will create the Amazon Product Advertising request
response=itemSearch(Keywords=keywords, SearchIndex="Books")
# Do whatever you want with the response for the first page
...

# getTotalPagesFromResponse will parse the XML response and return the totalPages
# (14 in the above example). 
totalPages = getTotalPagesFromResponse(response)
If totalPages > 1
  # Note that you cannot go beyond 400 pages (see [1])
  # Or you can limit yourself to a smaller number of pages
  totalPages=min(400,totalPages)

  page=2
  while page < totalPages
    response=itemSearch(Keywords=keywords, SearchIndex="Books", ItemPage=page)
    # Do whatever you want with the response
    ...
    page=page+1

: [1] ProductSearch Amazon ( http://docs.amazonwebservices.com/AWSECommerceService/2010-11-01/DG/ItemSearch.html)

+3

Source: https://habr.com/ru/post/1739947/


All Articles