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

Scrape Google Maps business listings by keyword + location: name, address, phone, website, rating, reviews, category, coordinates, hours. For lead generation & market research. Note: generic 'hotel' queries return no results (Google redirects them to booking).

- **URL**: https://apify.com/andreaszcw/google-maps-scraper.md
- **Developed by:** [andreas zico wijaya](https://apify.com/andreaszcw) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$50.00 / 1,000 scraped run (up to 50 places)s

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

## Google Maps Places Scraper

Scraper tempat/bisnis Google Maps (nama, alamat, telepon, rating, jumlah ulasan,
kategori, website, koordinat, jam buka, place_id, URL Maps) — mengikuti pola
`tokopedia-scraper`: `curl_cffi` + impersonasi browser, retry, proxy→direct
fallback, dedupe, output JSON/CSV bersih.

### Metode (terverifikasi live, 10 Nov 2026)

Halaman search Google Maps (`google.com/maps/search/...`) adalah shell JS tanpa
hasil di HTML. Hasil diambil dari endpoint RPC internal Google (protobuf-over-JSON,
prefix anti-XSSI `)]}'`), dua langkah:

**1. Search** — daftar feature-id tempat:

```
GET https://www.google.com/search?tbm=map&q=<query>&hl=en&pb=!7i20
```

- 20 hasil/halaman; halaman berikut: tambah `!8i<offset>` (offset 20, 40, ...).
- Feature-id diekstrak dari triple `[null, null, "0x<hex>:0x<hex>"]` di bagian
  "spotlight" (tepat 20/halaman, terverifikasi; fid lokasi pencarian dikecualikan).

**2. Detail per tempat** — data lengkap satu tempat:

```
GET https://www.google.com/maps/preview/place?authuser=0&hl=en&gl=us&pb=<pb>
```

- `<pb>` adalah template yang ditangkap (1.116 karakter) dengan hanya
  feature-id diganti — terverifikasi mengembalikan tempat yang benar.
- Array detail ("darray") ada di index `[6]` respons JSON.
- **Fallback:** jika template gagal, ambil halaman
  `https://www.google.com/maps?cid=<cid>&hl=en` (cid = `int(fid.split(":")[1], 16)`)
  dan ekstrak pb segar dari tag `<link href="/maps/preview/place?...&pb=...">`.

Cookie sesi (NID) TIDAK diperlukan dalam pengujian — field kaya (jumlah ulasan,
distribusi rating, URL ulasan) tetap hadir. Jika Google mulai memangkas field,
solusi terdokumentasi: mint NID via `GET /maps` lalu pakai sebagai cookie.

### Penggunaan

```bash
pip install -r requirements.txt

## via proxy (baca PROXY_USER / PROXY_PASS / PROXY_PORT dari environment)
python run.py --keyword "coffee shop" --location "Jakarta" --max-results 10

## direct (tanpa proxy)
python run.py --keyword "coffee shop" --location "Jakarta" --max-results 10 --no-proxy

## output file
python run.py --keyword hotel --location Bandung --max-results 20 --output hasil.csv
python run.py --keyword "restaurant" --location "Bandung" --min-rating 4.5 --output hasil.json
```

Opsi: `--keyword` (wajib), `--location`, `--max-results` (default 20),
`--min-rating` (filter client-side), `--no-proxy`, `--max-workers` (default 5),
`--output` (`.json` / `.csv`, default stdout JSON).

#### Proxy

Host `unlimit.residential.123proxy.co`, port acak 10535–10559. Kredensial HANYA
via environment variable — jangan pernah tulis ke file:

```bash
export PROXY_USER=... PROXY_PASS=... PROXY_PORT=10535
```

Tanpa env tersebut, request otomatis direct. Setiap request: retry 1x,
lalu fallback proxy→direct.

#### Dari kode Python

```python
from gmaps import search
places = search(keyword="coffee shop", location="Jakarta", max_results=10)
```

### Field output

| Field | Keterangan |
|---|---|
| `name`, `feature_id`, `cid`, `place_id` | Identitas tempat (place_id format `ChIJ…`) |
| `address`, `address_local`, `neighborhood` | Alamat lengkap / lokal / area |
| `categories` | Daftar kategori (mis. `Coffee shop`, `Restaurant`) |
| `description` | Deskripsi singkat tempat |
| `rating`, `review_count`, `rating_distribution` | Rating 0–5, jumlah ulasan, distribusi 1–5★ |
| `phone`, `website` | Telepon, website |
| `latitude`, `longitude` | Koordinat |
| `hours` | Jam buka per hari (teks + jam buka/tutup) |
| `hours_status` | Status saat ini (mis. "Open ⋅ Closes 7 PM") |
| `map_url`, `reviews_url` | URL Google Maps & halaman ulasan |
| `kgmid` | Knowledge Graph ID |

### Hasil verifikasi (10 Nov 2026)

| Tes | Jalur | Hasil |
|---|---|---|
| `coffee shop` Jakarta, 10 hasil | proxy | ✅ 10/10 tempat asli (Giyanti Coffee Roastery 4.6★/4.437 ulasan, Lucky Cat Coffee 4.4★/5.945, 1/15 Coffee Menteng, Bakoel Koffie, dll.) — ~57 detik |
| `restaurant` Bandung, 10 hasil | proxy | ✅ 10/10 tempat asli (Hummingbird Eatery 4.8★/13.205, Braga Permai 4.6★/8.427, Miss Bee Providore, dll.) — ~44 detik |
| `coffee shop` Jakarta, 5 hasil | **direct** (tanpa proxy) | ✅ 5/5, tempat pertama Giyanti Coffee Roastery — direct jalan dari VM |
| `coffee shop` Jakarta, 25 hasil | proxy (paginasi) | ✅ 25/25 unik, hasil 21–25 dari halaman 2 (Fuglen Jakarta, Common Grounds, Kopi Oey, dll.) |

Cakupan field (tes Jakarta 10): nama/alamat/kategori/rating/jumlah ulasan/
koordinat/jam buka/URL Maps 10/10, telepon 9/10, website 8/10.
(Bandung 10: telepon 10/10, website 8/10.)

Error sesekali (TLS error / timeout 30 detik) terjadi dan ditangani retry —
tidak ada tes yang gagal total.

### Batasan yang ditemukan

- **Query generik "hotel"/"hotels" mengembalikan 0 hasil.** `hotel Bandung`,
  `hotel Jakarta`, dan `hotels in Bandung` semuanya HTTP 200 tapi tanpa bagian
  "spotlight" — Google mengarahkan query hotel ke antarmuka booking (butuh
  tanggal) yang memakai alur berbeda. Kategori lain (`restaurant`, `cafe`,
  `coffee shop`) normal 20/halaman. Nama hotel spesifik kemungkinan tetap
  jalan (belum diuji) — perlu riset lanjutan sebelum menjual dataset hotel.
- **Paginasi:** 20/halaman; belum diuji batas atas jumlah halaman per query
  (Google Maps web biasanya berhenti di ~100–200 hasil per query).
- **Rate limit:** belum dipetakan. Kecepatan terukur ~0,5–2 detik/tempat
  (detail paralel 5 worker). Untuk volume besar perlu throttling + rotasi port
  proxy (10535–10559) dan uji batas harian.
- **Stabilitas template pb:** template detail ditangkap 10 Nov 2026; jika
  Google mengubah format pb, fallback (ekstrak pb segar dari halaman tempat)
  sudah disiapkan di kode.
- **Ketentuan Google Maps Platform melarang scraping/ekspor konten Maps**
  — sama seperti scraper Tokopedia, ini area abu-abu (pelanggaran ToS, bukan
  kriminal). Riset lanjutan: cek apakah Apify Store menerima Actor Google Maps
  (banyak Actor sejenis sudah ada di Store).

### Alternatif resmi: Google Places API (New)

- Text Search: maks 20/halaman, **maks 60 hasil per query** (3 halaman).
- Harga (cek 10 Nov 2026, per 1.000 panggilan, setelah kuota gratis):
  Text Search Pro **$32** (5.000 gratis/bulan) — nama/alamat/lokasi saja;
  Text Search **Enterprise $35** (1.000 gratis/bulan) — tambah telepon,
  website, rating, jumlah ulasan; Enterprise + Atmosphere **$40**.
  Place Details Enterprise **$20**/1.000.
- Dihitung per panggilan (per halaman 20 tempat), bukan per bisnis:
  1.000 bisnis ≈ 50 panggilan ≈ $1,75 (tarif Enterprise, setelah kuota gratis).
- Sejak 1 Mar 2025, kredit flat $200/bulan diganti kuota gratis per-SKU.
- **Tidak diaktifkan** — butuh billing Google Cloud; hanya dicatat sebagai opsi.

### Yang masih dibutuhkan sebelum jadi produk

- **Apify Actor:** bungkus `gmaps.py` + `actor.json` + `Dockerfile` (pola
  Tokopedia Actor), tentukan harga per-event; uji batas halaman & rate limit.
- **Fiverr gig:** paket per jumlah tempat (mis. 100/500/1.000 tempat) +
  pilihan kategori/lokasi; perhatikan larangan query hotel generik.
- **RapidAPI:** bungkus API server (pola `tokopedia-scraper/rapidapi/`),
  tentukan tier; perhitungkan biaya proxy + waktu per request (~1–2 detik/tempat).
- **Riset hotel:** cari alur endpoint hotel (booking) atau batasi gig ke
  kategori non-hotel sampai ada solusi.
- **Uji beban:** berapa query/hari aman via proxy sebelum Google memblokir
  (belum diuji).

### Apify Actor

- **Actor:** `andreaszcw/google-maps-scraper`, id `7Qgp8fLd8ggLMQA6p`
  — https://console.apify.com/actors/7Qgp8fLd8ggLMQA6p
- **Build 0.0.1** (`id5FqpsPEgxGvQnHT`) **SUCCEEDED** (10 Nov 2026, ~12 detik).
  Source di-upload via API `PUT /v2/acts/{id}/versions/0.0` (10 file:
  `.actor/actor.json`, `input_schema.json`, `output_schema.json`,
  `Dockerfile`, `main.py`, `gmaps.py`, `run.py`, `requirements.txt`,
  `apify.json`, `README.md`); env `PROXY_USER` + `PROXY_PASS` (secret)
  diset di version. Charge per run via event `scraped-run`
  (`Actor.charge(..., count=1)`, di `main.py`) — tepat 1x per run yang
  berhasil, maks 50 tempat/run.
- **Test run terverifikasi:** `coffee shop` Jakarta, 5 hasil → **5 tempat
  asli** (Giyanti Coffee Roastery 4.6★/4.437 ulasan, Lucky Cat Coffee &
  Kitchen 4.4★/5.945, 1/15 Coffee Menteng 4.5★/2.750, Jakarta Coffee
  House 4.5★/762, Guten Mørgen Coffee Lab Tomang 4.6★/1.003) — nama,
  alamat, telepon, website, rating, koordinat lengkap. Run async kedua
  (2 hasil) juga SUCCEEDED.
- **Harga (diputuskan 11 Nov 2026, user delegasikan ke asisten):**
  **$0,05 per RUN** (bukan per tempat), maks 50 tempat/run — efektif
  $1,00/1.000 tempat, ~33% di bawah kompetitor termurah Store
  ($1,50–$4/1.000). Pay-per-event min $0,05/event membuat charge
  per tempat ($0,05/tempat = $50/1.000) tidak kompetitif, jadi model
  per-run + cap 50 adalah satu-satunya struktur yang viable.
  Owner keeps 80% ($0,04/run, margin Apify 20%).
- **Catatan API:** `POST /v2/acts/{id}/runs` bekerja bila field input
  dikirim di **top level body** (bukan dibungkus `"input": {...}` —
  itu gagal 400 `input.keyword is required`). `POST
  /v2/acts/{id}/run-sync-get-dataset-items` memakai input sebagai body
  langsung.

# Actor input Schema

## `keyword` (type: `string`):

Kata kunci pencarian tempat (mis. coffee shop, restaurant, salon). Hindari query generik 'hotel' — Google mengarahkannya ke booking dan mengembalikan 0 hasil.

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

Lokasi pencarian (mis. Jakarta, Bandung, Surabaya).

## `max_results` (type: `integer`):

Jumlah maksimum tempat yang diambil (maks 50 per run — harga $0,05 per run, bukan per tempat).

## `min_rating` (type: `number`):

Rating minimum 0-5 (opsional).

## `use_proxy` (type: `boolean`):

Pakai proxy residential 123Proxy (butuh env PROXY_USER / PROXY_PASS). Bila mati, request direct.

## Actor input object example

```json
{
  "max_results": 10,
  "use_proxy": true
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("andreaszcw/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 = {}

# Run the Actor and wait for it to finish
run = client.actor("andreaszcw/google-maps-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 '{}' |
apify call andreaszcw/google-maps-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,andreaszcw/google-maps-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/7Qgp8fLd8ggLMQA6p/builds/5tpd8Eekc6AjrmZFK/openapi.json
