Google Maps Scraper: Install, Source and Security

Google Maps Scraper

Published by bungkust in bungkust-skills

Review recommended8 installs

What this skill does

Scrape lokasi dari Google Maps β€” coffee shop, restoran, tempat wisata. Trigger: 'scrape google maps', 'cari coffee shop', 'cari tempat makan'

Add Google Maps Scraper to your agent

Review the source and files first. When you are ready, copy the prompt instruction or use the CLI command supported by your environment.

Install with a prompt

Paste this into a compatible coding agent:

add this skill "google-maps-scraper" from https://github.com/bungkust/bungkust-skills

Install with the CLI

Run this command in a controlled environment after reviewing the repository:

npx skills add https://github.com/bungkust/bungkust-skills --skill google-maps-scraper

Skill instructions

πŸ—ΊοΈ Google Maps Scraper

Scrape data lokasi dari Google Maps tanpa API key. Pakai Playwright untuk bypass bot detection.

Dependencies

pip install playwright
python -m playwright install chromium

Kalau headless server/VPS, butuh extra deps:

sudo apt install -y libnss3 libatk-bridge2.0-0 libdrm2 libxkbcommon0 libgbm1 libasound2

Cara Pakai

CLI (direct)

python gmaps_scraper.py "coffee shop" "Yogyakarta" --max 20
python gmaps_scraper.py "restoran" "Jakarta Selatan" --max 10 -o hasil.csv
python gmaps_scraper.py "tempat wisata" "Bali" --max 15

Via AI Agent

"Cari coffee shop di Jogja dari Google Maps"
"Scrape restoran di Jakarta Selatan rating >4.5"
"Tempat wisata di Bali yang buka 24 jam"

Arguments

ArgDefaultDescription
queryrequiredSearch query (e.g. "coffee shop")
locationrequiredLocation (e.g. "Yogyakarta")
--max50Max results
--output, -oautoOutput CSV path
--headlessTrueRun without browser UI
--no-headless-Show browser (debug)
--delay1.5Scroll delay (seconds)

Output Format

CSV/JSON dengan fields:

FieldContoh
NameKopi Kultur
Rating4.8
Reviews1234
Price_rangeRp 25–50 rb
CategoryKedai Kopi
AddressJl. Kaliurang KM 5
Phone0812-xxxx-xxxx
Websitekopikultur.com
HoursBuka Β· Tutup pukul 22.00

Teknis

  1. Buka Google Maps search URL
  2. Scroll results panel untuk load lebih banyak listing
  3. Klik setiap card β†’ extract data dari detail panel
  4. Parse: Name, Rating, Reviews, Price, Category, Address, Phone, Website, Hours
  5. Save ke CSV + JSON

Limitasi

  • Tanpa login Google: max ~20 results per search
  • Rate limit: jangan scrape terlalu cepat (default delay 1.5s)
  • Data bisa berubah sewaktu-waktu (Google update struktur)
  • CSS selectors mungkin perlu update kalau Google Maps redesign

Troubleshooting

ProblemFix
playwright not foundpip install playwright && python -m playwright install chromium
chromium failed to launchsudo apt install libnss3 libatk-bridge2.0-0 libdrm2 libxkbcommon0 libgbm1 libasound2
timeoutGoogle Maps loading lambat, coba tambah timeout atau cek network
no resultsCoba query yang lebih spesifik
0 data / CSS selector errorGoogle Maps pakai button bukan a β€” sudah di-fix (auto-detect)
redirect ke detail pageAuto-retry dengan coordinate URL + search box fallback

Changelog

2026-04-16 β€” Robust Selector + Redirect Fix

  • Fix: Selector a[class*="hfpxzc"] β†’ auto-detect button (new) / a (old) / aria-label fallback
  • Fix: Handle redirect ke detail page β†’ auto-retry dengan coordinate URL + search box
  • New: get_listing_cards() β€” unified card detection
  • New: is_detail_page() β€” detect if redirected to single listing
  • New: Debug screenshot saved if no cards found

2026-04-16 β€” URL-Based Extraction (v2)

  • Fix: Click-based extraction only got 7 results (DOM breaks after clicking)
  • New: get_card_links() β€” collect all place URLs first, then visit one-by-one
  • New: extract_from_detail() β€” extract data when already on a place URL
  • New: extract_listings_click() β€” fallback click-based approach
  • Result: 7 β†’ 45+ results per search
  • Default: --max changed from 20 to 50

Made with ❀️ by @bungkust

Files included

  • gmaps_scraper.py
  • HOWTO.md
  • SKILL.md

More skills