# Google Maps Search & Directions Scraper (`rexreus/google-maps-search-directions-scraper`) Actor

Extract Google Maps places data + calculate routes with live traffic — in a single lightweight Actor run.

- **URL**: https://apify.com/rexreus/google-maps-search-directions-scraper.md
- **Developed by:** [REXREUS D.O](https://apify.com/rexreus) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 scraped 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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

<p align="center">
  <h1 align="center">Google Maps Search & Directions Scraper</h1>
  <img src="https://res.cloudinary.com/ewnqk3k9/image/upload/f_auto,q_auto/v1792018546/apify-actors/banners/google-maps-search-directions-scraper-banner.png" alt="Ultra-fast HTTP-first Google Maps scraper for places and route directions" align="center">
  <p align="center">
    <strong>Extract Google Maps places data + calculate routes with live traffic — in a single lightweight Actor run.</strong>
  </p>
  <p align="center">
    <em>Pure HTTP · No Browser · 256 MB RAM · Sub-second per query · Pay-Per-Result</em>
  </p>
  <p align="center">
    <a href="#-quick-start"><img src="https://img.shields.io/badge/Quick_Start-Apify_Console-green?style=flat-square" alt="Quick Start"></a>
    <a href="https://apify.com"><img src="https://img.shields.io/badge/Runs_on-Apify-ff443e?style=flat-square" alt="Apify"></a>
    <a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node.js-%E2%89%A520-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node.js"></a>
  </p>
</p>

***

### 🗺️ Why this Actor?

| Feature | What you get |
|---|---|
| **Dual-Mode Operation** | Extract places **and** calculate routes in one unified run — no glue code, no webhook juggling |
| **Zero Browser Overhead** | Pure HTTP requests to Google Maps internal JSON endpoints — no Playwright, no Chrome, no 4GB RAM penalty |
| **Ultra-Low Compute Cost** | ~0.002 CU per 1,000 places vs 0.5–2.0 CU for browser-based scrapers — **50× cheaper** |
| **Places Search** | Name, PlaceID, address, coordinates, phone, website, rating, review count, hours, category |
| **Directions & Traffic** | Distance, duration, duration in traffic, turn-by-turn navigation steps, Google Encoded Polyline |
| **Multi-Waypoint Routing** | Up to 25 intermediate stops per route — perfect for delivery optimization |
| **All Travel Modes** | Driving, walking, bicycling, and transit |
| **Route Avoidance** | Optionally avoid tolls and highways |
| **Transparent Pricing** | Flat **$2.50 / 1,000 results** — no filter surcharges, no CU penalties, no setup fees |
| **Smart Proxy Tiering** | Datacenter default → automatic Residential fallback on rate limits |
| **256 MB RAM** | No browser overhead; runs in 256 MB containers with headroom to spare |

***

### ⚡ Quick start

1. Open this Actor on the **Apify Console** and click **Start**.
2. Choose your mode: **Places**, **Directions**, or **Both**.
3. For Places mode — paste search queries:

```json
{
  "mode": "places",
  "searchQueries": ["coffee shops in Manhattan, New York"],
  "maxItemsPerQuery": 20,
  "language": "en",
  "country": "us"
}
```

4. For Directions mode — provide origin and destination:

```json
{
  "mode": "directions",
  "origin": "Empire State Building, New York",
  "destination": "Times Square, New York",
  "travelMode": "driving"
}
```

5. Click **Start** and download results as **JSON**, **CSV**, or **Excel**.

***

### 🔧 How it works

```
User Input → Places Search Request → Google Maps HTTP Endpoint
   ↓                ↓                        ↓
searchQueries  maxItemsPerQuery     /search?tbm=map&pb=...
   ↓                ↓                        ↓
origin         destination         /maps/preview/directions?pb=...
   ↓                                         ↓
               Strip )]}'\n prefix → JSON.parse() → Clean Dataset
```

The Actor communicates directly with Google Maps' internal JSON/Protobuf RPC endpoints — no headless browser, no DOM parsing, no WebGL, no fingerprint battles. Data is extracted from structured JSON arrays and normalized through strict whitelist domain projections.

***

### 📥 Input

#### Basic Example — Places Search

```json
{
  "mode": "places",
  "searchQueries": ["Italian restaurants in Chicago"],
  "maxItemsPerQuery": 100,
  "locationBias": { "lat": 41.8781, "lng": -87.6298, "zoom": 13 }
}
```

#### Full Example — Directions with Waypoints

```json
{
  "mode": "directions",
  "origin": "O'Hare International Airport, Chicago",
  "destination": "Millennium Park, Chicago",
  "waypoints": ["Willis Tower, Chicago"],
  "travelMode": "driving",
  "avoidTolls": true,
  "language": "en",
  "country": "us"
}
```

#### Input Fields

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `mode` | string | ✅ | `places` | `places`, `directions`, or `both` |
| `searchQueries` | string\[] | for places | — | Place search queries (max 1,000 per run) |
| `maxItemsPerQuery` | integer | ❌ | `20` | Max results per query (1–500) |
| `locationBias` | object | ❌ | — | `{ lat, lng, zoom }` to center viewport |
| `origin` | string | for directions | — | Route starting point |
| `destination` | string | for directions | — | Route ending point |
| `waypoints` | string\[] | ❌ | `[]` | Intermediate stops (max 25) |
| `travelMode` | string | ❌ | `driving` | `driving`, `walking`, `bicycling`, `transit` |
| `avoidTolls` | boolean | ❌ | `false` | Avoid toll roads |
| `avoidHighways` | boolean | ❌ | `false` | Avoid highways |
| `language` | string | ❌ | `en` | Language code for results |
| `country` | string | ❌ | `us` | Country code for regional bias |
| `proxyConfiguration` | object | ❌ | Apify Proxy | Proxy settings |

***

### 📤 Output

#### Places Record Example

```json
{
  "searchQuery": "coffee shops in Manhattan, New York",
  "placeId": "ChIJfbedxbZZwokRpbnR5BBdz1c",
  "title": "787 Coffee",
  "category": "Coffee shop",
  "address": "245 W 46th St, New York, NY 10036",
  "location": { "lat": 40.7597441, "lng": -73.9875048 },
  "phone": "(646) 596-7178",
  "website": "https://www.787coffee.com/",
  "rating": 4.9,
  "reviewsCount": 3673,
  "openingHours": ["Monday: 7:00 AM – 9:00 PM", "Tuesday: 7:00 AM – 9:00 PM"],
  "priceLevel": "$$",
  "url": "https://www.google.com/maps/place/?q=place_id:ChIJfbedxbZZwokRpbnR5BBdz1c",
  "scrapedAt": "2026-10-14T09:00:00.000Z"
}
```

#### Directions Record Example

```json
{
  "origin": "Empire State Building, New York",
  "destination": "Times Square, New York",
  "waypoints": [],
  "travelMode": "driving",
  "distanceMeters": 1219,
  "distanceText": "0.8 mile",
  "durationSeconds": 393,
  "durationText": "7 min",
  "durationInTrafficSeconds": 365,
  "durationInTrafficText": "6 min",
  "trafficCondition": "Fastest route, despite the usual traffic",
  "polyline": "yvvwFjtubMaAcBiAmB...",
  "steps": [
    {
      "instruction": "Head north on 5th Ave toward W 34th St",
      "distanceMeters": 182,
      "durationSeconds": 55
    }
  ],
  "warnings": [],
  "scrapedAt": "2026-10-14T09:00:00.000Z"
}
```

#### Output Fields

| Field | Type | Description |
|---|---|---|
| `searchQuery` / `origin` | string | Source query or route start |
| `placeId` | string | Google Place ID |
| `title` | string | Business or place name |
| `category` | string | Primary business category |
| `address` | string | Full formatted address |
| `location` | object | `{ lat, lng }` coordinates |
| `phone` | string | Business phone number |
| `website` | string | Business website URL |
| `rating` | number | Aggregate star rating (0–5) |
| `reviewsCount` | integer | Total number of reviews |
| `openingHours` | string\[] | Daily hours array |
| `distanceText` | string | Human-readable distance |
| `durationText` | string | Human-readable travel time |
| `durationInTrafficText` | string | Real-time traffic duration |
| `polyline` | string | Google Encoded Polyline (route shape) |
| `steps` | object\[] | Turn-by-turn navigation steps |

***

### 💰 Cost, limits, proxy

| Metric | Value |
|---|---|
| **Pricing** | $2.50 per 1,000 items / routes |
| **Memory** | 256 MB (minimal container) |
| **Runtime / 1,000 places** | ~30 seconds |
| **Runtime / 1,000 routes** | ~75 seconds |
| **Compute Units / 1,000 places** | < 0.003 CU |
| **Proxy** | Apify Datacenter (default) → Residential (auto-escalation on 429) |
| **Max items per query** | 500 |
| **Max waypoints** | 25 per route |
| **Max queries per run** | 1,000 |

***

### 📋 Recipes

#### 1. B2B Lead Prospecting — Coffee Shops in NYC

```json
{
  "mode": "places",
  "searchQueries": [
    "coffee shops in Manhattan",
    "coffee shops in Brooklyn"
  ],
  "maxItemsPerQuery": 100
}
```

#### 2. Field Sales Route Optimization

```json
{
  "mode": "directions",
  "origin": "Madison Square Garden, New York",
  "destination": "JFK Airport, Queens",
  "waypoints": ["Brooklyn Bridge", "Red Hook, Brooklyn"],
  "travelMode": "driving",
  "avoidTolls": false
}
```

#### 3. Unified Pipeline — Find Plumbers + Calculate Delivery Routes

```json
{
  "mode": "both",
  "searchQueries": ["plumbing supplies in Chicago"],
  "maxItemsPerQuery": 20,
  "origin": "My Warehouse, Chicago",
  "destination": "Downtown Chicago",
  "travelMode": "driving"
}
```

***

### 🔍 Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| Empty dataset | Rate-limited by Google | Reduce concurrency; enable Residential proxies |
| Results in wrong language | `language`/`country` mismatch | Set `"language": "en"` and `"country": "us"` explicitly |
| Missing phone/website | Not publicly listed on Google Maps | Normal — these fields are `null` when unavailable |
| Route not found | Invalid location names | Use full address format or `"lat,lng"` coordinate string |
| Direction duration mismatch | Traffic data unavailable at query time | Try again — traffic data is real-time |

***

### ❓ FAQ

**Q: How much does this Actor cost to run?**
A: Flat $2.50 per 1,000 places or routes. No filter taxes, no detail penalties, no CU surprises. A 10,000-place scrape costs approximately $25.

**Q: Is this faster than other Google Maps scrapers?**
A: Yes. By skipping headless browsers and using direct HTTP endpoints, this Actor processes queries 10–50× faster with 16× less memory (256 MB vs 4 GB).

**Q: Can I scrape private or unlisted locations?**
A: No. This Actor only accesses publicly visible Google Maps business listings and routing data.

**Q: Does this work for any country?**
A: Yes. Set `"language"` and `"country"` input fields to target any Google Maps regional endpoint.

**Q: Is this legal to use?**
A: This Actor scrapes publicly accessible data from Google Maps web interfaces. Ensure compliance with Google's Terms of Service and applicable privacy laws (GDPR, CCPA). You are responsible for how you use the extracted data.

**Q: Can I republish or rebrand this Actor?**
A: No. This Actor is proprietary. You may run it on Apify. You may not copy, rebrand, or republish it. See [LICENSE](./LICENSE).

***

### ⚠️ Limitations

- Public Google Maps data only. Private or login-protected business data is not accessible.
- Review text and individual reviewer profiles are intentionally excluded (GDPR compliance).
- High-volume runs on residential IP segments may trigger rate limits.
- You are responsible for compliance with Google Maps Terms of Service and privacy laws in your jurisdiction.

***

### 🚀 Run it

Open the Actor on Apify Console and click **Start**.

***

### License

**Proprietary. All rights reserved.** Copyright (c) 2026 REXREUS.

You may run this Actor on Apify under the terms of your Apify account. You may not copy, rebrand, republish, redistribute, or claim authorship of this Actor. See [LICENSE](./LICENSE).

# Actor input Schema

## `mode` (type: `string`):

Choose what to scrape: 'places' (leads & business data), 'directions' (route calculation & traffic), or 'both' (unified pipeline).

## `searchQueries` (type: `array`):

List of place search queries (e.g. 'coffee shops in Manhattan', 'plumbers in Chicago'). Required for 'places' mode.

## `maxItemsPerQuery` (type: `integer`):

Maximum number of place results to collect per search query (1 – 500).

## `locationBias` (type: `object`):

Center the map viewport around specific coordinates to bias search results geographically.

## `origin` (type: `string`):

Starting point for route calculation. Can be a place name, address, or 'lat,lng' coordinates. Required for 'directions' mode.

## `destination` (type: `string`):

Ending point for route calculation. Can be a place name, address, or 'lat,lng' coordinates. Required for 'directions' mode.

## `waypoints` (type: `array`):

Optional list of intermediate stops along the route (max 25 waypoints).

## `travelMode` (type: `string`):

Transportation mode for directions calculation.

## `avoidTolls` (type: `boolean`):

Request routes that avoid toll roads when possible.

## `avoidHighways` (type: `boolean`):

Request routes that avoid motorways and highways when possible.

## `language` (type: `string`):

Language code for place names and directions instructions (e.g. 'en', 'fr', 'de', 'id').

## `country` (type: `string`):

Country code for regional results bias (e.g. 'us', 'gb', 'id', 'au').

## `proxyConfiguration` (type: `object`):

Apify proxy settings. Defaults to Apify Datacenter proxies with automatic Residential fallback on rate limits.

## Actor input object example

```json
{
  "mode": "places",
  "searchQueries": [
    "coffee shops in Manhattan, New York"
  ],
  "maxItemsPerQuery": 20,
  "locationBias": {
    "lat": 40.758,
    "lng": -73.9855,
    "zoom": 14
  },
  "origin": "Empire State Building, New York",
  "destination": "Times Square, New York",
  "travelMode": "driving",
  "avoidTolls": false,
  "avoidHighways": false,
  "language": "en",
  "country": "us",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `dataset` (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 = {
    "searchQueries": [
        "coffee shops in Manhattan, New York"
    ],
    "locationBias": {
        "lat": 40.758,
        "lng": -73.9855,
        "zoom": 14
    },
    "origin": "Empire State Building, New York",
    "destination": "Times Square, New York"
};

// Run the Actor and wait for it to finish
const run = await client.actor("rexreus/google-maps-search-directions-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 = {
    "searchQueries": ["coffee shops in Manhattan, New York"],
    "locationBias": {
        "lat": 40.758,
        "lng": -73.9855,
        "zoom": 14,
    },
    "origin": "Empire State Building, New York",
    "destination": "Times Square, New York",
}

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

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

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

```

## CLI example

```bash
echo '{
  "searchQueries": [
    "coffee shops in Manhattan, New York"
  ],
  "locationBias": {
    "lat": 40.758,
    "lng": -73.9855,
    "zoom": 14
  },
  "origin": "Empire State Building, New York",
  "destination": "Times Square, New York"
}' |
apify call rexreus/google-maps-search-directions-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rexreus/google-maps-search-directions-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/3CObeABLOCqQeyhz4/builds/kD03hWedJVbOOPSQ3/openapi.json
