Scraping Customer Reviews from Google Maps Places By steve


Google Places reviews have grown in popularity and are a great way to get to know a specific business or type of business you may be interested in starting or helping as another business.

You may be interested in collecting this data for your own use… say you want to build an app that allows you to search business, but by the review text! Or if you’re a local business and want to spy on your competitors to see what people are saying about them in the reviews. Whatever your reason, getting your hands on this Google Maps Review data can be invaluable.

In this article, we’ll discuss two approaches to collecting reviews from Google Maps: one from their official API and another from a third-party API. Both have their advantages & disadvantages that we’ll discuss.

Up to 5 Reviews Per Business

The best way to scrape any data is usually straight from the source, especially when they make available a public API! Fortunately, the good people at Google let you scrape reviews from Google Maps places using the Place Details Endpoint.

The way this works is that you provide an “ID” of a particular Google Maps place and the API will return back a bunch of details about the place (including phone, business website, etc…) and up to 5 (that’s right, a whopping FIVE) reviews for each place. Google doesn’t specify exactly how it selects these 5 reviews, however it’s likely that they prefer showing you more recent reviews, so if you periodically keep polling this endpoint (like once a week), then you’ll keep getting new reviews as they come in over time.

This is a good option if you’re trying to analyze a lot of businesses in a specific city or region, and you’re OK with a more “shallow” approach: getting a few reviews back, but for a lot of businesses.

Google Places API Reviews Data

To do this, simply check out How to Scrape All Google Maps Businesses in a City and follow all the steps up to step 4, where you’ll be able to enter a list of Place IDs and get back reviews as part of the “details” output. You can also save a list of Place IDs that interest you and periodically run the workflow shown in the article to keep getting new reviews (e.g. you can run the workflow every day, week, month, etc…) and you’ll gather new reviews as they come in.

ALL Reviews Per Business

If you really need more than 5 reviews per business (say you want to go deep on a few businesses and scrape ALL their reviews), then you’ll want to look at SerpApi’s Google Maps Reviews API, which is an unofficial service that will “screen scrape” the review data from Google’s public website. While this is not ideal, it’s currently the only way around the Google Places API’s limitation, since it only returns up to 5 reviews for any business at any given time.

The only issue with this API is that it requires a data_id as its input, which appears to be separate from Google’s official place_id, meaning that you cannot combine the previous approach from the Google API (which allows you to collect a large set of official place_ids). If you want to use SerpApi, you’ll need to use it for both finding the local businesses you need and for the review scraping part.

Collecting Local Businesses

To get a list of data_ids required for scraping reviews, you’ll need to refer to SerpApi’s Google Maps API, specifically the Local Results API where you can enter in a search query (like “coffee”) and get local results back. In the response, you’ll want to look for the data_id, e.g. 0x89c259a61c75684f:0x79d31adb123348d2:

SerpApi Sample Results

Scraping All Reviews

Once you have a place_id (or a few), you can then fetch ALL the reviews for those places. Check out the playground as an example for 0x89c259a61c75684f:0x79d31adb123348d2:

SerpApi returning the first 10 reviews

You can see the page has a whopping 10 results and to get the next page, just look for the next_page_token in the response, or EgIICg in this example and pass it in the next_page_token to get the next page of results and so on, until you scroll through ALL the pages and ALL the reviews:

Paginate through reviews

Collecting With Stevesie Data

While you’re welcome to use the above links and interact with SerpApi directly, if you just need CSV files with the reviews in them, then you may find it easier to use the Stevesie Data Platform to access SearchApi and download the results. Stevesie Data is a paid platform and the rest of this article assumes you have the plus plan for running workflows. Disclaimer: I, the author of this article, happen to own the Stevesie Data Platform.

To get started, simply head to the Stevesie SerpApi Integration and provide your search query, API key, coordinates and make sure to set the Search Engine to google_maps so you get back local results:

Local results from SerpApi Google Maps Search

The above screenshot shows the first page of results, but you can use the SerpApi Search - Pagination Formula to get back all local results, just import the formula into a workflow and follow the same instructions.

Once you have a data_id, you can run the same endpoint but this time provide just the API key and Data ID (and don’t forget to provide google_maps_reviews as Search Engine) as follows:

Scrape all Google Reviews for a Data ID

And you can download the results back for the first page as a CSV file:

SerpApi Google Reviews Preview

Now to get ALL the reviews for the businesses you’re interested in, just copy the data_id (or build a list of these, one per line) and paste them into the SerpAPI Google Maps Reviews - Pagination workflow after importing this formula.

Enter a single business data_id or a list to combine results

Then just enter your API key and set the “Search Engine” to google_maps_reviews - you’ll notice that this workflow is set to auto-paginate for you, so keep an eye on your SerpApi requests quota as this can use a lot of your credits if the business(es) your scraping has a LOT of reviews. You can set a “Pagination Limit” under the “Pagination Token” input on the workflow if this is a concern.

Don't forget to set google_maps_reviews!

Let the workflow run, as it will need to make a lot of requests to get all the reviews back, since it only gets back about 20 reviews per page. When it’s done, you’ll see the results as below with a few extra bonuses like the review topics and images users posted with the review:

All Google Maps Reviews Results

Open up the Reviews CSV file, and you’ll see a little more than 5 reviews per business, as this approach can theoretically scrape all reviews in existence on Google Maps!

All Reviews CSV Preview

Posted by steve on Nov. 9, 2021, 5 p.m. ๐Ÿšฉ  Report