How to build a Google Maps scraper
This resource is based on A copy-paste prompt that edits the slop out of any document, featuring Bharatt Arorah of Claygen, published on the AI Lab by ActiveCampaign.

Get the checklist
Before you start
Make sure to:
- Install the Claude Code desktop app: you’ll need at least a Pro plan
- Install Python 3.11 or newer
- Create a new, empty project folder: name it something you’ll recognize (e.g. “maps-scraper”) and open it as your project in Claude Code
- Sign up for a RapidAPI account: you’ll use it to subscribe to the Maps Data API in phase 1
The workflow
Phase 1: Get your data and API access
After this phase, you’ll have: a coordinates file, a live RapidAPI key, and a confirmed working connection to the Maps Data API.
- Download the coordinates file: US coordinate pairs spaced roughly 5 km apart, sourced from GeoNames—save it into your project folder. This is what lets you search a location like “Dallas” instead of raw lat/lng pairs, without the scraper missing businesses or double-counting them.
- Subscribe to the Maps Data API on RapidAPI: the free plan (1,000 requests/month) covers a business category in a mid-sized US city; the $3/month basic plan covers a search across the entire United States
- Grab your X‑RapidAPI-Key: from the Search endpoint’s App tab, in the RapidAPI dashboard
- Create a .env file: store RAPIDAPI_KEY and RAPIDAPI_HOST in your project folder (or let Claude create it for you and just paste in your key)
- Run a smoke test before scraping anything: confirm your key and coordinate file both work with a single API call
Smoke test
Create a file called test_api.py that makes exactly ONE request to the Maps Data API to confirm my setup works without wasting my quota. It should: load RAPIDAPI_KEY and RAPIDAPI_HOST from .env; read the first coordinate from [COORDINATES_FILE]; call https://maps-data.p.rapidapi.com/searchmaps.php with query=[TEST_KEYWORD], limit=1, country=us, lang=en, offset=0, zoom=13, and that coordinate’s lat/lng; send the key and host as the x‑rapidapi-key and x‑rapidapi-host headers; print the HTTP status and the first business name. If the status is 401/403, tell me my key is wrong; if 429, tell me I’ve hit my quota.
“I understood outbound. I understood GTM. I understood lead generation, data, copy, offers, segmentation, deliverability, and campaign execution. But I did not think of myself as someone who could build software. AI changed that.”
Phase 2: Build the core scraper
After this phase, you’ll have: a command-line tool that searches a keyword across your coordinate grid and exports a deduplicated CSV of local businesses.
- Build the basic scraper: prompt Claude Code to build a Python CLI that reads your coordinate file, calls the Maps Data API, deduplicates results, and exports a CSV—see prompt-template.md for the full build prompt
- Run the scraper on a single keyword: confirm the output CSV has clean, deduplicated business data
- Review failed_requests.csv: check for coordinates that timed out or errored, and re-run if needed
“Most teams obsess over subject lines, templates, and copy tweaks. Those things matter, but they are downstream. If the list is bad, the campaign is already broken.”
Phase 3: Add scraper features
After this phase, you’ll have: a scraper that searches multiple keywords at once and lets you exclude cities you don’t want to target.
- Add multi-keyword support: run comma-separated keywords (e.g. “Yoga, Gym, Pilates”) in parallel and combine the results into one deduplicated CSV
- Add city exclusion support: filter out specific cities before scraping a broad state or multi-state area
Multi-keyword support prompt
Update the scraper so it supports comma-separated keywords. Like if someone types “[KEYWORD_1], [KEYWORD_2], [KEYWORD_3]”, it should run a separate search for each keyword, then combine all the results into one CSV and remove duplicates across keywords.
City exclusion support prompt
Add support for excluding specific cities. If the user selects a broad location scope, like an entire state or multiple states, ask whether they want to exclude any cities. The user should be able to enter comma-separated city names to exclude, e.g. [CITY_1, CITY_2, CITY_3]. Before scraping, remove any coordinate rows where the city matches one of the excluded cities. Make the matching case-insensitive and trim extra spaces. After filtering, print how many coordinates were removed and how many remain.
Phase 4: Turn it into a web app
After this phase, you’ll have: a hosted dashboard where anyone on your team can enter a keyword and location, run a scrape, and download results—no terminal required.
- Build the background job system: a worker that stores jobs in a JSON file with statuses (queued, running, completed, failed, cancelled) and runs the scraper for each queued job
- Build the web app and form page: a FastAPI app with a form for entering a keyword, picking a scope, and excluding cities
- Build the results dashboard: a table showing every job’s status and progress, with buttons to cancel, download the CSV, or delete old jobs
Phase 5 (optional): Add email enrichment
After this phase, you’ll have: business results with verified email addresses, ready for an outbound campaign.
- Add email enrichment to the scraper: for each business with a website, check the homepage and common contact pages for a public email, filtering out placeholders and tracking-script noise
- Or send results to Clay: import your CSV (or wire up a “send to Clay” button) and run an agent that crawls each site, finds emails, and verifies them
Quick reference
- Total time: a few hours to get the core scraper working end-to-end; a full afternoon to add the web app and dashboard
- Tools needed: Claude Code desktop app, Python 3.11+, a RapidAPI account (Maps Data API), optionally Clay for email verification
- Key output: a self-serve tool that turns a keyword and location into a clean, deduplicated CSV—or a live dashboard—of local business leads
Ready for the full story?
Read A copy-paste prompt that edits the slop out of any document, featuring Tim Metz of Animalz, published on the AI Lab by ActiveCampaign.
Related
More data from the AI Lab.