Skip to content
Projekte

Über uns

A FastAPI service for scraping Google Maps data based on search queries. Ideal for n8n users.

Weitere Projekte

So werden diese Zahlen gemessen

What you can do

  • ⚡ Parallel processing: Scrapes multiple places concurrently (configurable with concurrency parameter)
  • 📊 Comprehensive data: Name, rating, review count, address, coordinates, phone, website, categories, hours, and more
  • 🌍 Multi-language support: Works with en, es, fr, de, pt, nl, pl, sv, da, no, el, tr, and more
  • 🛡️ Anti-detection: Random delays and user agent rotation to avoid rate limiting

Gemessener Sternzuwachs

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

Google Maps Scraper API

A FastAPI service for scraping Google Maps data based on search queries. Ideal for n8n users.

Very high performance, watch out for rate limiting!

Use variables to replace URL parameters

scrape-get?query=hotels%20in%2098392&max_places=100&lang=en&headless=true"

If using n8n or other automation, use the /scrape-get endpoint for it to return results

simple install, copy files and run docker compose up -d

Intened to be used with this n8n build: https://github.com/conor-is-my-name/n8n-autoscaling

Recent Updates

February 2026 - Stability Refactor ✨

  • Major extractor refactoring for long-term reliability
    • Prioritizes semantic HTML attributes (aria-labels, data-item-id) over fragile CSS classes
    • Significantly more resistant to Google Maps interface updates
  • New field: hours - Extracts business hours by day
  • Improved category filtering - Removes UI noise from categories
  • See DATA_EXTRACTION_ANALYSIS.md for technical details

API Endpoints

POST /scrape

Main endpoint for scraping Google Maps data (accepts JSON body)

GET /scrape-get

Alternative GET endpoint with query parameters (recommended for n8n and webhooks)

GET /

Health check endpoint

API Parameters

All endpoints support the same parameters:

Parameter Type Required Default Description
query string Yes - Search query (e.g., "hotels in 98392", "restaurants near Times Square")
max_places integer No null Maximum number of results to return. If not set, returns all found results
lang string No "en"
headless boolean No true Run browser in headless mode. Set to false for debugging
concurrency integer No 5 Number of concurrent browser tabs for scraping (range: 1-20). Higher = faster but more detection risk

Parameter Notes

  • query: URL encode special characters when using GET endpoint
  • max_places: Useful for limiting API costs and response time. Without this, the scraper will continue until all results are found or the end of the list is reached
  • lang: Affects both the language of results and consent form detection. Currently supported consent forms: en (English), es (Spanish), de (German), fr (French), it (Italian), nl (Dutch), pt (Portuguese), pl (Polish), sv (Swedish), da (Danish), no (Norwegian), el (Greek), tr (Turkish)
  • headless: Set to false only for local debugging (not recommended in Docker)
  • concurrency: Default of 5 is balanced. Increase for speed (max 10 recommended) or decrease to 1-2 if experiencing rate limiting

Example Requests

POST Example

curl -X POST "http://localhost:8001/scrape" \
-H "Content-Type: application/json" \
-d '{
  "query": "hotels in 98392",
  "max_places": 10,
  "lang": "en",
  "headless": true,
  "concurrency": 5
}'

GET Example (URL encoded)

curl "http://localhost:8001/scrape-get?query=hotels%20in%2098392&max_places=10&lang=en&headless=true&concurrency=5"

Using with Docker service name

curl "http://gmaps_scraper_api_service:8001/scrape-get?query=coffee%20shops%20in%20seattle&max_places=50&lang=en"

Scraping all results (no limit)

curl "http://localhost:8001/scrape-get?query=restaurants%20in%20miami&lang=en"

Spanish language results

curl "http://localhost:8001/scrape-get?query=restaurantes%20en%20barcelona&max_places=20&lang=es"

High-speed scraping (increased concurrency)

curl -X POST "http://localhost:8001/scrape" \
-H "Content-Type: application/json" \
-d '{
  "query": "gyms in los angeles",
  "max_places": 100,
  "lang": "en",
  "headless": true,
  "concurrency": 10
}'

Running the Service

Docker

docker-compose up --build

Local Development

  1. Install dependencies:
pip install -r requirements.txt
  1. Run the API:
uvicorn gmaps_scraper_server.main_api:app --reload

