Sitemap
Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

How to use Review API

4 min readAug 5, 2021

--

Photo by Priscilla Du Preez on Unsplash
import requests
import re
import pandas as pd
headers = {
"apikey": "ENTER_YOUR_API_KEY_HERE"}
params = (
("url","https://www.sitejabber.com/reviews/zara.com"),
("amount","30"),
);
response = requests.get('https://app.reviewapi.io/api/v1/reviews', headers=headers, params=params);#view response
print(response.text)
{"query":{"url":"https:\/\/www.sitejabber.com\/reviews\/zara.com","amount":"30"},"reviews":[{"platform":"sitejabber.com","rating":1,"user_name":"JenniferG.","text":"It is disappointing that Zara's customer service policies are so poor. 30 minutes to wait in line to make a purchase or return is unreasonable. And, now that we're transitioning from the pandemic, the dressing rooms are still not open. And, if you buy something online, you cannot return it to a store. Terrible!ServiceValueShippingReturnsQuality","title":"TERRIBLE CUSTOMER SERVICE","timestamp":"2021-08-02","platform_specific":{"user_review_count":"1","user_image_url":"https:\/\/static.sitejabber.com\/img\/stock_photos\/200\/thumbnail_small.1476463632.jpg","user_helpful_vote":"1"}}
#make empty dataframe
zara_rev = pd.DataFrame(columns=['Username', 'Date', 'Rating', 'Text'])
#extract data for each column
zara_rev['Username'] = re.findall(r'(?<=\"user_name\"\:.)(\w*)', response.text)
zara_rev['Date'] = re.findall(r'(?<=\"timestamp\"\:.).[0-9]*\-[0-9]*\-[0-9]*(?=\"\,\"platform_specific\")', response.text)
zara_rev['Rating'] = re.findall(r'(?<=\"rating\"\:)(\d)*', response.text)
zara_rev['Text'] = re.findall(r'(?<=\"text\"\:.).*?(?=\"\,\"title\")',response.text)
So many 1-star ratings from both of them! Why is that?
Some reviews about Shein (left) and Zara (right)

--

--

No responses yet