2017-01-27 48 views
1

我目前正試圖讓此查詢只返回結果的第一頁。我目前使用python amazon api,這是我的代碼。試圖只獲得亞馬遜搜索的第一頁結果

#!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 

這工作正常,但返回了非常大量的結果。另一方面,如果我按照其文檔中所述的方式進行操作並添加paginate=False,則不會返回任何結果。

回答

1

挖掘源代碼後,可以通過limit=1獲得頁數