How to scrape data for free from Google Maps
Hi everyone! I just wanted to share this hopefully it will help you to get started.
It can be technical, but nowadays you can always go back and forth prompting the LLM of your choice with the code and make any mods or fix issues, so it should be a setback.
https://colab.research.google.com/drive/1m9RzBI5fCkrp83b1UgnTw-GIxH8Sm2xe?usp=sharing
You can add more information in the place_details variable that you want to scrape, like for example images.
Step 1: Create an API Key for Google Maps from your Google Cloud Console account and replace it in the API_KEY variable.
Step 2: Replace (or delete if not needed) Country and cities where you want the results from.
Step 3: Replace "your_niche" in the search_query variable with your niche (for example: search_query = f"dog parks in {city}, {country}") You can remove the city and country variables if not needed like so: (example w/o city and country: search_query = f"dog parks").
Step 4: Run each block from top to bottom.
The csv file with scraped data wil be automatically downloaded!
Hope it’s useful and feel free to ask!
Note: Google API is free until a certain level of use so this can be specially useful to get started.