A Python tool for extracting business information from Google Maps based on search criteria such as location and business type.
This tool uses Selenium WebDriver to automate searches on Google Maps and extract relevant business information including:
- Business name
- Address
- Phone number
- Website
- Category
- Rating
- Number of reviews
-
Clone this repository:
git clone https://github.com/AhmedOsamaMath/google-maps-scraper.git cd google-maps-scraper
-
Install required packages:
pip install -r requirements.txt
-
Download ChromeDriver from https://sites.google.com/chromium.org/driver and ensure it's in your PATH or in the same directory as the script.
Run the script from the command line:
python scraper.py
You will be prompted to enter:
- The country to search in (e.g., United States)
- The query type (e.g., companies, restaurants, hotels)
- The maximum number of results to scrape (default is 15)
The script will then:
- Open a Chrome browser window
- Navigate to Google Maps
- Perform the search
- Extract information from each result
- Save the data to a CSV file named
{country}_{query_type}.csv
You can modify the following aspects of the scraper by editing the code:
- To run in headless mode (no visible browser), set
headless=True
when creating theGoogleMapsScraper
instance in themain()
function - Adjust the wait time by modifying the
wait_time
parameter when initializing the scraper - Change the maximum scroll attempts in the
_process_search_results
method
The output CSV file will contain the following columns:
- name
- country
- address
- phone
- website
- category
- rating
- num_reviews
This project is licensed under the MIT License. See the LICENSE file for more details.