Amazon Product Advertising API: Get Average Customer Rating
Asked Answered
H

6

14

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.

Hasp answered 26/11, 2011 at 15:34 Comment(0)
F
24

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

Finality answered 9/7, 2015 at 22:48 Comment(3)
Will this last? Hopefully it won't break in the future!Sauers
wouldn't your IP get blacklisted if you scrape such a link?Ladoga
This is a possible way, but only for a few scrapes. When you are looking for multiple items, that page will request a captcha to block bots. Maybe you have to scrape the iframe url from the first amazon-api requestCavite
E
4

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.

Estus answered 2/1, 2012 at 12:25 Comment(0)
S
2

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/

Shiite answered 15/5, 2012 at 11:25 Comment(2)
Well, that throws the idea of a Google XML schema right out the window. Guess I'll be manually inputting the rating on client projects.Libation
Link now brokenYt
E
2

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
Elderly answered 4/10, 2015 at 7:21 Comment(0)
B
0

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

Biddie answered 26/3, 2014 at 17:20 Comment(0)
B
0

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.

Bainmarie answered 12/4, 2019 at 16:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.