While AI hasn't evolved any taste buds yet (at least to our knowledge here at a 2022 timestamp), the technology can hint pretty accurately at what kind of food humans prefer. Well, not technology; the web. So how about we see what kind of data we can extract for the best-rated and most affordable restaurants in Lisbon? People must love those for a reason. There's no trick here, just plain Google Maps scraping and a bit of web data collection.
Why would anyone need restaurant details from Google Maps?
For a regular user of Google Maps, the app is a combination of a navigator, a handy map that you don't even have to study, and a tour agent in one. You just type in the name of the city you've never visited or even heard of before, and within 10 minutes, the app makes you a local. It's truly a miracle of accessible knowledge.
But for someone dealing with data, Google Maps is nothing short of a free, up-to-date database. It allows data folks not only to find any place but also to check on its details, the number of which is only going to grow as the website evolves. All a data scientist has left to do is find a way to collect that data.
How to extract data from restaurants on Google Maps
So data collection for a gastronomic mission - here's how you can do it within 6 simple actions, even if you've never collected data from the web before β¬οΈ
Step 1. Find a Google Maps scraper
Apify Store is where we start our journey. Apify Store already has over 1K free-to-try tools for data extraction and web automation, enabling users to get data from Google, YouTube, and any other website you can think of, whether big or small. Feel free to explore it π
Now that you're done browsing the Store, type 'maps' into the search bar and see that quite a few of our Google Maps data tools show up. Choose the Google Maps Scraper and click Try for free to see what those 20K other G Maps Scraper users are after.
Getting started with Apify's data extraction tools requires an Apify account. For that, all you need is to think of a strong yet memorable password that's not your mother's maiden name and enter your email address. Even better if you have a GitHub account. In any case, it only takes an email address to sign up and see how far a test drive on Apify can take you.
Step 2. Search and filter Google Maps
Now head over to Google Maps. Search for Lisbon -> Restaurants and then filter them by lowest priced π² and best reviewed π. Now, see the refreshed restaurant results that you've received? We're going to extract the data on all of them by simply using the URL that shows up on top of the page. Copy it, and let's move on to the web scraping part.
Step 3. Define the data you are going to scrape
Now, let's take a closer look at what data Google Maps can display. As we've picked one of the Lisbon restaurants, we can see its name, images, rating, number of reviews, price category, places nearby, address, open hours, phone number, and whether the place is wheelchair accessible and offers delivery. The task for our scraper is to extract all this data at once and wrap it into a well-organized table.
Step 4. Paste the filtered search URL
Now that you're in your workspace, Apify Console, Google Maps Scraper is ready to take on any data extraction challenge. Scroll down a bit and copy-paste that long URL from Google Maps into a field slightly below, section Define the search area by other parameters. Let's go for the Save&Start button at the very bottom and see what results we'd receive from this single URL.
Step 5. Scrape and preview restaurant data
While our scraper is working, you'll notice how extracted data appears. But the data extraction process isn't finished until you see the status change to Succeeded. It shouldn't take too long, though. In just 10 minutes, we've collected all Google Maps data on the top 20 best restaurants in Lisbon with the most affordable pricing. Well done!
Step 6. View and download collected data
Once the scraper finishes extracting the data, head over to the Storage tab >Export button to preview and download your data, you can download it as an HTML table as you've seen it displayed in the previous step, go for a machine-readable JSON format, or take the data scientist's pick, a CSV file.
Step 7 (optional). Integrate data from Google Maps
Another thing that you can do instead of downloading the data is to integrate it with other apps, automation tools, and data analysis platforms such as Make, Zapier, or Airbyte. The platform allows you to plug in the data directly with no extra steps.
Now you know how to get data from Google Maps, what's next? You can give it another go with another city and another filter. Want to collect data on the most luxurious hotels in Porto? Or the worst fast food in Coimbra? There's nothing stopping you!
It's tempting to try and analyze why these restaurants are the best π€ Maybe the answer lies in the number of reviews they get and the level of satisfaction their customers express. You can easily look through that if you include reviews in your scraping input and do some sentiment analysis on top of the output. There's a scraper for Google Maps reviews designed for such cases. Or perhaps you want to look deeper into those restaurants' menu choices? There's a scraper for that part of Google Maps too. Give one of them a try and see if you can crack the code.