AIMultipleAIMultiple
No results found.

Google Maps Scraper: Step-by-Step Tutorial and Tools

Gulbahar Karatas
Gulbahar Karatas
updated on Sep 29, 2025

Search Engine Result Page (SERP) Scraper APIs focus on web page rankings and keyword-specific information from across the internet, while Google Maps scrapers specialize in extracting business and location-based data directly from Google Maps.

In this article, we’ll explore the top Google Maps scraper tools and provide a step-by-step Python tutorial showing how to build your own Google Maps scraper.

How to scrape Google Maps with Python

With this script, we can extract business names, addresses, phone numbers, ratings, review counts, opening hours, websites, and customer reviews directly from Google Maps search results.

Complete code structure

Our scraper is built around 7 main functions. Each function handles a specific part of the web scraping process:

  • create_driver(): Sets up the Chrome browser
  • search_places(): Main function that coordinates everything
  • extract_businesses(): Finds businesses and manages scrolling
  • extract_name_from_url(): Gets business names from URLs
  • scroll_results(): Scrolls down to load more results
  • get_business_info(): Extracts detailed business information
  • save_results(): Saves the collected data into a JSON file

Step 1: Set up your browser environment

To interact with Google Maps, we first need to launch a Chrome browser session with Selenium. This is handled by the create_driver() function.

Why we use temporary profiles

When Chrome detects automation, Windows Defender may show warnings about resetting browser settings. By creating a temporary profile, we avoid interfering with your main Chrome installation. The temporary directory is automatically cleaned up when the program ends.

Why we use minimal configuration

We tested many advanced “anti-detection” methods, but most either break easily or cause extra problems. This simple approach, using a temporary profile with minimal flags, works reliably for our purposes.

Step 2: Search businesses on Google Maps with Selenium

The search_places() function serves as the entry point for our scraper. It opens Google Maps with a specific search query and location, waits for the page to load, and then triggers the business extraction process.

Key details

  • URL construction: Instead of manually navigating Google Maps, we build the URL directly. Spaces are replaced with + for proper URL encoding.
  • 15-second wait: This delay ensures the page fully loads and gives you time to dismiss any cookie pop-ups.
  • Error handling: The try-except-finally block guarantees the browser closes even if an error occurs.

Customizable parameters

  • query → The search term (e.g., “coffee shop”, “restaurant”, “hotel”)
  • location → The city or area to search (e.g., “Berlin”, “Munich”, “Hamburg”)
  • max_results → The number of businesses to scrape (default = 20; you can increase to 50, 100, etc.)

Step 3: Extract business listings from Google Maps search results

The extract_businesses() function is responsible for collecting business links and details from Google Maps search results. It scrolls through the page, extracts businesses, avoids duplicates, and stops once the desired number of results is reached.

Key details

  • Why XPath instead of CSS selectors
    Google frequently changes its CSS class names, but the /place/ URL pattern is more stable. Using this XPath helps reliably capture business links.
  • Business dictionary structure
    Each business is stored as a dictionary with default ‘N/A’ values. This ensures a consistent format even if some fields are missing.
  • Duplicate prevention
    The check if not any(b[‘name’] == name for b in businesses) ensures that the same business isn’t added twice.
  • Scroll limit of 8
    The function will scroll up to 8 times to find results. You can increase this limit, but higher numbers result in longer execution times.
  • New results detection
    If no new businesses are found after three consecutive scrolls, the function stops early to avoid infinite loops.

Step 4: Extract business names from Google Maps URLs

The extract_name_from_url() function extracts business names directly from the Google Maps URL. This method is the most reliable because names are always embedded in the /place/ part of the URL.

Why we extract names from URLs

We tested multiple methods for extracting business names:

  1. Reading text directly from page elements → Often unreliable, sometimes empty.
  2. Parsing complex DOM structures → Breaks easily due to dynamic loading.
  3. Extracting from URLs → Works consistently because Google always includes the business name in the /place/ URL.

This is why URL extraction is the most robust approach.

URL decoding process

Google Maps encodes business names in URLs. For example:

  • Raw URL: KPM+Caf%C3%A9
  • urllib. parse.unquote() converts %C3%A9 → é
  • .replace(‘+’, ‘ ‘) converts + → space
  • Final result: “KPM Café”

Step 5: Scroll through Google Maps results

