Amazon Product Advertising API: Get Average Customer Rating

断了今生、忘了曾经 提交于 2019-12-03 06:50:55

问题


When using Amazon's web service to get any product's information, is there a direct way to get the Average Customer Rating (1-5 stars)? Here are the parameters I'm using:

Service=AWSECommerceService
Version=2011-08-01
Operation=ItemSearch
SearchIndex=Books
Title=A Game of Thrones
ResponseGroup=Large

I would expect it to have a customer rating of 4.5 and total reviews of 2177. But instead I get the following in the response.

<CustomerReviews><IFrameURL>http://www.amazon.com/reviews/iframe?...</IFrameURL></CustomerReviews>

Is there a way to get the overall customer rating, besides for reading the <IFrameURL/> value, making another HTTP request for that page of reviews, and then screen scraping the HTML? That approach is fragile since Amazon could easily change the reviews page structure which would bust my application.


回答1:


You can scrape from here. Just replace the asin with what you need.

http://www.amazon.com/gp/customer-reviews/widgets/average-customer-review/popover/ref=dpx_acr_pop_?contextId=dpx&asin=B000P0ZSHK




回答2:


As far as i know, Amazon changed it's API so its not possible anymore to get the reviewrank information. If you check this Link the note sais:

As of November 8, 2010, only the iframe URL is returned in the request content.

However, testing with the params you used to get the Iframe it seems that now even the Iframe dosn't work anymore. Thus, even in the latest API Reference in the chapter "Motivating Customers to Buy" the part "reviews" is compleatly missing.

However: Since i'm also very interested if its still possible somehow to get the reviewrank information - maybe even not using amazon API but a competitors API to get review rank informations - i'll set up a bounty if anybody can provide something helpful on that. Bounty will be set in this topic in two days.




回答3:


You can grab the iframe review url and then use css to position it so only the star rating shows. It's not ideal since you're not getting raw data, but it's an easy way to add the rating to your page.

Sample of this in action - http://spamtech.co.uk/positioning-content-inside-an-iframe/




回答4:


Here is a VBS script that would scrape the rating. Paste the code below to a text file, rename it to Test.vbs and double click to run on Windows.

sAsin = InputBox("What is your ASIN?", "Amazon Standard Identification Number (ASIN)", "B000P0ZSHK")
if sAsin <> "" Then
  sHtml = SendData("http://www.amazon.com/gp/customer-reviews/widgets/average-customer-review/popover/ref=dpx_acr_pop_?contextId=dpx&asin=" & sAsin)
  sRating = ExtractHtml(sHtml, "<span class=""a-size-base a-color-secondary"">(.*?)<\/span>")
  sReviews = ExtractHtml(sHtml, "<a class=""a-size-small a-link-emphasis"".*?>.*?See all(.*?)<\/a>")
  MsgBox sRating & vbCrLf & sReviews
End If

Function ExtractHtml(sHtml,sPattern)
  Set oRegExp = New RegExp
  oRegExp.Pattern    = sPattern
  oRegExp.IgnoreCase = True
  Set oMatch = oRegExp.Execute(sHtml)
  If oMatch.Count = 1 Then
      ExtractHtml = Trim(oMatch.Item(0).SubMatches(0))
  End If
End Function

Function SendData(sUrl)
  Dim oHttp 'As XMLHTTP30
  Set oHttp = CreateObject("Msxml2.XMLHTTP")
  oHttp.open "GET", sUrl, False
  oHttp.send
  SendData = Replace(oHttp.responseText,vbLf,"")
End Function



回答5:


Amazon has completely removed support for accessing rating/review information from their API. The docs mention a Response Element in the form of customer rating, but that doesn't work either.

Google shopping using Viewpoints for some reviews and other sources




回答6:


This is not possible from PAPI. You either need to scrape it by yourself, or you can use other free/cheaper third-party alternatives for that.

We use the amazon-price API from RapidAPI for this, it supports price/rating/review count fetching for up to 1000 products in a single request.



来源:https://stackoverflow.com/questions/8279478/amazon-product-advertising-api-get-average-customer-rating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!