A high-performance Google Maps lead scraper using Camoufox
Project description
Google Maps Lead Generator
A high-performance Python library for extracting business leads from Google Maps using a stealth browser (Camoufox).
Features
- Two-phase scraping architecture - Efficiently collects URLs first, then extracts data
- Parallel processing - Uses multiple browser tabs concurrently
- Resource optimization - Blocks heavy resources (images, media, fonts) during data extraction
- Stealth browsing - Uses Camoufox to avoid detection
- Flexible output - Save results to CSV or JSON
Installation
pip install google-map-leadgen
Or install from source:
pip install -e .
Usage
Command Line
# Basic usage
python -m google_map_leadgen.main "Restaurants in San Francisco"
# Specify number of leads and tabs
python -m google_map_leadgen.main "Plumbers in NYC" --leads 50 --tabs 4
# Output as JSON
python -m google_map_leadgen.main "Coffee shops" --json
As a Library
import asyncio
from google_map_leadgen import scrape
async def main():
# You can specify target leads and concurrent tabs
results = await scrape("Mobile Repair Shop in New York", target=10, max_tabs=3)
for lead in results:
print(f"Name: {lead['name']}")
print(f"Address: {lead['address']}")
print(f"Phone: {lead['phone']}")
print(f"Website: {lead['website']}")
print("---")
asyncio.run(main())
Configuration
Set environment variables to customize behavior:
export LEADS=50 # Number of leads to collect
export MAX_TAB_ALLOWED=4 # Concurrent browser tabs
export HEADLESS=true # Run browser in headless mode
export DEBUG=false # Enable debug logging
Output Format
Results are returned as a list of dictionaries:
[
{
"name": "Business Name",
"address": "123 Main St, City, State",
"phone": "+1 (555) 123-4567",
"website": "https://example.com"
},
...
]
Project Structure
google-map-leadgen/
├── .github/ # GitHub Actions workflows (CI/CD)
├── google_map_leadgen/ # Core package source
│ ├── __init__.py # Package initialization
│ ├── config.py # Configuration settings
│ ├── main.py # CLI entry point
│ └── scraper.py # Core scraping logic
├── tests/ # Unit and integration tests
├── pyproject.toml # Package configuration and dependencies
└── README.md # Project documentation
Development
Prerequisites
- uv (Recommended) or Python 3.12+
Setup
# Clone the repository
git clone https://github.com/yourusername/google-map-leadgen.git
cd google-map-leadgen
# Install dependencies
uv sync --all-extras
Running Tests
uv run pytest tests/ -v
Linting
uv run ruff check .
uv run ruff format .
CI/CD
This project uses GitHub Actions for:
- CI: Automated testing and linting on every push and pull request.
- CD: Automated publishing to PyPI on GitHub release.
Requirements
- Python 3.12+
- Camoufox (stealth browser)
License
MIT License
Disclaimer
This tool is for educational purposes. Scraping Google Maps may violate their Terms of Service. Use responsibly and at your own risk.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file google_map_leadgen-0.1.0.tar.gz.
File metadata
- Download URL: google_map_leadgen-0.1.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29b9654ff63a4955faab7dddf310081cb30aa3986287288c8f40768b7f651637
|
|
| MD5 |
b7d1c677d4c98f2cece004c37768bbcf
|
|
| BLAKE2b-256 |
d7388352f5f512e3409103224b269bc065a95f6d9d546905ad20df49f949c8c7
|
Provenance
The following attestation bundles were made for google_map_leadgen-0.1.0.tar.gz:
Publisher:
publish.yml on ManojPanda3/google_map_leadgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_map_leadgen-0.1.0.tar.gz -
Subject digest:
29b9654ff63a4955faab7dddf310081cb30aa3986287288c8f40768b7f651637 - Sigstore transparency entry: 975744540
- Sigstore integration time:
-
Permalink:
ManojPanda3/google_map_leadgen@fa53d5bb95c9428f9856188c507477f30593ecfd -
Branch / Tag:
- Owner: https://github.com/ManojPanda3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa53d5bb95c9428f9856188c507477f30593ecfd -
Trigger Event:
release
-
Statement type:
File details
Details for the file google_map_leadgen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: google_map_leadgen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c350f2645883246a266de3f30772659b3333c24e4fc776894c4077d854744fe
|
|
| MD5 |
6dc7dfa4bb97d3cb79c6b2dbc885e7b2
|
|
| BLAKE2b-256 |
127b9c1082312753a5b690cec7c8cc35d854f79d0a89926e17debfdf72b9be87
|
Provenance
The following attestation bundles were made for google_map_leadgen-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ManojPanda3/google_map_leadgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_map_leadgen-0.1.0-py3-none-any.whl -
Subject digest:
3c350f2645883246a266de3f30772659b3333c24e4fc776894c4077d854744fe - Sigstore transparency entry: 975744541
- Sigstore integration time:
-
Permalink:
ManojPanda3/google_map_leadgen@fa53d5bb95c9428f9856188c507477f30593ecfd -
Branch / Tag:
- Owner: https://github.com/ManojPanda3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa53d5bb95c9428f9856188c507477f30593ecfd -
Trigger Event:
release
-
Statement type: