When you view a place on Google Maps, you can see location details(address, hours, website, phone, etc.), questions and answers, reviews, and some local posts. Local Posts refer to updates and events that the owner publishes directly on their Google Business Profile.

Scraping Google Maps Posts allows you to do competitive analysis and market insights and get the latest updates from your competitors on promotions or events. In addition, Google Maps Posts are obviously good sources for generating leads, identifying actively promoting services, and identifying potential leads for B2B sales.

Setting Up a SerpApi Account

SerpApi offers a free plan for newly created accounts. Head to the sign-up page to register an account and complete your first search with our interactive playground. When you want to do more searches with us, please visit the pricing page.

Once you are familiar with all the results, you can utilize SERP APIs using your API Key.

Scrape your first Google Maps Posts result with SerpApi

Head to the Google Maps Posts API from the documentation on SerpApi for details.

Let's collect posts from La Vera Pizzeria & Restaurant . The data contains: "title", "description", "link", "post_link", "thumbnails", "source", "posted_at" and more. You can also scrape more information with SerpApi.

First, you need to install the SerpApi client library.

pip install google-search-results

Set up the SerpApi credentials and search.

from serpapi import GoogleSearch
import os, json, csv

params = {
    'api_key': 'YOUR_API_KEY',             # your serpapi api
    'engine': 'google_maps_posts',         # SerpApi search engine
    'data_id': '0x89c258e28c304997:0xfcafe4e7ce35ee8c',
}

To retrieve Google Maps Posts Results for a query, you can use the following code:

results = GoogleSearch(params).get_dict()['posts']

You can store Google Maps Posts Results JSON data in databases or export them to a CSV file.

import csv

header = ["title", "description", "link", "post_link", "thumbnails", "source", "posted_at"]

with open("google_maps_posts.csv", "w", encoding="UTF8", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(header)
    for item in results:
        writer.writerow([item.get('title'), item.get('description'), item.get('link'), item.get('post_link'), item.get('thumbnails'), item.get('source'), item.get('posted_at')])

  

This example uses Python, but you can also use all your favorite programming languages like Ruby, NodeJS, Java, PHP, and more.

If you have any questions, please feel free to contact me.