Skip to main content

gmbscraper

A typed, importable Playwright scraper for Google Maps / Google Business Profile data: place search, place details, identity-based matching, review scraping, and parallel fan-out helpers.

  • Search Google Maps and scrape place details (name, category, address, phone, website, rating, review count) without the official (paid, rate-limited) Places API.
  • Adaptive quadrant search that recursively splits the map viewport to pull results beyond Google's ~120-per-query cap.
  • Confidence-tiered identity matching (phone_and_domain_match > phone_match > domain_match > exact_name_match) for matching a known business/outlet against scraped candidates.
  • Review scraping with owner-response filtering, "see more" text expansion, and multilingual review-tab detection.
  • Thread-based fan-out helpers (chunk_items, run_chunked) for running multiple browser workers over a batch of items.

Status: pre-1.0 (0.x). Extracted from duplicated scraping code across several internal projects; the API may still move before 1.0.0.

Using this from another project (agent or human)? Read skills/SKILL.md first — it covers the API surface, matching semantics, parallel fan-out, and how to add this as a dependency before PyPI publication.

Install

Not yet published to PyPI. Add it as a uv path dependency — see skills/SKILL.md for the exact pyproject.toml snippet — then:

uv run playwright install --with-deps chromium

Quickstart

from gmbscraper import BusinessIdentity, OutletIdentity, google_maps_browser

with google_maps_browser() as maps:
    # Search + adaptive pagination
    links = maps.search_places_adaptive("plumbers", latitude=-33.87, longitude=151.21)

    # Scrape a single place page
    place = maps.scrape_place(links[0].maps_url, fallback_name=links[0].fallback_name)
    print(place.name, place.rating, place.review_count)

    # Find the Google Business Profile for a known business
    match = maps.search_and_match(
        OutletIdentity(name="Acme Plumbing", phone="0400 000 000", address="1 Main St, Sydney"),
        BusinessIdentity(name="Acme Plumbing Pty Ltd", website="acmeplumbing.com.au"),
    )
    if match:
        print(match.match_reason, match.place_id)

    # Scrape reviews; on a re-sync, pass the ids you already store to stop
    # scrolling at the first known review
    reviews = maps.scrape_reviews(place.maps_url, max_reviews=50)
    newer = maps.scrape_reviews(place.maps_url, known_ids={r.external_id for r in reviews})

Design notes

  • Every network-facing function swallows and skips broken selectors rather than raising — a PlaceProfile is returned with whatever fields could be read, since Google's DOM/markup changes without notice and partial data is usually more useful than a hard failure. scrape_reviews is the exception: it raises GoogleReviewsUnavailableError when Google serves a page with no reviews UI at all (throttled/limited view, or the reviews tab never opens), since a caller needs to distinguish "zero reviews" from "couldn't scrape." Its GoogleLimitedViewError subclass marks Google's signed-out limited view, which signals throttling rather than a problem with one place.
  • Each place opens in a single page load, and each browser launch gets a random desktop Chrome user agent unless you pass user_agent=.
  • There's no retry/backoff or proxy rotation built in. This is a DOM scraper, not a hosted anti-block service — for scraping at a scale where blocking is routine, a paid API (Outscraper, SerpApi, etc.) will be cheaper than building that infrastructure yourself.

Development

uv sync
uv run pytest
uv run ruff check .
uv run ruff format --check .

See skills/references/development.md for what is and isn't covered by the test suite.

License

MIT

Metadata

Release files for gmbscraper 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gmbscraper 0.2.1
File Size Uploaded Provenance Actions
gmbscraper-0.2.1.tar.gz 43.6 kB Without provenance Details for gmbscraper-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gmbscraper 0.2.1
File Interpreter ABI Platform Actions
gmbscraper-0.2.1-py3-none-any.whl Python 3 none any Details for gmbscraper-0.2.1-py3-none-any.whl

Total release size: 70.1 kB

Release files / gmbscraper-0.2.1.tar.gz

Download URL gmbscraper-0.2.1.tar.gz
Size 43.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c804bed7f5975042ee8db360026adb38e209b4217ee4f7ff6a57285e896dd341
BLAKE2b-256 checksum
How to use checksums
579e7ff6dbeb2b71e85b4f64b58ccdbdda614d7e8217059569e68811f6ff2af4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / gmbscraper-0.2.1-py3-none-any.whl

Download URL gmbscraper-0.2.1-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab57739b192249cf7fb4da7e09b0126987044088242c2a66c2c97f40f15fa75e
BLAKE2b-256 checksum
How to use checksums
b323e932cd3abcdcb9fa29a47ed43cd315889c1dbf0a1455f0290b3faa8410c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for gmbscraper 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page