zohaibbashir/Google-Maps-Scrapper
소개
Google 지도에서 웹 스크래핑과 데이터를 추출하는 데 사용하는 코드입니다. 업체명, 주소, 웹사이트, 전화번호, 리뷰 등을 비롯한 비즈니스 정보를 가져오는 데 특히 적합합니다.
데이터 및 분석What you can do
- 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.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- +8
- in 15 days
- +11
- in 1 month
- +44
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalGoogle-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
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
- Clone this repository:
git clone https://github.com/zohaibbashir/Google-Maps-Scrapper.git cd google-maps-scraper - Install Python dependencies:
pip install -r requirements.txt - 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
-sor--search: Search query for Google Maps (default: "turkish stores in toronto Canada")-tor--total: Number of results to scrape (default: 1)-oor--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
License
MIT
관련 프로젝트 살펴보기
불러오는 중…