En este post enseño uno de los scripts más interesantes que he hecho hasta ahora. Es un script de scraping que busca diferentes keywords preestablecidos por el usuario en Google Maps, y scrapea los datos de ese negocio, descargar su foto destacada y exportar toda la información a un fichero de Excel.
Tabla de Contenidos
Descripcion del Scraper de Google Maps
El programa para el usuario es muy sencillo: tiene que añadir los nombres que quiere buscar a un fichero de texto, pasárselos al script, y ejecutarlo, para que empiece a obtener datos. El script cuando acaba, crea un fichero llamado «00_output.xls» en el destino establecido por el usuario, incluyendo todos los datos obtenidos.

Como ejecutar el Scraper
Para ejecutar el scraper, se tienen que seguir cuatro pasos:
1. Descarga el ejecutable y abre una consola de comandos en la misma ubicación que el .exe. Ejecuta el archivo .exe.
google_maps_scraper_juaristech.exe
2. El programa te preguntara en qué lenguaje quieres que busque tus palabras clave. (Para que ejecute Chrome y Maps en inglés o en castellano). Tendrás que elegir «EN» si tus keyword están en inglés o «ES» si están en español.
[1] Introduce the language, (ES o EN):
3. Después tendrás que especificar donde quieres que se guarden los resultados del scraping, es decir, donde se guardarán las imágenes y el fichero Excel. Tienes que copiar la ruta de la carpeta entera. Si la ruta no es válida el programa te lo avisará. Por ejemplo una ruta válida podría ser: «D:\Proyectos\Scraping_Madrid\»
[2] Introduce the path to save the images:
4. Por último, parecido al paso anterior, tendrás que decir donde tienes el fichero que contiene las palabras clave a buscar. Siguiendo con el ejemplo anterior, podría ser: 3. Después tendrás que especificar donde quieres que se guarden los resultados del scraping, es decir, donde se guardarán las imágenes y el fichero Excel. Tienes que copiar la ruta de la carpeta entera. Si la ruta no es válida el programa te lo avisará. Por ejemplo una ruta válida podría ser: «D:\Proyectos\Scraping_Madrid\lugares.txt»
[3] Introduce the path of the keywords txt file:
Tip: Si creas una carpeta en el mismo sitio que tienes el ejecutable .exe y guardas también el fichero de texto en ese mismo lugar, en los pasos 3 y 4 solo tendrías que introducir los nombres de la carpeta y el fichero.
Ejemplo de ejecución
D:\maps_scraper\build>maps_scraper_juaristech.exe
----------
[1] Introduce the language, (ES o EN): ES
----------
[2] Introduce the path to save the images: D:\Test\output\
----------
[3] Introduce the path of the keywords txt file: D:\Test\places.txt
Vídeo explicando el Script
Enlaces de Descarga
Como con todos los script y programas, puedes descargar el script para que lo puedas ejecutar directamente, sin la necesidad de tener Python y las librerías necesarias. Si por el contrario quieres revisar o tener tú el propio código, puedes entrar al repositorio de Github.
Como siempre, ante cualquier duda, sugerencia o propuesta que me queráis hacer, me podéis escribir desde el formulario de contacto o a admin@juaristech.com
Hello PATXI JUARISTI PAGEGI,
The scraper is not working giving crome driver issue. Please look into it if you could fix it that would be a great help .
Thanks in advance
Hi! The scraper is working fine. Chromedriver issue could be for these reason:
If you are still having problems you can contact me and I will try to solve the problem.
Cheers
Hello,
I also met issue of Chrome, although my Chrome has been updated
Code has been updated. Check it now please!
Needs a new update, some xpath changed
it doesn’t pass the first result
I am trying to use the scraper but it gives webdriver issue
Hola , yo he probado también y siempre me da error de error Chrome driver, aunque segui tus recomendaciones
Hey
I think you need to update some Xpaths, google did some changes and its not moving from the first searched entry
Hey, can you please update the code? is not scraping. Its moving to each keyword and that’s it.
Something got changed probably on site
i want to scrape url link dan longitude latitude, can it do it?
Hello
I have updated chrome to latest version and I run into chrome driver issue
Buenas ! gracias por compartir.
Se podria utilizar para sacar listas de una zona? por ejemplo restaurantes de Toledo
I am trying to fetch huge list but if we enter one keyword then it just gives 3-4 results in excel whereas there are huge list on map.
Buenas Patxi,
estaba haciendo un script para raspar maps y no conseguía descargar las imágenes hasta que he dado con tu blog y me he fijado que utilizas la función urllib.request.urlretrieve()
La he probado y funciona perfectamente.
muy buen aporte, eskerrik asko!!!
Hola
Estaba probando tu programa y no consigo hacerlo funcionar siempre me da error el scrapeo. Me puedes echar una mano
The code works perfectly, but is it restricted to number of results? It found only 5 results when I ran it.
Thank you very much bro!
Hola.
Me gustaría saber cómo obtener los siguientes datos:
– latitud y longitud
– localidad, municipio y provincia
Muchas gracias.
hi please update the program because it is not give us phone numpers now
Hello,
I also met issue of Chrome, although my Chrome has been updated
Hello,
Does this still work? I am getting this:
Current google-chrome version is 118.0.5993
Get LATEST chromedriver version for 118.0.5993 google-chrome
Current google-chrome version is 118.0.5993
Get LATEST chromedriver version for 118.0.5993 google-chrome
Current google-chrome version is 118.0.5993
Get LATEST chromedriver version for 118.0.5993 google-chrome
Current google-chrome version is 118.0.5993
Get LATEST chromedriver version for 118.0.5993 google-chrome
Current google-chrome version is 118.0.5993
Get LATEST chromedriver version for 118.0.5993 google-chrome
Error with the Chrome Driver
Error with the Chrome Driver
Error with the Chrome Driver
Error with the Chrome Driver
Error with the Chrome Driver
‘NoneType’ object has no attribute ‘find_element’
Hilo nº 2 1/1 – ERROR – query1
‘NoneType’ object has no attribute ‘find_element’
Hilo nº 1 1/1 – ERROR – query2
‘NoneType’ object has no attribute ‘find_element’
Hilo nº 0 1/1 – ERROR – query3
Hi, I downloaded the last version, but the code still shows the error of Chrome drivers.
the chrome driver is outdated for the latest chrome version