# Google Maps Scraper (`trusted_product_seller/google-maps-scraper`) Actor

Easily extract contact details and business listings from Google Maps in seconds! This tool helps you find new clients, generate sales leads, and study your competitors with just a few clicks.

- **URL**: https://apify.com/trusted\_product\_seller/google-maps-scraper.md
- **Developed by:** [Gauri Shanker](https://apify.com/trusted_product_seller) (community)
- **Categories:** Lead generation, Travel, Jobs
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Google Maps Places Scraper (Fast Asynchronous & Scalable)

This Apify Actor extracts business listings and places from Google Maps with lightning speed. It bypasses Google Maps' limit of displaying a maximum of 120 places per search query by implementing a dynamic viewport coordinate grid search. 

Using asynchronous python workers, concurrent HTTP requests, and strict target extraction logic, it guarantees you get the exact number of unique results requested (`max_places`) without getting blocked.

---

### Key Features

- **🚀 Asynchronous Multi-Worker Engine**: Powered by `curl_cffi`'s `AsyncSession` (Chrome 136 impersonation), executing parallel, non-blocking requests to mimic natural browser behaviors.
- **📍 Viewport Grid Search**: Generates an 8x8 search grid (up to 64 coordinate points) surrounding the resolved center coordinates, sorted by distance from the center. This expands the search scope dynamically to uncover hundreds of hidden listings.
- **🎯 Strict Target Count**: The scraper dynamically consumes coordinate zones and continues scraping pages until your exact requested `max_places` limit is reached.
- **🛡️ Resilient Exit Protocol**: The search only stops early if **15 consecutive requests** return 0 new unique results, indicating the entire region has been thoroughly exhausted of places.
- **📊 Real Data Extraction (Fixed Rating/Reviews)**: Extracts exact reviews counts and ratings (corrected to work with Google Maps' updated list indices: `item[37][1]` for reviews and `item[4][7]` for ratings) without relying on expensive official API calls or paid add-ons.
- **🇺🇸 State Resolution**: Automatically parses the address string using regular expressions to resolve two-letter state abbreviations dynamically.
- **🔒 In-Memory Deduplication**: Maintains a running set of place IDs across all concurrent worker threads to guarantee that only unique records are added to your output dataset.

---

### ⬇️ Input Parameters

The Actor accepts three standard inputs defined in the schema:

| Input Field | Type | Description | Default |
|-------------|------|-------------|---------|
| `term` | String (Required) | The search term or category (e.g. `plumber`, `dentist`, `pizza`). | `plumbing services` |
| `location` | String (Required) | The city, state, or general area to search in (e.g. `Miami, FL`, `Dallas, TX`). | `Miami, FL` |
| `max_places` | Integer (Optional) | The maximum number of unique places to extract. | `50` |

#### Input JSON Example
```json
{
  "term": "plumber",
  "location": "New York",
  "max_places": 150
}
````

***

### ⬆️ Output Structure

The output is written directly to the default Apify Dataset. Each place is saved as an individual JSON object. When running in the Apify Cloud, the console automatically aggregates these into a single spreadsheet, table, or array for immediate viewing and download (CSV, Excel, JSON, XML).

#### Output Fields Extracted:

- `name`: Business name
- `phone`: Contact phone number
- `address`: Full address string
- `website`: Official website URL
- `place_id`: Google Place ID (for details mapping)
- `cid`: Google CID unique hash
- `latitude` / `longitude`: Exact geographic coordinates
- `category`: Primary business categories
- `rating`: Average review rating (e.g. `4.9`)
- `reviews`: Total review count (e.g. `355`)
- `city`: Search location query
- `state`: Dynamically resolved US state code (e.g. `NY`, `FL`)
- `search_keyword`: Query term used

#### Output JSON Example

```json
{
  "name": "Miami 24/7 Plumbing - Miami Emergency Plumbers",
  "phone": "(305) 440-0878",
  "address": "Miami 24/7 Plumbing - Miami Emergency Plumbers, 1331 SW 32nd Ave #4, Miami, FL 33145",
  "website": "https://www.miami247plumbing.com/",
  "place_id": "ChIJVaTjegK32YgR2K0jdOLn3Ao",
  "cid": "0x88d9b7027ae3a455:0xadce7e27423add8",
  "latitude": 25.759981099999997,
  "longitude": -80.24667629999999,
  "category": [
    "Plumber"
  ],
  "reviews": 355,
  "rating": 4.9,
  "city": "Miami, FL",
  "state": "FL",
  "search_keyword": "plumber"
}
```

Good Luck and Start to Scrape the Google Map Packs!

# Actor input Schema

## `term` (type: `string`):

The search keyword or category (e.g. 'roofing contractors', 'dentist', 'pizza').

## `location` (type: `string`):

The city, state, or area to search in (e.g. 'Miami, FL', 'Dallas, TX').

## `max_places` (type: `integer`):

Maximum number of places/businesses to extract.

## Actor input object example

```json
{
  "term": "plumbing services",
  "location": "Miami, FL",
  "max_places": 50
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "term": "plumbing services",
    "location": "Miami, FL"
};

// Run the Actor and wait for it to finish
const run = await client.actor("trusted_product_seller/google-maps-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "term": "plumbing services",
    "location": "Miami, FL",
}

# Run the Actor and wait for it to finish
run = client.actor("trusted_product_seller/google-maps-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "term": "plumbing services",
  "location": "Miami, FL"
}' |
apify call trusted_product_seller/google-maps-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=trusted_product_seller/google-maps-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Google Maps Scraper",
        "description": "Easily extract contact details and business listings from Google Maps in seconds! This tool helps you find new clients, generate sales leads, and study your competitors with just a few clicks.",
        "version": "0.0",
        "x-build-id": "WqT62e7kXs6st2aS1"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/trusted_product_seller~google-maps-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-trusted_product_seller-google-maps-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/trusted_product_seller~google-maps-scraper/runs": {
            "post": {
                "operationId": "runs-sync-trusted_product_seller-google-maps-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/trusted_product_seller~google-maps-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-trusted_product_seller-google-maps-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "term",
                    "location"
                ],
                "properties": {
                    "term": {
                        "title": "Search Term / Keyword",
                        "type": "string",
                        "description": "The search keyword or category (e.g. 'roofing contractors', 'dentist', 'pizza').",
                        "default": "plumbing services"
                    },
                    "location": {
                        "title": "Location",
                        "type": "string",
                        "description": "The city, state, or area to search in (e.g. 'Miami, FL', 'Dallas, TX').",
                        "default": "Miami, FL"
                    },
                    "max_places": {
                        "title": "Max Places to Extract",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of places/businesses to extract.",
                        "default": 50
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
