A Python-based web scraper designed to extract reviews from Google Maps locations. This tool uses Selenium WebDriver to automatically scroll through and collect review data including reviewer names, ratings, dates, and review text.
This scraper automates the process of collecting Google Maps reviews by:
- Emulating a mobile browser to access the mobile version of Google Maps
- Automatically scrolling through all available reviews
- Extracting review details using BeautifulSoup and regular expressions
- Exporting the scraped data to a CSV file
- Automatic Scrolling: Infinitely scrolls through reviews to load all available data
- Mobile Emulation: Uses mobile user agent for better compatibility
- Data Extraction: Collects reviewer name, date, rating, and review text
- CSV Export: Saves all reviews to a structured CSV file
- Headless Mode Option: Can run with or without visible browser window
- Python 3.7+
- Chrome Browser
- ChromeDriver (automatically managed by webdriver-manager)
-
Clone the repository
git clone https://github.com/zulfafalah/Scraping-Google-Maps-Review.git cd Scraping-Google-Maps-Review -
Create a virtual environment (recommended)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install required dependencies
pip install -r requirements.txt
-
Edit the URL in main.py
Open
main.pyand replace theurl_mapvariable with your desired Google Maps location URL:url_map = "YOUR_GOOGLE_MAPS_URL_HERE"
-
Run the scraper
python main.py
-
View the results
The scraped reviews will be saved to
output.csvin the project directory.
The generated CSV file contains the following columns:
- nama: Reviewer's name
- waktu: Review date/time
- rating: Star rating (e.g., "5 bintang" = 5 stars)
- ulasan: Review text content
To run the scraper without opening a visible browser window, uncomment the headless option in main.py:
options.add_argument("--headless")The scraper uses mobile emulation by default. You can modify the user agent in the mobile_emulation configuration if needed.
Scraping-Google-Maps-Review/
├── main.py # Main scraper script (updated version)
├── requirements.txt # Python dependencies
├── output.csv # Generated output file
├── Scraping_gmaps/ # Alternative version
│ ├── main.py
│ ├── Read me.txt
│ └── requirements.txt
└── README.md # This file
Key libraries used:
selenium- Browser automationbeautifulsoup4- HTML parsinglxml- XML/HTML parserwebdriver-manager- Automatic ChromeDriver managementrequests- HTTP library
See requirements.txt for the complete list.
- Rate Limiting: Be mindful of Google's rate limits. Excessive scraping may result in temporary blocks.
- Terms of Service: Ensure compliance with Google Maps Terms of Service when using this tool.
- Reliability: Google Maps structure may change, which could break the scraper. Regular expression patterns may need updates.
- Internet Connection: Stable internet connection is required for proper operation.
-
ChromeDriver not found: The webdriver-manager should handle this automatically, but ensure Chrome browser is installed.
-
Timeout errors: Increase the
time.sleep()duration if pages are loading slowly. -
No data scraped: Google Maps may have changed its HTML structure. Check and update the regular expressions in the code.
-
SSL errors: If you encounter SSL certificate errors, ensure your system certificates are up to date.
# Example URL format
url_map = "https://www.google.com/maps/place/[Place+Name]/@[coordinates]/data=..."
# Run the scraper
main(url_map)
# Output will be saved to output.csvContributions, issues, and feature requests are welcome! Feel free to check the issues page.
This project is for educational purposes. Please use responsibly and in accordance with Google's Terms of Service.
Zulfa Falah
- GitHub: @zulfafalah
- Thanks to the Selenium and BeautifulSoup communities for their excellent documentation
- webdriver-manager for simplifying ChromeDriver management
Disclaimer: This tool is for educational and research purposes only. Users are responsible for ensuring their use complies with Google Maps Terms of Service and applicable laws.