A powerful and flexible Google Maps scraper built with Python and Playwright. It supports both simple keyword searches and advanced grid-based mining for broad geographic coverage.
- Simple Search: specific queries (e.g., "restaurants in Kathmandu").
- Grid Mining: Automatically generates a grid of coordinates to scrape large areas systematically.
- Data Extraction: Extracts Name, Phone, Website, Email (from website), and Location Link.
- Headless Mode: Runs in the background by default.
- CSV Export: Automatically saves results to
results.csv.
-
Clone the repository:
git clone https://github.com/onepiece92/gMap.git cd gMap -
Install dependencies:
pip install -r requirements.txt
-
Install Playwright browsers:
playwright install chromium
Run a quick search directly from the command line:
python main.py "coffee shops in New York" --total 20--total: Number of results to scrape (default: 10)--visible: Run with the browser visible (useful for debugging)
Create or edit config.json for more control:
{
"search_query": "dentist",
"location": "London",
"total": 500,
"grid_size": 5,
"zoom_level": 15,
"headless": true
}Run the scraper:
python main.pyThe robust "Grid Mining" mode activates automatically if total target is > 120. It will:
- Discover the coordinates of the target
location. - Generate a grid of search points around that location.
- Systematically mine each grid tile to maximize results and bypass Google Maps' scroll limits.
main.py: Entry point and logic flow.scraper/: Core scraping modules.engine.py: Playwright browser automation.grid.py: Coordinate grid generation logic.extractor.py: Text extraction utilities.storage.py: CSV saving handlers.
This tool is for educational purposes only. scraping public data. Please respect platform Terms of Service.