简体   繁体   English

从ASIN获取亚马逊项目图像和描述

[英]Get Amazon item images and description from ASIN

I'm doing a sort of shopping list web app in which you can link items to their Amazon's equivalent. 我正在做一种购物清单网络应用程序,您可以在其中将项目链接到其亚马逊的等价物。

But I'm wondering how to do so. 但我想知道该怎么做。 Is there any API? 有API吗? If so, is there a javascript API? 如果是这样,是否有JavaScript API?

I'd like to: 我想:

a) Fetch an item image and description using their ASIN a)使用他们的ASIN获取项目图像和描述

b) Fetch search's results for a certain term. b)获取特定术语的搜索结果。

Any suggestions/help is welcome! 欢迎任何建议/帮助!

Thanks! 谢谢!

You can do that by using node-apac , a node.js client for Amazon's Product Advertising API. 您可以使用node-apac (亚马逊产品广告API的node.js客户端)来实现。 However, to use the Amazon API you have to open a Amazon Web Services (AWS) account. 但是,要使用Amazon API,您必须打开Amazon Web Services(AWS)帐户。 Follow these steps. 跟着这些步骤。

  1. Open a AWS account. 打开AWS账户。 Note: Amazon will ask you for a credit card on sign-up, but the Product Advertising API is free, so you won't be charged. 注意:亚马逊会在注册时要求您提供信用卡,但产品广告API是免费的,因此我们不会向您收费。

  2. Login into your AWS account and go to Security Credentials page to find out your Access Key ID and Secret Access Key 登录您的AWS账户并转到Security Credentials页面 ,找到您的Access Key ID和Secret Access Key

  3. Enroll into Amazon Associates Program and get your Associate Tag. 注册Amazon Associates计划并获得您的Associate Tag。 This will allow you to receive commission from Amazon for the referrals you send to them. 这将允许您从亚马逊获得佣金,用于您发送给他们的推荐。

  4. Install node-apac 安装node-apac

     npm install apac@latest 
  5. Here is a code snippet that accomplishes your task b) for Amazon search query. 以下是完成亚马逊搜索查询任务b)的代码段。 It comes from the node-apac page, credit goes to dmcquay 它来自node-apac页面,信用转到dmcquay

     var util = require('util'), OperationHelper = require('apac').OperationHelper; var opHelper = new OperationHelper({ awsId: '[YOUR ACCESS KEY ID HERE]', awsSecret: '[YOUR SECRET ACCESS KEY HERE]', assocId: '[YOUR ASSOCIATE TAG HERE]', }); opHelper.execute('ItemSearch', { 'SearchIndex': 'Books', 'Keywords': 'harry potter', 'ResponseGroup': 'ItemAttributes,Offers' }, function(error, results) { if (error) { console.log('Error: ' + error + "\\n"); } console.log("Results:\\n" + util.inspect(results) + "\\n"); }); 

For the task a) of fetching an item image and description you do this: 对于获取项目图像和描述的任务a),您执行以下操作:

opHelper.execute('ItemLookup', {
    'ItemId': '[ASIN GOES HERE]',
    'MechantId': 'All',
    'Condition': 'All',
    'ResponseGroup': 'Medium'
}, function(error, results) {
    if (error) { console.log('Error: ' + error + "\n"); }
    console.log("Results:\n" + util.inspect(results) + "\n");
});

That's it. 而已。 Check the "results" object for the fields you need. 检查“结果”对象以查找所需的字段。 It should include product images, description, and a lot more. 它应该包括产品图像,描述等等。

In addition to Arik G's comment on the node-apac api, you can use the full Node.js library for AWS to get access to product search, etc. http://aws.amazon.com/code/Product-Advertising-API/4272 . 除了Arik G对node-apac api的评论之外,您还可以使用AWS的完整Node.js库来访问产品搜索等.http://aws.amazon.com/code/Product-Advertising-API / 4272

As Judge Mental mentions, the affiliate main page had a list of resource which have documentation and a developer guide. 正如Judge Mental提到的那样,联盟主页有一个资源列表,其中包含文档和开发人员指南。 I find using the ScratchPad very useful for testing that I have the correct Account keys or making sample queries. 我发现使用ScratchPad非常有用于测试我有正确的帐户密钥或进行样本查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM