Google Maps API: How to Scrape Google Maps with Talordata

Learn how to scrape Google Maps results with Talordata SERP API. Use Python to collect local business names, ratings, reviews, addresses, phone numbers, websites, place IDs, coordinates, and export the data to CSV.

talor ai
最後更新於
10 分鐘閱讀

Google Maps results are useful when you need local business data for local SEO, lead generation, competitor research, market analysis, or AI workflows.

For example, you may want to collect:

  • dentists in Austin

  • coffee shops in Seattle

  • hotels near JFK Airport

  • plumbers in Chicago

  • restaurants in New York

  • local competitors around a specific coordinate

In this article, “Google Maps API” means using Talordata SERP API to collect structured Google Maps-style search results. It is not the same as Google’s official Maps Platform APIs.

Talordata SERP API supports structured SERP data from Google and major search engines, with JSON / HTML response formats and geo-targeted SERP data. Its product page also lists Google result types including Local and Maps.

What We Will Build

We will create a Python script that:

Search query
→ Talordata SERP API
→ Google Maps results
→ Extract business fields
→ Normalize data
→ Export results to CSV

The final CSV can include:

  • business name

  • ranking position

  • rating

  • review count

  • category

  • address

  • phone number

  • website

  • place ID

  • latitude

  • longitude

  • Google Maps URL

  • opening status

  • collected timestamp

Talordata’s Google Maps SERP API guide notes that useful Maps responses often include fields like business name, place ID, address, latitude and longitude, category, rating, review count, rank position, opening status, phone number, website, Google Maps URL, thumbnail, and price level when available.

Why Use a SERP API for Google Maps?

You can try to scrape Google Maps manually with browser automation, but the workflow can become fragile quickly.

You may need to deal with:

  • dynamic rendering

  • infinite scrolling

  • changing layouts

  • location-specific results

  • anti-bot checks

  • CAPTCHA challenges

  • duplicate listings

  • missing addresses

  • inconsistent business names

A SERP API gives you a cleaner workflow. You send a query and location, then receive structured data that is easier to store, compare, and analyze.

This is especially useful for local SEO because Google Maps rankings are heavily shaped by location. A one-mile location change can affect which businesses appear, especially in dense markets such as restaurants, urgent care, salons, gyms, storage, and home services.

Step 1: Prepare Your API Key

Create a Talordata account and get your SERP API key from the dashboard.

Talordata’s product page says users can start with 1,000 free API responses and that SERP API plans are response-based.

Store your API key and endpoint as environment variables.

export TALORDATA_API_KEY="your_api_key_here"
export TALORDATA_SERP_ENDPOINT="your_talordata_serp_endpoint_here"

On Windows PowerShell:

$env:TALORDATA_API_KEY="your_api_key_here"
$env:TALORDATA_SERP_ENDPOINT="your_talordata_serp_endpoint_here"

Install the Python package:

pip install requests

Use the endpoint and parameter names shown in your Talordata dashboard or API docs. The code below keeps the request layer separate so you can adjust the exact endpoint without changing the parsing logic.

Step 2: Send a Google Maps Request

A Google Maps SERP request usually needs a query, location, language, country, and result count.

import os
import requests


TALORDATA_API_KEY = os.getenv("TALORDATA_API_KEY")
TALORDATA_SERP_ENDPOINT = os.getenv("TALORDATA_SERP_ENDPOINT")


def require_env(name):
    value = os.getenv(name)
    if not value:
        raise RuntimeError(f"Missing required environment variable: {name}")
    return value


def search_google_maps(query, location="United States", language="en", country="us"):
    api_key = require_env("TALORDATA_API_KEY")
    endpoint = require_env("TALORDATA_SERP_ENDPOINT")

    payload = {
        "engine": "google_maps",
        "q": query,
        "location": location,
        "hl": language,
        "gl": country,
        "num": 20,
        "output": "json"
    }

    headers = {
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    }

    response = requests.post(
        endpoint,
        json=payload,
        headers=headers,
        timeout=30
    )

    response.raise_for_status()
    return response.json()

Some APIs use query instead of q, or type=maps instead of engine=google_maps. Keep this function isolated so you only need to change one part of the script.

Step 3: Extract Google Maps Results

Different SERP APIs may return Maps results under different keys, such as:

local_results
maps_results
places_results

A flexible parser makes the script easier to adapt.

from datetime import datetime, timezone
from urllib.parse import urlparse


def clean_text(value):
    if not value:
        return ""
    return " ".join(str(value).split())


def get_domain(url):
    if not url:
        return ""
    parsed = urlparse(url)
    return parsed.netloc.replace("www.", "") if parsed.netloc else ""


def get_maps_results(serp_json):
    return (
        serp_json.get("maps_results")
        or serp_json.get("local_results")
        or serp_json.get("places_results")
        or []
    )


def normalize_maps_results(serp_json, query, location):
    results = get_maps_results(serp_json)
    collected_at = datetime.now(timezone.utc).isoformat()

    rows = []

    for index, item in enumerate(results, start=1):
        gps = item.get("gps_coordinates") or {}

        website = item.get("website") or item.get("link") or ""
        maps_url = item.get("maps_url") or item.get("google_maps_url") or ""

        rows.append({
            "query": query,
            "location": location,
            "position": item.get("position") or item.get("rank") or index,
            "business_name": clean_text(item.get("title") or item.get("name")),
            "category": clean_text(item.get("type") or item.get("category")),
            "rating": item.get("rating"),
            "reviews": item.get("reviews") or item.get("reviews_count"),
            "address": clean_text(item.get("address")),
            "phone": clean_text(item.get("phone")),
            "website": website,
            "website_domain": get_domain(website),
            "place_id": item.get("place_id") or item.get("data_id") or item.get("data_cid") or "",
            "latitude": gps.get("latitude") or item.get("latitude"),
            "longitude": gps.get("longitude") or item.get("longitude"),
            "opening_status": clean_text(item.get("open_state") or item.get("hours")),
            "maps_url": maps_url,
            "collected_at": collected_at
        })

    return rows

The place_id is especially important. Talordata’s Google Maps guide points out that names can change, franchises can share labels, and addresses may be formatted differently across requests, so place IDs help with deduplication and historical tracking.

Step 4: Export Results to CSV

Now write the normalized rows to a CSV file.

import csv


CSV_COLUMNS = [
    "query",
    "location",
    "position",
    "business_name",
    "category",
    "rating",
    "reviews",
    "address",
    "phone",
    "website",
    "website_domain",
    "place_id",
    "latitude",
    "longitude",
    "opening_status",
    "maps_url",
    "collected_at"
]


def export_to_csv(rows, filename="google_maps_results.csv"):
    if not rows:
        print("No Google Maps results found.")
        return

    with open(filename, mode="w", newline="", encoding="utf-8") as file:
        writer = csv.DictWriter(file, fieldnames=CSV_COLUMNS)
        writer.writeheader()
        writer.writerows(rows)

    print(f"Exported {len(rows)} results to {filename}")

Complete Python Example

import os
import csv
import requests

from datetime import datetime, timezone
from urllib.parse import urlparse


CSV_COLUMNS = [
    "query",
    "location",
    "position",
    "business_name",
    "category",
    "rating",
    "reviews",
    "address",
    "phone",
    "website",
    "website_domain",
    "place_id",
    "latitude",
    "longitude",
    "opening_status",
    "maps_url",
    "collected_at"
]


def require_env(name):
    value = os.getenv(name)
    if not value:
        raise RuntimeError(f"Missing required environment variable: {name}")
    return value


def clean_text(value):
    if not value:
        return ""
    return " ".join(str(value).split())


def get_domain(url):
    if not url:
        return ""
    parsed = urlparse(url)
    return parsed.netloc.replace("www.", "") if parsed.netloc else ""


def search_google_maps(query, location="United States", language="en", country="us"):
    api_key = require_env("TALORDATA_API_KEY")
    endpoint = require_env("TALORDATA_SERP_ENDPOINT")

    payload = {
        "engine": "google_maps",
        "q": query,
        "location": location,
        "hl": language,
        "gl": country,
        "num": 20,
        "output": "json"
    }

    headers = {
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    }

    response = requests.post(
        endpoint,
        json=payload,
        headers=headers,
        timeout=30
    )

    response.raise_for_status()
    return response.json()


def get_maps_results(serp_json):
    return (
        serp_json.get("maps_results")
        or serp_json.get("local_results")
        or serp_json.get("places_results")
        or []
    )


