Something meaningful with the Amazon BrowseNodes API

I have a website (www.7bks.com) where people create lists of books. This is pretty simple at the moment. I already use the Amazon API to display book information, images, etc. To the website.

What I would like to do is use the Amazon API to display categories and / or tag data in order to create some way to view the listings on my site. Unfortunately, the tag api method has been terminated.

The most likely candidate is the Amazon BrowseNodes API method (http://docs.amazonwebservices.com/AWSEcommerceService/2005-10-05/ApiReference/BrowseNodesResponseGroup.html), but the data returned from this call is pretty pointless and I hoped that we we can unite our heads and find out how to understand this.

Here's a google spreadsheet to show you the data that I get. I selected a sample list (http://www.7bks.com/list/549002) and completed three books through the BrowseNodes API:

https://spreadsheets.google.com/ccc?key=0ApVjkgehRamudHd5SlNhYllPQkZDSDY1cllfQVBQM1E&hl=en&authkey=CN_MxoAO

Looking at the list as a person, you do not need to know what books are to see that it is probably a list about Sci-Fi and Fantasy. This is mainly because the eye is good at dropping meaningless categories such as "custom stores" and "fiction complete."

I tried to reset the list of categories or just looked at the categories that appear for all 3 books, but still pretty shitty data. I would like your thoughts on how I can turn this data into something meaningful for users.

, , . - :

( " " ) > 3, ( "- " ) > 3, -

.

, /.

.

, , API, Python/Appengine/Webapp.

Tom

. , python, , . , - .

, , : 1) XML node node, ( > ), , . . : http://www.amazon.co.uk/Surface-Detail-Iain-M-Banks/dp/1841498939/ " ". . 2) , , ( > ). , 3) , , , .

, , :

#takes as input the xml output of the amazon api browsenodes call
def getcategories(xml):
    #fetches the names of all the nodes, stores them in a list
    categories = []              
    for book in xml.getElementsByTagName('BrowseNode'):
        category = get_text(book,'Name')
        categories.append(category)

    #turn the one list into a series of individual lists
    #each individual list should be a particular tree from browsenode
    #each list will end 'Books'
    #the first item in the list should be the bottom of the tree
    taglists = []
    while 'Books' in categories:
        find = categories.index('Books') + 1
        list = categories[:find]
        taglists.append(list)
        for word in list:
            categories.remove(word)

    #now, we only return the first item from a list which contains 'Subjects'        
    final = []    
    for tagset in taglists:
        while 'Subjects' in tagset:
            final.append(tagset[0])
            tagset.pop(tagset.index('Subjects'))
    return final

class Browsenodes(webapp.RequestHandler):
    def get(self):
        #get the asin of the target book
        asin = self.request.get('term')
        if book_title:
            #fetch the amazon key
            api = API(AWS_KEY, SECRET_KEY, 'uk', processor=minidom_response_parser)
            try:
                #try getting a list of similar books - note the response group set to browsenodes
                result = api.similarity_lookup(asin, ResponseGroup='BrowseNodes')
            except:
                #there aren't always a list of similar books, so as a failsafe just get the book I wanted.
                result = api.item_lookup(asin, ResponseGroup='BrowseNodes')
            final = getcategories(result)
            #turn it into a set to de-dupe multiple listings of the same category
            self.response.out.write(set(final))

:

: http://www.amazon.co.uk/Surface-Detail-Iain-M-Banks/dp/1841498939/

:

http://www.amazon.co.uk/Godel-Escher-Bach-Eternal-anniversary/dp/0140289208/ AAS , : 1900-

http://www.amazon.co.uk/Flatland-Romance-Dimensions-Dover-Thrift/dp/048627263X/ AAS , : 1900-

http://www.amazon.co.uk/Victoria-Condor-Books-Knut-Hamsun/dp/0285647598/ AAS

+3
2

, , . - :

( " " ) > 3, sci fi, ( "- " ) > 3, -

, ? Amazon . , .

, , dc: subject API Google Book? ( , ).

+2

Hum.. , curent APi 2011-08-01. , , ? API

XML !

, , , XML XML- , .

:

  <BrowseNodes>
    <BrowseNode>...</BrowseNode>
      <BrowseNode>...</BrowseNode>
      <BrowseNode>...</BrowseNode>
      <BrowseNode>...</BrowseNode>
    </BrowseNodes>

BrowseNode :

<BrowseNode>
      <BrowseNodeId>10399</BrowseNodeId>
      <Name>Classics</Name>
      <Ancestors>
        <BrowseNode>
          <BrowseNodeId>17</BrowseNodeId>
          <Name>Literature &amp; Fiction</Name>
          <Ancestors>
            <BrowseNode>
              <BrowseNodeId>1000</BrowseNodeId>
              <Name>Subjects</Name>
              <IsCategoryRoot>1</IsCategoryRoot>

"IsCategoryRoot"? , , , . "" , "" , , "IsCategoryRoot".

100%, , python, ... ASIN ( , , amazon.Com, , co.uk, Fr, de ..), , , , , BrowseNode, BrowseNodeID ASIN, ( ), . , , , , .

, , .

, .

, , . , .

0

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


All Articles