The API will be available at http://localhost:8001

or for docker:

http://gmaps_scraper_api_service:8001

Response Format

Each place in the results includes:

{
  "name": "Starbucks",
  "place_id": "ChIJ...",
  "coordinates": {
    "latitude": 47.6062,
    "longitude": -122.3321
  },
  "address": "1912 Pike Pl, Seattle, WA 98101",
  "rating": 4.3,
  "reviews_count": 1234,
  "reviews_url": "https://search.google.com/local/reviews?placeid=...",
  "categories": ["Coffee shop", "Cafe"],
  "website": "https://www.starbucks.com",
  "phone": "2066241965",
  "hours": ["Monday, 5 AM to 9 PM", "Tuesday, 5 AM to 9 PM"],
  "thumbnail": "https://...",
  "link": "https://www.google.com/maps/place/..."
}

Field Notes

  • rating: Overall rating (1.0-5.0), extracted using stable accessibility attributes
  • reviews_count: Total number of reviews (numeric count)
  • hours: Business hours by day (e.g., "Monday, 5 AM to 9 PM") - extracted when available
  • reviews_url: ⚠️ DEPRECATED - This URL format no longer works and returns 404 errors as of 2026
  • Individual review extraction: ⚠️ Not supported - Google requires user authentication to view full review content. The scraper can extract overall ratings and review counts but cannot access individual review text/data

Extraction Stability (Updated Feb 2026)

The scraper has been refactored to prioritize stable, semantic selectors over fragile CSS classes:

  • 🟢 Highly Stable Fields: Use accessibility attributes (aria-label, data-item-id) that are unlikely to break
    • Address, phone, website, rating, hours, name, place_id
  • 🟡 Moderately Stable: Use common text patterns
    • Reviews count, categories
  • See DATA_EXTRACTION_ANALYSIS.md for technical details

Features

  • ⚡ Parallel processing: Scrapes multiple places concurrently (configurable with concurrency parameter)
  • 📊 Comprehensive data: Name, rating, review count, address, coordinates, phone, website, categories, hours, and more
  • 🌍 Multi-language support: Works with en, es, fr, de, pt, nl, pl, sv, da, no, el, tr, and more
  • 🛡️ Anti-detection: Random delays and user agent rotation to avoid rate limiting
  • 🔄 Robust error handling: Multiple fallback strategies for consent forms and feed detection
  • 🎯 Stability-first extraction: Prioritizes semantic HTML attributes (aria-labels, data-item-id) over fragile CSS classes for long-term reliability

Troubleshooting

"Feed element not found" error

  • This usually means Google Maps changed its DOM structure or no results were found
  • The scraper now has multiple fallback strategies to handle this
  • Try with a different query or language parameter

Empty results

  • Check that your query returns results on Google Maps directly
  • Try with headless=false to see what the browser is doing
  • Check Docker logs: docker logs gmaps_scraper_api_service

Slow performance

  • Adjust the concurrency parameter (higher = faster but more detection risk)
  • Default is 5 concurrent tabs, max recommended is 10
  • Random delays are added for anti-detection (1-2 seconds per scroll)

Language-specific issues

  • Consent forms are now supported in: en (English), es (Spanish), de (German), fr (French), it (Italian), nl (Dutch), pt (Portuguese), pl (Polish), sv (Swedish), da (Danish), no (Norwegian), el (Greek), tr (Turkish). Use the lang parameter to match your target region.
  • Example: lang=es for Spanish results

Notes

  • For production use, consider adding authentication
  • The scraping process may take several seconds to minutes depending on the number of results
  • Recommended rate limiting: Max 500 places/day per IP, min 60s between API calls
  • Use the concurrency parameter to tune performance vs. detection risk (default: 5)

Known Limitations

  • Review extraction not supported: Google Maps requires user authentication (login) to view full review content. As of 2026, individual reviews cannot be scraped without violating Google's Terms of Service. The scraper can still extract:
    • Overall rating (e.g., 4.3 stars)
    • Total review count (e.g., 1,234 reviews)
    • Place metadata (name, address, phone, website, etc.)
  • Reviews URL deprecated: The reviews_url field returns a URL that no longer works (404 error) as of 2026
  • For alternatives, consider using Google's official Places API for review access (requires API key and has usage costs)

Ähnliche Projekte entdecken

Wird geladen…