Skip to content

A powerful Python-based web scraper that extracts business information from Google Maps search results for any search term. Perfect for market research, lead generation, and business intelligence.

Notifications You must be signed in to change notification settings

dmsLakmal/google-map-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 Google Maps Universal Scraper

A powerful Python-based web scraper that extracts business information from Google Maps search results for any search term. Perfect for market research, lead generation, and business intelligence.

✨ Features

  • Universal Search: Search for any type of business (restaurants, hotels, shops, services, etc.)
  • Comprehensive Data Extraction: Name, phone number, website, address, and Google Maps URL
  • Multi-Language Support: Forces English interface for consistent data extraction
  • Email Extraction: Automatically extracts email addresses from business websites
  • Batch Processing: Processes businesses in batches with configurable delays
  • Progress Tracking: Real-time progress updates and countdown timers
  • Organized Output: Creates separate folders for each search term
  • Resume Capability: Continues from where it left off if interrupted
  • Headless Mode: Run in background without opening browser windows
  • Rate Limiting: Built-in delays to avoid being blocked

πŸš€ Quick Start

Option 1: Download Executable (Recommended)

Download

  1. Download the executable from the link above
  2. Run GoogleMapsScraper.exe
  3. Start scraping - no installation required!

Option 2: Run from Source

Prerequisites

  • Python 3.7 or higher
  • Google Chrome browser
  • Internet connection

Installation

  1. Clone or download the repository

    git clone <repository-url>
    cd google-map-scraper
  2. Install dependencies

    python scripts/install_dependencies.py

    Or manually:

    pip install -r requirements.txt
  3. Run the scraper

    python run.py

System Requirements

  • Windows 10/11 (64-bit)
  • Google Chrome browser
  • Internet connection

πŸ“‹ Usage

Interactive Menu

The scraper provides an intuitive menu-driven interface:

🌍 GOOGLE MAPS UNIVERSAL SCRAPER - CONTROL CENTER
======================================================================

πŸ“‹ MAIN MENU
======================================================================

  1. πŸš€ Run Scraper
  2. πŸ“§ Extract Emails from Websites
  3. 🧹 Clear Output Files
  4. πŸ“¦ Install Dependencies
  5. πŸ”§ Fix/Test WebDriver
  6. ❌ Exit

======================================================================

Running the Scraper

  1. Select option 1 from the main menu
  2. Enter your search term (e.g., "restaurants in Paris", "hotels in Tokyo", "coffee shops in London")
  3. Configure settings:
    • Headless mode (recommended for faster execution)
    • Batch delay (default: 30 seconds between batches)
  4. Start scraping and follow the interactive prompts

Example Search Terms

  • restaurants in New York
  • hotels in Tokyo Japan
  • coffee shops near me
  • dentists in London
  • gyms in Berlin
  • pharmacies in Paris
  • bookstores in Amsterdam

πŸ“Š Output Format

The scraper generates CSV files with the following columns:

Column Description
name Business name
phone Phone number
website Website URL
address Full address
google-map-url Google Maps listing URL
scraped_at Timestamp of extraction

File Organization

output/
β”œβ”€β”€ restaurants_in_paris/
β”‚   β”œβ”€β”€ batch_1_businesses.csv
β”‚   β”œβ”€β”€ batch_2_businesses.csv
β”‚   └── final_results.csv
β”œβ”€β”€ hotels_in_tokyo/
β”‚   β”œβ”€β”€ batch_1_businesses.csv
β”‚   └── final_results.csv
└── ...

πŸ“§ Email Extraction

The built-in email scraper automatically extracts email addresses from business websites:

  1. Select option 2 from the main menu
  2. Choose a search folder from your previous scraping sessions
  3. Select a CSV file to process
  4. Confirm extraction and wait for results

Email Patterns Supported

  • Standard email format: user@domain.com
  • Spaced format: user @ domain . com
  • Obfuscated format: user[at]domain[dot]com
  • Parentheses format: user(at)domain(dot)com

βš™οΈ Configuration Options

Scraper Settings

  • Headless Mode: Run browser in background (faster, no GUI)
  • Batch Delay: Time between batches (0-300 seconds)
  • Max Businesses: Limit total businesses to scrape
  • Request Delay: Delay between website requests for email extraction

Chrome Options

The scraper automatically configures Chrome with optimal settings:

  • Disables images and unnecessary features for faster loading
  • Forces English language interface
  • Suppresses logs and errors
  • Optimized for automation

πŸ› οΈ Advanced Usage

Programmatic Usage

from scraper import GoogleMapsScraper

# Initialize scraper
scraper = GoogleMapsScraper(headless=True, batch_delay=30)

# Start scraping
success = scraper.scrape_all("restaurants in Paris", max_businesses=100)

if success:
    print(f"Scraped {len(scraper.businesses_data)} businesses")
    scraper.save_to_csv("my_results.csv")

Email Scraper Usage

from email_scraper import EmailScraper

# Initialize email scraper
email_scraper = EmailScraper()

# Extract emails from a specific file
success = email_scraper.run_email_scraper("restaurants_in_paris", "final_results.csv")

πŸ“ Project Structure

google-map-scraper/
β”œβ”€β”€ scraper.py              # Main scraper class
β”œβ”€β”€ email_scraper.py         # Email extraction functionality
β”œβ”€β”€ run.py                  # Interactive menu interface
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ README.md              # This file
β”œβ”€β”€ output/                # Generated CSV files
β”‚   β”œβ”€β”€ search_term_1/
β”‚   └── search_term_2/
└── scripts/               # Utility scripts
    β”œβ”€β”€ install_dependencies.py
    β”œβ”€β”€ clear_output.py
    └── fix_webdriver.py

πŸ”§ Troubleshooting

Common Issues

  1. ChromeDriver Issues

    python scripts/fix_webdriver.py
  2. Missing Dependencies

    python scripts/install_dependencies.py
  3. Clear Output Files

    python scripts/clear_output.py

Error Messages

  • "No business links found": Try a different search term or wait longer
  • "WebDriver setup failed": Check Chrome installation and run fix script
  • "Timeout waiting for elements": Increase delays or check internet connection

πŸ“ˆ Performance Tips

  1. Use headless mode for faster execution
  2. Set appropriate batch delays (30+ seconds recommended)
  3. Monitor your scraping rate to avoid being blocked
  4. Use specific search terms for better results
  5. Clear output files regularly to save disk space

⚠️ Important Notes

Legal and Ethical Considerations

  • Respect robots.txt: Check website policies before scraping
  • Rate limiting: Built-in delays help avoid overwhelming servers
  • Terms of service: Ensure compliance with Google Maps terms
  • Data usage: Use scraped data responsibly and legally

Technical Limitations

  • Google's anti-bot measures: May occasionally block automated requests
  • Dynamic content: Some elements may not load consistently
  • Rate limits: Excessive requests may result in temporary blocks
  • Browser updates: Chrome updates may require WebDriver updates

🀝 Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is for educational and research purposes. Please ensure compliance with applicable laws and terms of service.

πŸ†˜ Support

If you encounter issues:

  1. Check the troubleshooting section
  2. Run the fix scripts
  3. Check your internet connection
  4. Verify Chrome installation
  5. Create an issue with detailed error information

πŸ”„ Updates

The scraper is regularly updated to handle:

  • Google Maps interface changes
  • Chrome browser updates
  • New anti-bot measures
  • Performance improvements

Happy Scraping! πŸš€

For questions or support, please open an issue in the repository.

About

A powerful Python-based web scraper that extracts business information from Google Maps search results for any search term. Perfect for market research, lead generation, and business intelligence.

Resources

Stars

Watchers

Forks

Languages