有没有人知道任何好的例子,或者关心如何做一个类似于此的亚马逊查找,http://blogs.msdn.com/b/coding4fun/archive/2006/10/31/912260.aspx,我会用它,但它似乎已经过时了,而且来源不是更长的时间。理想我想要做的是在任何一个关键词上查找项目,例如“星际迷航”或直接UPC。我想要回来的是标题,描述,年份和图像链接,类型(DVD,书籍,音乐)。任何帮助都会很棒,谢谢。
答案 0 :(得分:4)
我写了一个小C# Wrapper for Amazon ItemLookup,它可以为你提供一个方便的对象图。它现在只支持ItemLookup。我有源on BitBucket。
您可以拨打电话:
var item = client.LookupByAsin("B0037X9N5U");
double? price = item.GetLowestPrice();
答案 1 :(得分:1)
SprightlySoft适用于.NET的AWS组件允许您与Amazon的产品广告API进行交互。以下是基于UPC查找项目的示例代码。在http://sprightlysoft.com/免费获取该组件。该组件附带示例代码,向您展示如何使用Product Advertising API执行ItemSearch。
//Product Advertising API, ItemLookup: http://docs.amazonwebservices.com/AWSECommerceService/2010-10-01/DG/ItemLookup.html
SprightlySoftAWS.REST MyREST = new SprightlySoftAWS.REST();
String RequestURL;
RequestURL = "https://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&Operation=ItemLookup&Version=2010-10-01";
RequestURL += "&AWSAccessKeyId=" + System.Uri.EscapeDataString(TextBoxAWSAccessKeyId.Text) + "&SignatureVersion=2&SignatureMethod=HmacSHA256&Timestamp=" + Uri.EscapeDataString(DateTime.UtcNow.ToString("yyyy-MM-dd\\THH:mm:ss.fff\\Z"));
RequestURL += "&ItemId=025192022272";
RequestURL += "&IdType=UPC";
RequestURL += "&SearchIndex=DVD";
String RequestMethod;
RequestMethod = "GET";
String SignatureValue;
SignatureValue = MyREST.GetSignatureVersion2Value(RequestURL, RequestMethod, "", TextBoxAWSSecretAccessKey.Text);
RequestURL += "&Signature=" + System.Uri.EscapeDataString(SignatureValue);
Boolean RetBool;
RetBool = MyREST.MakeRequest(RequestURL, RequestMethod, null);
System.Diagnostics.Debug.Print(MyREST.LogData);
if (RetBool == true)
{
String ResponseMessage = "";
System.Xml.XmlDocument MyXmlDocument;
System.Xml.XmlNamespaceManager MyXmlNamespaceManager;
System.Xml.XmlNode MyXmlNode;
System.Xml.XmlNodeList MyXmlNodeList;
MyXmlDocument = new System.Xml.XmlDocument();
MyXmlDocument.LoadXml(MyREST.ResponseString);
MyXmlNamespaceManager = new System.Xml.XmlNamespaceManager(MyXmlDocument.NameTable);
MyXmlNamespaceManager.AddNamespace("amz", "http://webservices.amazon.com/AWSECommerceService/2010-10-01");
MyXmlNodeList = MyXmlDocument.SelectNodes("amz:ItemLookupResponse/amz:Items/amz:Item", MyXmlNamespaceManager);
if (MyXmlNodeList.Count == 0)
{
ResponseMessage = "Item not found.";
}
else
{
foreach (System.Xml.XmlNode ItemXmlNode in MyXmlNodeList)
{
MyXmlNode = ItemXmlNode.SelectSingleNode("amz:ItemAttributes/amz:Title", MyXmlNamespaceManager);
ResponseMessage += "Title = " + MyXmlNode.InnerText;
ResponseMessage += Environment.NewLine;
}
}
MessageBox.Show(ResponseMessage);
}
else
{
MessageBox.Show(MyREST.ResponseStringFormatted);
}
答案 2 :(得分:1)
嗨,使用以下nuget非常容易 Nager.AmazonProductAdvertising包
<强>的NuGet 强>
PM> Install-Package Nager.AmazonProductAdvertising
示例强>
var authentication = new AmazonAuthentication();
authentication.AccessKey = "accesskey";
authentication.SecretKey = "secretkey";
var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.DE);
var result = wrapper.Lookup("B0037X9N5U");
答案 3 :(得分:0)