我想得到amazon的类别,我计划废弃不用API。
我已经取消了http://www.amazon.com,我已经在Shop By Department下拉列表中抓取了所有的类别和子类别,我创建了一个web服务来完成这项工作,代码就在这里@route('/hello')
def hello():
text=list();
link=list();
req = urllib2.Request("http://www.amazon.com",
headers={"Content-Type": "application/json"})
html=urllib2.urlopen(req).read()
soup = BeautifulSoup(html)
last_page = soup.find('div', id="nav_subcats")
for elm in last_page.findAll('a'):
texts = elm.text
links = elm.get('href')
links = links.partition("&node=")[2]
text.append(texts)
link.append(links)
alltext=list();
for i,j in zip(text,link):
alltext.append({"name":i,"id":j})
response.content_type = 'application/json'
print(alltext)
return dumps(alltext)
run(host='localhost', port=8080, debug=True)
我将category name和category id作为JSON对象传递给我的一个成员,以将其传递给API以获取每个类别的产品列表
它是用文字写的爪哇。这里是密码吗
^{pr2}$
但是,当我将类别id作为BrowseNodeId传递,将类别名称作为关键字和搜索索引传递时,会遇到此错误。在For example
Search Index and Keyword -Amazon Instant Video
BrowseNodeId-2858778011
The value you specified for SearchIndex is invalid. Valid values include [ 'All','Apparel',...................................reless','WirelessAccessories' ].
我想知道从哪个亚马逊网址我将得到所有的类别和它的浏览节点
谢谢你