Skip to content

jhmarina/g-maps-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Maps Scraper

Google Maps Scraper (English)

This script allows you to search for businesses on Google Maps via SerpAPI, detect if they have an active, inactive, or missing website, and export the results to a CSV file. Ideal for identifying expired domains or targeting potential clients without an online presence


Features

  • Search for businesses by sector and coordinates (lat, long)
  • Extract name, address, phone number, and website from Google Maps
  • Verify if the website domain is active with double validation:
    • Direct HTTP request (requests)
    • WHOIS verification (python-whois)
  • Export results to output.csv ready to open in Excel

Requirements

  • Python 3.7+
  • Free account on SerpAPI with at least 1 active API Key

Installation and Usage

1. Clone the project

git clone https://github.com/jhmarina/g-maps-scraper.git
cd g-maps-scraper

2. Create and activate a virtual environment

python3 -m venv venv
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Create a .env file with your API key

Create a .env file in the project root:

SERPAPI_API_KEY=your_serpapi_key

You can get your key here: https://serpapi.com/dashboard


Execution

Run the script with:

python main.py

It will ask for:

  • Business type (e.g., construction)
  • Coordinates in lat,long format (e.g., 41.2372,1.8030)
  • Number of result pages (~20 results per page)

📝 The output.csv file will be generated in the same folder.


Dependencies

These are the main dependencies used:

  • requests – to verify active websites via HTTP
  • tldextract – to extract clean domains
  • python-whois – to check domain registration
  • serpapi – official client to access Google Maps
  • python-dotenv – to load API keys from .env

They are listed in requirements.txt.


Example Usage

🔎 Business type: construction
📍 Coordinates: 41.2372,1.8030
📄 Pages: 3

You will get a CSV with up to 60 results from Sitges (Barcelona) and surroundings.


Additional Notes

  • It may take a few seconds per page, as it performs HTTP/WHOIS validations.
  • Use real coordinates for accuracy (you can get them from Google Maps by right-clicking > "What's here?").

Credits

Project developed by Jesus Herman, using:


Google Maps Scraper

Google Maps Scraper (Español)

Este script permite buscar negocios en Google Maps a través de SerpAPI, detectar si tienen página web activa, inactiva, o si no tienen web, y exportar los resultados a un archivo CSV. Ideal para detectar dominios expirados o captar posibles clientes sin presencia online.


Funcionalidad

  • Busca negocios por sector y coordenadas (lat, long)
  • Extrae nombre, dirección, teléfono y web desde Google Maps
  • Verifica si el dominio web está activo con doble validación:
    • Petición HTTP directa (requests)
    • Verificación WHOIS (python-whois)
  • Exporta resultados a output.csv listos para abrir en Excel

Requisitos

  • Python 3.7+
  • Cuenta gratuita en SerpAPI con al menos 1 API Key activa

Instalación y uso

1. Clonar el proyecto

git clone https://github.com/jhmarina/g-maps-scraper.git
cd g-maps-scraper

2. Crear y activar entorno virtual

python3 -m venv venv
source venv/bin/activate

3. Instalar dependencias

pip install -r requirements.txt

4. Crear archivo .env con tu API key

Crea un archivo .env en la raíz del proyecto:

SERPAPI_API_KEY=tu_clave_de_serpapi

Puedes obtener tu clave aquí: https://serpapi.com/dashboard


Ejecución

Ejecuta el script con:

python main.py

Te pedirá:

  • Tipo de negocio (ej. reformas)
  • Coordenadas en formato lat,long (ej. 41.2372,1.8030)
  • Número de páginas de resultados (~20 resultados por página)

El archivo output.csv se generará en la misma carpeta.


Dependencias

Estas son las dependencias principales usadas:

  • requests – para verificar webs activas vía HTTP
  • tldextract – para extraer dominios limpios
  • python-whois – para comprobar registro de dominio
  • serpapi – cliente oficial para acceder a Google Maps
  • python-dotenv – para cargar claves API desde .env

Están listadas en requirements.txt.


Ejemplo de uso

🔎 Tipo de negocio: reformas
📍 Coordenadas: 41.2372,1.8030
📄 Nº páginas: 3

Obtendrás un CSV con hasta 60 resultados desde Sitges (Barcelona) y alrededores.


Notas adicionales

  • Puede tardar unos segundos por página, ya que realiza validaciones HTTP/WHOIS.
  • Usa coordenadas reales para precisión (puedes obtenerlas con Google Maps clicando botón derecho > "¿Qué hay aquí?").

Créditos

Proyecto desarrollado por Jesus Herman, utilizando:

About

This script allows you to search for businesses on Google Maps via SerpAPI, detect if they have an active, inactive, or missing website, and export the results to a CSV file. Ideal for identifying expired domains or targeting potential clients without an online presence.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages