如何通过 ASIN 从亚马逊检索所有图书类别?

How to retrieve all book categories from Amazon by ASIN?

谁能告诉我如何通过 ASIN 从一本书中检索类别列表,例如 this website does

为此使用亚马逊产品广告 API v5。使用 ASIN(例如 1641521198)作为 ItemsId 创建一个 GetItems 请求,并请求 BrowserNoteInfo.BrowserNodes 和 BrowserNoteInfo.BrowserNodes.Ancestor 作为资源.

响应如下所示:

{
 "ItemsResult": {
  "Items": [
   {
    "ASIN": "1641521198",
    "BrowseNodeInfo": {
     "BrowseNodes": [
      {
       "Ancestor": {
        "Ancestor": {
         "Ancestor": {
          "Ancestor": {
           "ContextFreeName": "Books",
           "DisplayName": "Books",
           "Id": "283155"
          },
          "ContextFreeName": "Subjects",
          "DisplayName": "Subjects",
          "Id": "1000"
         },
         "ContextFreeName": "Cookbooks, Food & Wine",
         "DisplayName": "Cookbooks, Food & Wine",
         "Id": "6"
        },
        "ContextFreeName": "Baking",
        "DisplayName": "Baking",
        "Id": "4196"
       },
       "ContextFreeName": "Bread Baking",
       "DisplayName": "Bread",
       "Id": "4197",
       "IsRoot": false
      },
      {
       "Ancestor": {
        "Ancestor": {
         "Ancestor": {
          "Ancestor": {
           "ContextFreeName": "Books",
           "DisplayName": "Books",
           "Id": "283155"
          },
          "ContextFreeName": "Subjects",
          "DisplayName": "Subjects",
          "Id": "1000"
         },
         "ContextFreeName": "Cookbooks, Food & Wine",
         "DisplayName": "Cookbooks, Food & Wine",
         "Id": "6"
        },
        "ContextFreeName": "Cooking by Ingredient",
        "DisplayName": "Cooking by Ingredient",
        "Id": "4208"
       },
       "ContextFreeName": "Natural Food Cooking",
       "DisplayName": "Natural Foods",
       "Id": "4340",
       "IsRoot": false
      },
      {
       "Ancestor": {
        "Ancestor": {
         "Ancestor": {
          "Ancestor": {
           "ContextFreeName": "Books",
           "DisplayName": "Books",
           "Id": "283155"
          },
          "ContextFreeName": "Subjects",
          "DisplayName": "Subjects",
          "Id": "1000"
         },
         "ContextFreeName": "Cookbooks, Food & Wine",
         "DisplayName": "Cookbooks, Food & Wine",
         "Id": "6"
        },
        "ContextFreeName": "Main Courses & Side Dishes",
        "DisplayName": "Main Courses & Side Dishes",
        "Id": "4234"
       },
       "ContextFreeName": "Garnishing Meals",
       "DisplayName": "Garnishes",
       "Id": "7696136011",
       "IsRoot": false
      }
     ]
    },
    "DetailPageURL": "https://www.amazon.com/dp/1641521198?tag=getabstractcom&linkCode=ogi&th=1&psc=1"
   }
  ]
 }
}

有了这些数据,您应该能够确定类别,例如 书籍 » 食谱、美食与美酒 » 烘焙 » 面包烘焙 要么 书籍 » 食谱、美食和美酒 » 主菜和配菜 » 配菜

有关您找到的 PAAPI5 的更多信息 here。还有一些针对不同编程语言的 SDK,例如 Java、PHP、Node 或 Python。