The scroll_results() function handles scrolling through the Google Maps results panel. Since not all businesses load at once, scrolling is required to reveal additional results.

Why .m6QErb class?

Through testing, we found that this CSS class reliably represents the scrollable container for Google Maps search results. Other selectors were either missing or didn’t scroll correctly.

Two-step scroll process

  1. Partial scroll → Moves down by 300 pixels to trigger new results loading.
  2. Full scroll → Moves to the very bottom to reveal all available results.
  3. Validation → Confirms that the scroll position actually changed. If it didn’t, the function returns False.

Scroll validation

This check prevents wasted time if scrolling fails. If the scroll doesn’t move, the scraper knows no additional results can be loaded.

Step 6: Extract business details (ratings, reviews, address, website, hours)

The get_business_info() function collects detailed information about each business. It clicks into the business detail panel and extracts data such as ratings, reviews, address, phone number, website, opening hours, and a short review snippet.

Key details

  • Why click on each business?
    Basic info (name, category) is visible in the list, but details (address, phone, website, hours) only appear when you open the business panel.
  • Scroll into view
    Ensures the business link is visible before attempting to click it.
  • 4-second wait
    Allows time for the detail panel to load completely.
  • Text section isolation
    By extracting 1500 characters around the business name, we avoid mixing in details from other businesses on the page.

Data extraction strategies

  • Business name anchoring → Ratings and reviews are searched after the business name appears, ensuring accuracy.
  • Fallback system → If the anchored search fails, a secondary check is performed just after the business name.
  • Address extraction → Since addresses vary by country, regex patterns are used (with examples for German formats: straße, platz, weg, allee + postal codes).
  • Phone extraction → Multiple regex patterns handle Berlin numbers (030) and general German formats.
  • Website filtering → Captures only real business websites, ignoring Google and social media links.
  • Visibility check → link.is_displayed() ensures we only capture links from the active panel.
  • Hours patterns → Works with both German (“Geöffnet”, “Schließt”) and English (“Open”, “Closed”).
  • Review extraction → Finds short customer reviews in quotes (10–100 characters long).

Country customization

This function is tailored to German formats (addresses, phone numbers). To adapt it for other countries, you’ll need to adjust the regex patterns for local conventions.

Step 7: Export data to JSON

The save_results() function saves the scraped data to a JSON file for later use.

Key details

  • Error handling → Wrapped in a try-except to catch file-writing issues (e.g., disk space, permissions).
  • UTF-8 encoding → ensure_ascii=False allows proper saving of special characters (e.g., ä, ö, ü).
  • Pretty printing → indent=2 makes the JSON file easy to read.

Step 8: Run the Google Maps scraper and print results

The main() function ties everything together: it launches the scraper, runs a query, prints results, and saves them.

Key details

  • Output formatting → Only prints fields that contain actual values (not ‘N/A’), keeping results clean.
  • Results enumeration → enumerate(results, 1) numbers businesses starting from 1.
  • Conditional display → Fields like phone, website, or hours only appear if found.

Step 9: Customize the Google Maps scraper (queries, scrolling, wait times)

You can easily customize the scraper by changing parameters.

Change search parameters:

Adjust scroll behavior:

Modify wait times:

When to use 3rd-party tools vs. build your own

Depending on your needs, you can:

  • Use a third-party Google Maps extractor
    • Providers handle proxy rotation, CAPTCHA solving, and data exports.
    • Suitable for non-technical users or businesses that require rapid data access.
  • Build a DIY Google Maps scraper if you need flexibility (as shown in the tutorial)
    • Offers complete control over what you scrape and how you structure the data.
  • Leverage the Google Places API service for compliance
    • Has quotas, requires billing, and doesn’t expose all data available on Maps.

Final notes

This Google Maps extractor extracts business data from Google Maps locations, including names, addresses, ratings, reviews, phone numbers, and websites.

You can adapt it for different countries by modifying:

  • Address regex patterns (to fit local formats)
  • Phone number regex patterns (to match local dialing rules)

Disclaimer: This tutorial is for educational purposes only. Scraping Google Maps data may violate Google’s Terms of Service.

FAQs about Google Maps scrapers

Industry Analyst
Gulbahar Karatas
Gulbahar Karatas
Industry Analyst
Gülbahar is an AIMultiple industry analyst focused on web data collection, applications of web data and application security.
View Full Profile

Be the first to comment

Your email address will not be published. All fields are required.

0/450