java - find amazon categories using python -


i categories of amazon ,i planning scrap not use api. have scrapped http://www.amazon.com.i have scraped categories , sub-categories under shop department drop down .i have created web service code here

@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")     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();     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) 

i passing category name , category id json object 1 of members pass api product listing each category

it written in java.here code

for (int pageno = 1; pageno <= 10; pageno++) {             string page = string.valueof(pageno);             string category_string = selectedoption.get("category_name").tostring();             string category_id = selectedoption.get("category_id").tostring();             final map<string, string> params = new hashmap<string, string>(3);             params.put(amazonclient.op.param_operation, "itemsearch");             params.put("searchindex", category_string);             params.put("browsenodeid", category_id);             params.put("keywords", category_string);             params.put("itempage", page);             system.out.println(client.documenttostring(client.getxml(params)));             documentbuilderfactory dbf = documentbuilderfactory.newinstance();             document doc = null;             documentbuilder db = dbf.newdocumentbuilder();             inputstream = client.getinputstream(params);              doc = db.parse(is);             nodelist itemlist = doc.getelementsbytagname("items"); 

but getting error when pass category id browsenodeid , category name keyword , search index.

 example      search index , keyword -amazon instant video      browsenodeid-2858778011  value specified searchindex invalid. valid values include [ 'all','apparel',...................................reless','wirelessaccessories' ]. 

i know amazon url categories , browse nodes

thank you

i have never looked @ amazon's api before, guess but, based on error message seem "amazon instant video" not valid search index. because there in drop-down list, doesn't mean valid search index.

here's list of search indices us: http://docs.aws.amazon.com/awsecommerceservice/latest/dg/ussearchindexparamforitemsearch.html . don't know how date is, "amazon instant video" not appear on list. error message include list of valid search index values, , these appear correspond above list.

for other locales here : http://docs.aws.amazon.com/awsecommerceservice/latest/dg/appndx_searchindexparamforitemsearch.html

i don't think coding problem per se.

you might take @ python-amazon-product-api. api might useful you, , documentation might give ideas.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -