A robust, language-agnostic Google Maps scraper designed to work seamlessly across different locales and VPS environments, including German servers.
- π International Support: Works with German, English, and other locales
- π§ VPS-Optimized: Configured for headless operation on virtual private servers
- π Multiple Export Formats: CSV and Excel download options
- π― Smart Extraction: Handles different languages and interface layouts
- β‘ Auto-Setup: Automatic Chrome driver management with webdriver-manager
- π‘οΈ Robust Error Handling: Graceful fallbacks and detailed error reporting
Run the automated setup script:
chmod +x setup_environment.sh
./setup_environment.sh
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Test the scraper
python test_scraper.py
source venv/bin/activate
streamlit run app.py
The original scraper failed on German VPS due to:
- β Language-specific Google Maps interface
- β Missing locale configuration
- β Chrome browser setup issues
- β Encoding problems with international characters
- β Multi-language selectors: Handles German, English, and other interfaces
- β UTF-8 encoding: Proper character encoding for international text
- β Chrome language forcing: Forces English interface for consistency
- β Robust browser detection: Multiple Chrome/Chromium binary paths
- β Webdriver auto-management: Automatic ChromeDriver installation
- Python 3.7+
- Chrome/Chromium browser
- Internet connection
- Virtual environment (recommended)
# Ubuntu/Debian
sudo apt update
sudo apt install -y python3-venv python3-pip chromium-browser
# Or install Google Chrome
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt update && sudo apt install -y google-chrome-stable
- Enter Search Query: Type what you're looking for (e.g., "restaurants in Berlin")
- Set Maximum Results: Choose between 10-100 results
- Start Scraping: Click the button and wait for results
- Download Data: Export as CSV or Excel
restaurants in Berlin
hotels in Munich
car repair shops in Hamburg
bakeries near Frankfurt
The scraper extracts the following information:
- Name: Business name
- Rating: Star rating (e.g., 4.5)
- Reviews: Number of reviews
- Category: Business type/category
- Address: Full address
- Phone: Phone number (if available)
- Website: Website URL (if available)
- Hours: Operating hours (if available)
- Headless mode for VPS compatibility
- Language set to English for consistent interface
- Optimized for server environments
- Multiple browser binary detection
- UTF-8 encoding enforcement
- Multiple locale fallbacks
- International character support
- German VPS compatibility
- Multiple CSS selector approaches
- Language-agnostic pattern matching
- Robust error handling and retries
- Smart duplicate detection
Run the test suite to verify everything works:
python test_scraper.py
Expected output:
π International Google Maps Scraper - Test Suite
============================================================
π§ͺ Testing Chrome driver setup...
β
Chrome driver setup successful!
β
Successfully navigated to Google
π Testing Google Maps search...
Searching for: restaurants in Berlin
β
Found 5 results!
π All tests passed! The scraper is working correctly.
# Check if Chrome is installed
which google-chrome || which chromium-browser
# Install Chromium
sudo apt install chromium-browser
# Test headless mode
chromium-browser --headless --dump-dom https://www.google.com
# Check current locale
locale
# Generate UTF-8 locale
sudo locale-gen en_US.UTF-8
# Set environment variables
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
# Make scripts executable
chmod +x setup_environment.sh
chmod +x test_scraper.py
- Ensure internet connectivity
- Check firewall settings
- Verify Google Maps is accessible
βββ app.py # Main Streamlit application
βββ test_scraper.py # Test suite
βββ setup_environment.sh # Environment setup script
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ venv/ # Virtual environment (created after setup)
- International Compatibility: Removed US-specific assumptions
- Language Agnostic: Works with German and other locales
- VPS Optimization: Headless Chrome with proper flags
- Auto Driver Management: webdriver-manager integration
- Better Error Handling: Comprehensive error messages and fallbacks
- UTF-8 Support: Proper encoding for international characters
- Multiple Browser Support: Chrome, Chromium, and snap installations
- Added
webdriver-manager
for automatic ChromeDriver setup - Implemented multiple Chrome binary detection
- Added UTF-8 encoding configuration
- Enhanced CSS selectors for different languages
- Improved error handling and fallback mechanisms
After implementing these fixes:
- β German VPS Compatibility: Works on German servers
- β Multi-language Support: Handles different Google Maps interfaces
- β Robust Setup: Automatic environment configuration
- β Better Data Quality: Improved extraction accuracy
- β Error Resilience: Graceful handling of failures
If you encounter issues:
- Run
python test_scraper.py
to diagnose problems - Check the troubleshooting section above
- Ensure all system dependencies are installed
- Verify Chrome/Chromium installation
This project is provided as-is for educational purposes. Please respect Google's Terms of Service and rate limits when using this scraper.