Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Places API: Get all the User's Reviews

We are working with google places api. we want to view all the user's reviews of a business in google place but we noticed that the documentation says that it only returns an array of five user's reviews.

Now, we want to know is there any way to get all user's reviews?

like image 643
Magesh Avatar asked Jul 16 '14 10:07

Magesh


People also ask

How do I get more than 5 reviews on Google places API?

Save this answer. Show activity on this post. In order to have access to more than 5 reviews with the Google API you have to purchase Premium data Access from Google. That premium plan will grant you access to all sorts of additional data points you have to shell out a pretty penny.


1 Answers

To get all the reviews of any place you would have to use a third party solution like SerpApi. It's a paid API with a free trial.

Each page fatches 10 results. To implement the pagination just use the start parameter which defines the result offset (e.g., 0 (default) is the first page of results, 10 is the 2nd page of results, 20 is the 3rd page of results, etc.).

Example python code (available in other libraries also):

require 'path/to/google_search_results';

$query = [
  "engine" => "google_maps_reviews",
  "place_id" => "0x89c259a61c75684f:0x79d31adb123348d2",
  "api_key" => "SECRET_API_KEY"
];

$search = new GoogleSearch();
$results = $search->json($query);
$reviews = $result->reviews;

Example JSON output:

"reviews": [
  {
    "user": {
      "name": "Waylon Bilbrey",
      "link": "https://www.google.com/maps/contrib/107691056156160235121?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARAx",
      "thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GjOj6Wjfk1kSYjhvH7WIBNMdl4nPj6FvUhvYcR6=s40-c0x00000000-cc-rp",
      "reviews": 1
    },
    "rating": 4,
    "date": "a week ago",
    "snippet": "I've been here multiple times. The coffee itself is just average to me. The service is good (the people working are nice). The aesthetic is obviously what brings the place some fame. A little overpriced (even for NY). A very small cup for $6 where I feel like the price comes from the top rainbow foam decor , when I'm going to cover it anyways. If it's for an insta pic then it may be worth it?"
  },
  {
    "user": {
      "name": "Amber Grace Sale",
      "link": "https://www.google.com/maps/contrib/106390058588469541899?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARA7",
      "thumbnail": "https://lh3.googleusercontent.com/a-/AOh14Gj84nHu_9V_0V4yRbZcr-8ZTYAHua6gUBP8fC7W=s40-c0x00000000-cc-rp-ba3",
      "local_guide": true,
      "reviews": 33,
      "photos": 17
    },
    "rating": 5,
    "date": "2 years ago",
    "snippet": "They really take pride in their espresso roast here and the staff is extremely knowledgeable on the subject. It’s also a GREAT place to do work although a table is no guarantee; you might have to wait for a bit. My almond milk cappuccino was very acidic at the end which wasn’t expected but I could still tell the bean was high quality. Their larger lattés they put in a tall glass cup which looks really really cool. Would definitely go again.",
    "likes": 2,
    "images": [
      "https://lh5.googleusercontent.com/p/AF1QipMup24_dHrWtNN4ZD70EPsiRMf_tykcUkPw6A1H=w100-h100-p-n-k-no"
    ]
  },
  {
    "user": {
      "name": "Kelvin Petar",
      "link": "https://www.google.com/maps/contrib/100859090874785206875?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARBG",
      "thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GhdIvUDamzfPqbYIpwhnGJV2XWSi77iVXfEsiKS=s40-c0x00000000-cc-rp",
      "reviews": 3
    },
    "rating": 4,
    "date": "3 months ago",
    "snippet": "Stumptown Cafe is the perfect place to work or catch up with friends. Never too loud, never too dead. Their lattes and deliciously addicting and the toasts are tasty as well. Wifi is always fast, which is a huge plus! The staff are the friendliest, I highly recommend this place!"
  },
  ...
]

You can check out the documentation for more details.

Disclaimer: I work at SerpApi.

like image 149
Milos Djurdjevic Avatar answered Oct 18 '22 21:10

Milos Djurdjevic