ScavioScavio
FeaturesPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Scrape Google Maps Business Data Without Getting Blocked
Tutorial

How to Scrape Google Maps Business Data Without Getting Blocked

Extract Google Maps business listings programmatically using the Scavio API. Get names, addresses, ratings, reviews, and phone numbers in structured JSON.

Get Free API KeyAPI Docs

Google Maps business data is essential for lead generation, local SEO audits, and market research. Scraping Google Maps directly triggers aggressive anti-bot protections including CAPTCHAs, IP bans, and JavaScript challenges. The Scavio API lets you search for local businesses by query and location, returning structured JSON with business name, address, rating, review count, phone number, and website. This tutorial shows how to query Google Maps data for any business category and location, then export the results for outreach or analysis.

Prerequisites

  • Python 3.8 or higher
  • requests library installed
  • A Scavio API key
  • A target business category and location to search

Walkthrough

Step 1: Search for local businesses

POST to the Scavio endpoint with a Google Maps-style query including the business type and location. The local_results field contains structured business listings.

Python
import os
import requests

API_KEY = os.environ.get("SCAVIO_API_KEY", "your_scavio_api_key")
ENDPOINT = "https://api.scavio.dev/api/v1/search"

def search_maps(query: str, location: str) -> list[dict]:
    response = requests.post(
        ENDPOINT,
        headers={"x-api-key": API_KEY},
        json={"query": f"{query} in {location}", "country_code": "us"}
    )
    response.raise_for_status()
    return response.json().get("local_results", [])

Step 2: Extract business details

Parse each local result for name, address, phone, rating, review count, and website URL.

Python
def extract_business(result: dict) -> dict:
    return {
        "name": result.get("title"),
        "address": result.get("address"),
        "phone": result.get("phone"),
        "rating": result.get("rating"),
        "reviews": result.get("reviews"),
        "website": result.get("website"),
    }

Step 3: Filter by minimum rating

Keep only businesses above a rating threshold for quality lead lists.

Python
def filter_by_rating(businesses: list[dict], min_rating: float = 4.0) -> list[dict]:
    return [
        b for b in businesses
        if b.get("rating") and float(b["rating"]) >= min_rating
    ]

Step 4: Export to CSV

Write the filtered business list to a CSV file for use in CRM imports or outreach tools.

Python
import csv

def export_csv(businesses: list[dict], filename: str = "leads.csv") -> None:
    with open(filename, "w", newline="") as f:
        writer = csv.DictWriter(f, fieldnames=["name", "address", "phone", "rating", "reviews", "website"])
        writer.writeheader()
        writer.writerows(businesses)
    print(f"Exported {len(businesses)} businesses to {filename}")

Python Example

Python
import os
import csv
import requests

API_KEY = os.environ.get("SCAVIO_API_KEY", "your_scavio_api_key")
ENDPOINT = "https://api.scavio.dev/api/v1/search"

def search_maps(query: str, location: str) -> list[dict]:
    r = requests.post(ENDPOINT, headers={"x-api-key": API_KEY},
                      json={"query": f"{query} in {location}", "country_code": "us"})
    r.raise_for_status()
    return r.json().get("local_results", [])

def extract(result: dict) -> dict:
    return {
        "name": result.get("title"),
        "address": result.get("address"),
        "phone": result.get("phone"),
        "rating": result.get("rating"),
        "reviews": result.get("reviews"),
        "website": result.get("website"),
    }

if __name__ == "__main__":
    results = search_maps("dentists", "San Francisco, CA")
    businesses = [extract(r) for r in results]
    high_rated = [b for b in businesses if b["rating"] and float(b["rating"]) >= 4.5]
    with open("leads.csv", "w", newline="") as f:
        w = csv.DictWriter(f, fieldnames=list(high_rated[0].keys()))
        w.writeheader()
        w.writerows(high_rated)
    print(f"Exported {len(high_rated)} leads")

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY || "your_scavio_api_key";
const ENDPOINT = "https://api.scavio.dev/api/v1/search";
const fs = require("fs");

async function searchMaps(query, location) {
  const res = await fetch(ENDPOINT, {
    method: "POST",
    headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify({ query: `${query} in ${location}`, country_code: "us" })
  });
  const data = await res.json();
  return (data.local_results || []).map(r => ({
    name: r.title, address: r.address, phone: r.phone,
    rating: r.rating, reviews: r.reviews, website: r.website
  }));
}

async function main() {
  const businesses = await searchMaps("dentists", "San Francisco, CA");
  const filtered = businesses.filter(b => b.rating && parseFloat(b.rating) >= 4.5);
  const header = "name,address,phone,rating,reviews,website";
  const rows = filtered.map(b => Object.values(b).join(","));
  fs.writeFileSync("leads.csv", [header, ...rows].join("\n"));
  console.log(`Exported ${filtered.length} leads`);
}
main().catch(console.error);

Expected Output

JSON
{
  "local_results": [
    {
      "title": "Pacific Heights Dental",
      "address": "2100 Webster St, San Francisco, CA 94115",
      "phone": "(415) 555-0123",
      "rating": "4.9",
      "reviews": 342,
      "website": "https://pacificheightsdental.com",
      "hours": "Open until 5:00 PM"
    }
  ]
}

Related Tutorials

  • How to Fetch Google Search Results in Python
  • How to Build a Local SEO Checker with Google Maps API Data

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8 or higher. requests library installed. A Scavio API key. A target business category and location to search. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Best Of

Best Google Maps Business Data APIs (May 2026)

Read more
Best Of

Best Google Maps API for Lead Extraction in 2026

Read more
Solution

Enrich Cold Email Campaigns with Google Maps Business Data

Read more
Solution

Get Local Business Data Without Scraping Google Maps

Read more
Glossary

Google Maps Lead Extraction

Read more
Use Case

Google Maps Business Data Enrichment

Read more

Start Building

Extract Google Maps business listings programmatically using the Scavio API. Get names, addresses, ratings, reviews, and phone numbers in structured JSON.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy