Skip to content

Scrape Google Maps search results using Selenium, Playwright (stealth), or HasData API in Python & Node.js. Extract names, ratings, reviews, and more - export to CSV/JSON.

Notifications You must be signed in to change notification settings

HasData/google-maps-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python Node.js

Google Maps Scraper Examples (Python & Node.js)

HasData_bannner

This repository contains working examples of scraping Google Maps search results using:

in both Python and Node.js. Each method includes clean and minimal code samples with working selectors and data saving logic.

Table of Contents

  1. Requirements
  2. Project Structure
  3. Scraper Examples

Requirements

Python 3.10+ or Node.js 18+

Python Setup

Install required packages:

pip install selenium pandas playwright playwright-stealth
playwright install

Node.js Setup

Install required packages:

npm install selenium-webdriver playwright playwright-extra playwright-extra-plugin-stealth axios

Project Structure

google-maps-scraper/
│
├── python/
│   ├── selenium_scraper.py
│   ├── playwright_scraper.py
│   ├── hasdata_api_scraper.py
│
├── nodejs/
│   ├── selenium_scraper.js
│   ├── playwright_scraper.js
│   ├── hasdata_api_scraper.js
│
└── README.md

Each script scrapes the same data: business name, rating, reviews, category, services, image, and detail URL. Output is saved in both .json and .csv.

Scraper Examples

Selenium

Classic Google Maps scraping using Selenium with visible browser.

Parameter Description Example
query Search query "pizza in New York"
max_scrolls Number of scroll cycles 10
scroll_pause Pause between scrolls 2 seconds
max_scrolls Scroll repetitions 10
output_file Output CSV/JSON filename "maps_data.csv/json"

Playwright + Stealth

Runs headless or headful with stealth mode to avoid detection.

Parameter Description Example
query Search query "restaurants in Chicago"
headless Headless mode or not True
scroll_pause Pause between scrolls 2 seconds
max_scrolls Scroll repetitions 10
output_file Output CSV/JSON filename "output.csv"

HasData API

Use Google Maps scraping API (by HasData) — no browser automation needed.

Parameter Description Example
api_key Your HasData API key "your-key"
query Search query "bars near San Francisco"
output_file Output file "results.json / results.csv"

Notes

  • Selectors may change — always verify current class names on Google Maps.
  • Avoid rate limiting — random delays, proxies, or API-based approach recommended.
  • For heavy usage, prefer HasData or your own headless proxy farm.

Disclaimer

These examples are for educational purposes only. Learn more about the legality of web scraping.

📎 More Resources

About

Scrape Google Maps search results using Selenium, Playwright (stealth), or HasData API in Python & Node.js. Extract names, ratings, reviews, and more - export to CSV/JSON.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published