def normalize_maps_results(serp_json, query, location):
    results = get_maps_results(serp_json)
    collected_at = datetime.now(timezone.utc).isoformat()

    rows = []

    for index, item in enumerate(results, start=1):
        gps = item.get("gps_coordinates") or {}

        website = item.get("website") or item.get("link") or ""
        maps_url = item.get("maps_url") or item.get("google_maps_url") or ""

        rows.append({
            "query": query,
            "location": location,
            "position": item.get("position") or item.get("rank") or index,
            "business_name": clean_text(item.get("title") or item.get("name")),
            "category": clean_text(item.get("type") or item.get("category")),
            "rating": item.get("rating"),
            "reviews": item.get("reviews") or item.get("reviews_count"),
            "address": clean_text(item.get("address")),
            "phone": clean_text(item.get("phone")),
            "website": website,
            "website_domain": get_domain(website),
            "place_id": item.get("place_id") or item.get("data_id") or item.get("data_cid") or "",
            "latitude": gps.get("latitude") or item.get("latitude"),
            "longitude": gps.get("longitude") or item.get("longitude"),
            "opening_status": clean_text(item.get("open_state") or item.get("hours")),
            "maps_url": maps_url,
            "collected_at": collected_at
        })

    return rows


def export_to_csv(rows, filename="google_maps_results.csv"):
    if not rows:
        print("No Google Maps results found.")
        return

    with open(filename, mode="w", newline="", encoding="utf-8") as file:
        writer = csv.DictWriter(file, fieldnames=CSV_COLUMNS)
        writer.writeheader()
        writer.writerows(rows)

    print(f"Exported {len(rows)} results to {filename}")


if __name__ == "__main__":
    query = "coffee shops in Seattle"
    location = "Seattle, Washington, United States"

    serp_json = search_google_maps(
        query=query,
        location=location,
        language="en",
        country="us"
    )

    rows = normalize_maps_results(serp_json, query, location)
    export_to_csv(rows)

After running the script, you should get:

google_maps_results.csv

Example Output

Your CSV may look like this:

query,location,position,business_name,category,rating,reviews,address,phone,website,website_domain,place_id,latitude,longitude,opening_status,maps_url,collected_at
coffee shops in Seattle,"Seattle, Washington, United States",1,Example Coffee,Coffee shop,4.7,1200,"123 Example St",+1 000-000-0000,https://example.com,example.com,abc123,47.61,-122.33,Open,https://maps.google.com/example,2026-06-22T00:00:00Z

From here, you can send the data to Google Sheets, a database, a local SEO dashboard, or an AI agent workflow.

Useful Parameters to Adjust

For Google Maps scraping workflows, these parameters usually matter:

Parameter

Why It Matters

q

The local search query

location

The target city, region, or area

gl

Country or market

hl

Language

num

Number of results

coordinates

Useful for geo-grid tracking if supported

device

Useful when comparing mobile and desktop behavior

For serious local SEO analysis, city-level location is often not enough. Talordata’s Google Maps guide explains that Maps visibility can change by coordinate, and a geo-grid can show where a business is visible, where competitors dominate, and where Google stops considering the business geographically relevant.

Common Use Cases

Local SEO rank tracking

Track how a business ranks for local keywords such as “dentist near me,” “coffee shop in Seattle,” or “emergency plumber in Austin.”

Competitor monitoring

Compare business names, rankings, ratings, review counts, categories, and websites across a local market.

Lead generation

Collect business names, categories, websites, phone numbers, and addresses for targeted outreach.

Geo-grid visibility analysis

Run the same query across multiple coordinates to understand where a business appears or disappears.

AI and RAG workflows

Use Google Maps results as a local discovery layer. An AI agent can summarize local competitors, identify high-review businesses, or generate a market overview from structured Maps data.

Best Practices

Save place IDs whenever possible. They help match the same business across different runs.

Store timestamps. Ratings, review counts, opening status, and rankings change over time.

Separate raw and normalized data. Keep raw responses for debugging, then normalize fields for dashboards.

Do not mix paid and organic visibility without labeling. Sponsored listings can distort rank reports if they are merged with organic Maps results. Talordata’s Google Maps guide recommends keeping a sponsored flag whenever possible.

Use coordinates for serious local tracking. A single city-level query can hide neighborhood-level differences.

FAQ

Can I scrape Google Maps with Python?

Yes. You can use Python with a Google Maps SERP API to send a local query and receive structured business results. The script above shows how to normalize the response and export it to CSV.

Is Google Maps API the same as Google Maps SERP API?

No. In this article, Google Maps API refers to collecting Google Maps-style search results through Talordata SERP API. Google’s official Maps Platform APIs are a different product category.

What data can I collect from Google Maps results?

Common fields include business name, ranking position, rating, review count, category, address, phone number, website, place ID, latitude, longitude, opening status, and Google Maps URL.

Why is place ID important?

Place ID helps identify the same business across multiple runs, even when the business name, address formatting, or listing details change.

Can I use this for local SEO?

Yes. Google Maps data is useful for local rank tracking, competitor analysis, review monitoring, geo-grid visibility checks, and client reporting.

立即開展您的數據業務

加入全球最強大的代理網絡

免費試用