Google Maps data powers local lead generation, competitive analysis, and location intelligence workflows. Scraping Maps directly is unreliable because Google uses heavy anti-bot protections and frequently changes its DOM structure. The Scavio API returns structured Maps data including business names, addresses, phone numbers, ratings, review counts, and opening hours as clean JSON. This tutorial shows how to query local business data through a SERP API in Python and JavaScript. You will build a simple pipeline that extracts and filters businesses by rating and review count.
Prerequisites
- Python 3.8+ or Node.js 18+ installed
- requests library installed (Python)
- A Scavio API key from scavio.dev
- A target location and business category to search
Walkthrough
Step 1: Configure the search query
Set up your API key and define the local business search query with location context.
import os, requests
API_KEY = os.environ["SCAVIO_API_KEY"]
QUERY = "plumbers in Austin TX"Step 2: Fetch Maps results
POST to the Scavio API with a Google Maps query. The response includes local_results with business details.
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": QUERY, "type": "maps"})
data = resp.json()
locals = data.get("local_results", [])Step 3: Filter by rating and reviews
Filter businesses to find high-quality leads based on minimum rating and review count.
quality_leads = [
b for b in locals
if float(b.get("rating", 0)) >= 4.0 and int(b.get("reviews", 0)) >= 20
]
for b in quality_leads:
print(f"{b['title']} - {b.get('rating')} ({b.get('reviews')} reviews)")
print(f" {b.get('address', 'N/A')} | {b.get('phone', 'N/A')}")Step 4: Export leads to JSON
Save the filtered leads to a JSON file for CRM import or outreach pipelines.
import json
leads = [{
"name": b.get("title", ""),
"address": b.get("address", ""),
"phone": b.get("phone", ""),
"rating": b.get("rating", ""),
"reviews": b.get("reviews", 0),
"url": b.get("link", ""),
} for b in quality_leads]
with open("leads.json", "w") as f:
json.dump(leads, f, indent=2)
print(f"Exported {len(leads)} leads")Python Example
import os, requests
API_KEY = os.environ["SCAVIO_API_KEY"]
resp = requests.post("https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "google", "query": "plumbers in Austin TX", "type": "maps"})
for b in resp.json().get("local_results", [])[:5]:
print(f"{b['title']} - {b.get('rating')} stars")JavaScript Example
const r = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST",
headers: {"x-api-key": process.env.SCAVIO_API_KEY, "Content-Type": "application/json"},
body: JSON.stringify({platform: "google", query: "plumbers in Austin TX", type: "maps"})
});
const data = await r.json();
(data.local_results || []).slice(0, 5).forEach(b =>
console.log(b.title, b.rating, b.reviews)
);Expected Output
A list of local businesses with name, address, phone, rating, and review count extracted from Google Maps as structured JSON.