返回排行榜

zohaibbashir/Google-Maps-Scrapper

Pythongoogle.com/maps

This code is used to perform web scraping and data extraction from Google Maps. It is particularly designed for obtaining information about businesses, including their name, address, website, phone number, reviews, and more.

chromiumdatadata-scrapinggooglegoogle-mapsgooglemapsmapspythonpython3webscrapinggoogle-maps-scrapergoogle-maps-scraper-python
Star 增长趋势
Star
1.1k
Forks
247
周增长
Issues
3
5001k
2023年10月2024年9月2025年8月2026年7月
制品库PyPIpip install google-maps-scrapper
README

Google-Maps-Scrapper

This Python script utilizes the Playwright library to perform web scraping and data extraction from Google Maps. It is particularly designed for obtaining information about businesses, including their name, address, website, phone number, reviews, and more.

Read Prerequistes

Latest python was not used and is not suggested


To do a custom web scraping project you can find me on Upwork or on Linkedin

medium linkedin

Table of Contents

Prerequisites

  • Python 3.8 or 3.9 (Python 3.10+ may not be compatible with some dependencies)
  • Google Chrome or Chromium browser installed (for Playwright)

Multiple Branches

The repo currently has 3 branches

  • Main
  • Latest Libraries (The one that works with latest libraries, can cause issues. Prefer Main)
  • Linux ( Linux Support if main branch does not work correctly)

Key Features

  • Data Scraping: The script scrapes data from Google Maps listings, extracting valuable information about businesses, such as their name, address, website, and contact details.

  • Review Analysis: It extracts review counts and average ratings, providing insights into businesses' online reputation.

  • Business Type Detection: The script identifies whether a business offers in-store shopping, in-store pickup, or delivery services.

  • Operating Hours: It extracts information about the business's operating hours.

  • Introduction Extraction: The script also scrapes introductory information about the businesses when available.

  • Data Cleansing: It cleanses and organizes the scraped data, removing redundant or unnecessary columns.

  • CSV Export: The cleaned data is exported to a CSV file for further analysis or integration with other tools.

Installation

  1. Clone this repository:
    git clone https://github.com/zohaibbashir/Google-Maps-Scrapper.git
    cd google-maps-scraper
    
  2. Install Python dependencies:
    pip install -r requirements.txt
    
  3. Install Playwright browsers:
    playwright install
    

Usage

Run the script with your desired search term and number of results:

python main.py -s "Turkish Restaurants in Toronto Canada" -t 20
  • -s or --search: Search query for Google Maps (default: "turkish stores in toronto Canada")
  • -t or --total: Number of results to scrape (default: 1)
  • -o or --output: Output CSV file path (default: result.csv)
  • --append: Append results to the output file instead of overwriting (default: off)

Example

Append new results to an existing CSV file:

python main.py -s "Turkish Restaurants in Toronto Canada" -t 20 -o toronto_turkish_restaurants.csv --append

The script will launch a browser, perform the search, and start scraping information. Progress will be displayed in the terminal, and results will be saved to the specified CSV file. If --append is used, new results will be added to the end of the file without removing previous data.

Notes

  • The script opens a visible browser window (not headless) for scraping.
  • Google Maps DOM may change, which can break the script. If you encounter issues, update the XPaths in main.py.
  • Avoid running too many scrapes in a short period to prevent being blocked by Google.

Video Example

https://www.linkedin.com/posts/zohaibbashir_python-data-webscraping-activity-7093920891411062784-flEQ

License

MIT

相关仓库
puppeteer/puppeteer

JavaScript API for Chrome and Firefox

TypeScriptnpmApache License 2.0headless-chrometesting
pptr.dev
95.3k9.5k
microsoft/playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

TypeScriptnpmApache License 2.0playwrighttesting
playwright.dev
93.2k6.1k
gorhill/uBlock

uBlock Origin - An efficient blocker for Chromium and Firefox. Fast and lean.

JavaScriptnpmGNU General Public License v3.0ublock-originblocker
66.4k4.2k
CloakHQ/CloakBrowser

Stealth Chromium that passes every bot detection test. Drop-in Playwright replacement with source-level fingerprint patches. 30/30 tests passed.

PythonPyPIMIT Licenseanti-detectbot-detection
cloakbrowser.dev
28.9k2.3k
ArchiveBox/ArchiveBox

🗃 Open source self-hosted web archiving. Takes URLs/browser history/bookmarks/Pocket/Pinboard/etc., saves HTML, JS, PDFs, media, and more...

PythonPyPIMIT Licensepocketwget
archivebox.io
28k1.6k
ungoogled-software/ungoogled-chromium

Google Chromium, sans integration with Google

PythonPyPIBSD 3-Clause "New" or "Revised" Licensechromiuminox
27.2k1.2k
chromium/chromium

The official GitHub mirror of the Chromium source

C++BSD 3-Clause "New" or "Revised" Licensebrowserchromium
chromium.googlesource.com/chromium/src/
24.3k9.1k
brave/brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.

Mozilla Public License 2.0bravebrowser
brave.com
23.1k3.2k
fathyb/carbonyl

Chromium running inside your terminal

Rustcrates.ioBSD 3-Clause "New" or "Revised" Licensebrowserchromium
19.3k579
imputnet/helium

Private, fast, and honest web browser

C++GNU General Public License v3.0browserchromium
helium.computer
18.7k492
microsoft/playwright-python

Python version of the Playwright testing and automation library.

PythonPyPIApache License 2.0playwrightchromium
playwright.dev/python/
14.8k1.2k
FlareSolverr/FlareSolverr

Proxy server to bypass Cloudflare protection

PythonPyPIMIT Licensepuppeteercloudflare
14.8k1.2k