【问题标题】:ASP.NET Amazon ItemSearchASP.NET 亚马逊商品搜索
【发布时间】:2011-06-12 21:49:27
【问题描述】:

有没有人知道任何好的例子,或者愿意解释如何进行类似于此的亚马逊查找,http://blogs.msdn.com/b/coding4fun/archive/2006/10/31/912260.aspx,我会使用它,但它似乎已经过时并且源不再可用.理想 我想做的是在“星际迷航”之类的关键字或 UPC 上查找项目。我想要返回的是标题、描述、年份和图片链接、类型(dvd、书籍、音乐)。任何帮助都会很棒,谢谢。

【问题讨论】:

    标签: c# asp.net amazon


    【解决方案1】:

    我写了一个小C# Wrapper for Amazon ItemLookup 给你一个方便的对象图。它现在只支持 ItemLookup。我有源代码on BitBucket

    您可以拨打以下电话:

    var item = client.LookupByAsin("B0037X9N5U");
    double? price = item.GetLowestPrice();
    

    【讨论】:

      【解决方案2】:

      适用于 .NET 的 SprightlySoft AWS 组件允许您与亚马逊的产品广告 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);
      }
      

      【讨论】:

      【解决方案3】:

      您好,使用以下 nuget 非常容易 Nager.AmazonProductAdvertising

      nuget

      PM> Install-Package Nager.AmazonProductAdvertising
      

      示例

      var authentication = new AmazonAuthentication("accesskey", "secretkey");
      var client = new AmazonProductAdvertisingClient(authentication, AmazonEndpoint.US);
      var result = await client.GetItemsAsync("B0037X9N5U");
      

      【讨论】:

        【解决方案4】:

        【讨论】:

        • 我已经挖掘了这些,它们很旧,而且真的好像有一百万种不同的 wsdl,其中一半做类似的事情,而其中一半已经过时了。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多