Launch pricing: 78% of pool capacity allocated. Rates rise as it fills. Lock in today's rate →
Skip to content

How to scrape Google Maps with Python (and what it really costs)

By SerpWiz · · 3 min read

Google Maps is the best public source of local business data: names, categories, addresses, phone numbers, websites, ratings and opening hours. Here's how to scrape it with Python, why it gets expensive at scale, and the shortcut.

Step 1: why a plain request doesn't work

Google Maps is a JavaScript application. Request https://www.google.com/maps/search/dentists+in+miami with requests and you get a page shell with no places in it. The results are loaded by scripts after the page opens, so you need a real browser.

Step 2: a headless browser

Playwright drives Chromium from Python. Install it with pip install playwright and playwright install chromium. The results list is a scrollable panel (role="feed"), and each place is a link to /maps/place/… whose aria-label is the place name:

import urllib.parse
from playwright.sync_api import sync_playwright

def scrape_maps(query, max_places=20):
    url = "https://www.google.com/maps/search/" + urllib.parse.quote_plus(query)
    places = {}
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=True)
        page = browser.new_page(locale="en-US")
        page.goto(url, wait_until="domcontentloaded")
        feed = page.locator('div[role="feed"]')
        feed.wait_for(timeout=15000)
        while len(places) < max_places:
            before = len(places)
            for a in page.locator('a[href*="/maps/place/"]').all():
                name = a.get_attribute("aria-label")
                if name and name not in places:
                    places[name] = a.get_attribute("href")
            feed.evaluate("el => el.scrollBy(0, el.scrollHeight)")   # load more
            page.wait_for_timeout(1500)
            if len(places) == before:
                break
        browser.close()
    return list(places.items())[:max_places]

print(scrape_maps("dentists in miami"))

That gets you names and links. For phone numbers, websites and hours you have to open each place, which is one more page load per place: 21 browser page loads for 20 dentists.

Step 3: where it breaks at scale

Consent pages and blocks

From an EU IP you'll hit a cookie consent page first, which you have to click through. Send many searches from one IP and Google starts showing CAPTCHAs or empty results. Data-centre IPs get blocked fastest.

Proxies

To keep going you need rotating residential proxies, usually billed per GB. Google Maps pages are heavy: a search plus 20 place pages can easily transfer several megabytes.

Selectors

Google changes the Maps markup regularly, and class names are generated. Selectors based on roles and aria-labels last longer, but expect to fix your parser every few weeks.

Location

Results depend on where the request comes from. To get Miami results reliably, put the city in the query or use proxies in the right country.

Speed and servers

Each search takes several seconds in a browser, and each place page several more. Running thousands a day means a fleet of browsers, each using hundreds of megabytes of memory.

Step 4: what it costs

For 10,000 searches a month with details for 20 places each, you're loading about 210,000 pages. Add residential proxy traffic, servers to run the browsers, and your time to keep it working. Most teams find the proxies alone cost more than an API.

On SerpWiz, 10,000 Maps searches a month costs $10 on a monthly plan or $7.50 a month annual, with up to 200 places in each search and the details included. Failed requests are free.

Step 5: or call an API

The SerpWiz Google Maps API runs all of the above for you and returns the places as JSON, phone, website, rating and hours included:

import os, requests

r = requests.get(
    "https://api.serpwiz.com/v1/google/maps",
    params={"q": "dentists in miami", "num": 20},
    headers={"X-API-Key": os.environ["SERPWIZ_API_KEY"]},
    timeout=60,
)
for place in r.json()["results"]:
    print(place["title"], place.get("phone"), place.get("website"))

Add reviews=1 for reviews and images=1 for photos. Use lat, lng and radius_km to search around a point.

Build or buy?

Scrape it yourself if you need a few hundred places once and have time to babysit a browser. For anything recurring, such as lead lists, directories, local SEO or enrichment, an API is cheaper than the proxies alone. You get 1,000 free queries a month to try it, no card required.

If you're paying for Google's official Places API today, see the Google Places API alternative.

More from the blog

This post as Markdown: /blog/scrape-google-maps-python.md