nadermx
nadermx

Reputation: 2776

Trying to get only first page results of amazon search

I'm currently trying to have this query only return the first page of the results. I'm currently using python amazon api and this is my code.

#!python

api = API(cfg=config.amzconfig)

query='justin bieber'
thingy = api.item_search('Blended', ResponseGroup='Large', Keywords=query)
print(thingy)
for thing in thingy:
    # print(lxml.etree.tostring(item, pretty_print=True))
    try:
        print('%s' % thing.ItemAttributes.Title)
        print('%s' % thing.DetailPageURL)
        print('%s' % thing.SmallImage.URL)
    except:
        continue

This works fine, but returns a really large amount of results. On the other hand if I do as it says in their documentation and add in paginate=False it returns no results.

Upvotes: 1

Views: 231

Answers (1)

nadermx
nadermx

Reputation: 2776

After digging through the source, you can put a limit=1 to get the number of pages

Upvotes: 1

Related Questions