Google Maps is a famous tool for searching for places and restaurants by their names. Google has its own Google Food searches for better results and more accessibility to search.


The same as Google Maps results, Google Food results will return all information related to the restaurants, including title, rating, reviews, address, hours, images, links, distances, etc.

Google Food is a great tool for scraping massive restaurants at a location, conducting price research and analysis, and tracking your popularity with some keywords.
Scraping Google results and Google Food is challenging when scraping from scratch. But with SerpApi, you can scrape massive restaurant data effortlessly by using our Google Food API. Let's see how it works.

Setting Up a SerpApi Account

SerpApi offers a free plan for newly created accounts. Head to the sign-up page to register an account and complete your first search with our interactive playground. When you want to do more searches with us, please visit the pricing page.

Once you are familiar with all the results, you can utilize SERP APIs using your API Key.

Scrape your first Google Food result with SerpApi

Head to the Google Food API from the documentation on SerpApi for details.

Let's find all places to have a good pizza. The data contains: "title", "rating", "reviews", "distance", "address", "hours", "website", "phone", and more. You can also scrape more information with SerpApi.

First, you need to install the SerpApi client library.

pip install google-search-results

Set up the SerpApi credentials and search.

from serpapi import GoogleSearch
import os, json, csv

params = {
    'api_key': 'YOUR_API_KEY',             # your serpapi api
    'engine': 'google_food',               # SerpApi search engine
    'q': 'pizza'
}

To retrieve Google Food Results for a query, you can use the following code:

results = GoogleSearch(params).get_dict()['local_results']

You can store Google Food Results JSON data in databases or export them to a CSV file.

import csv

header = [ "title", "rating", "reviews", "distance", "address", "hours", "website", "phone"]

with open("google_food_results.csv", "w", encoding="UTF8", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(header)
    for item in results:
        writer.writerow([item.get('title'), item.get('rating'), item.get('reviews'), item.get('distance'), item.get('address'), item.get('hours'), item.get('links', {}).get('website'), item.get('links', {}).get('phone')])

This example uses Python, but you can also use all your favorite programming languages like Ruby, NodeJS, Java, PHP, and more.

If you have any questions, please feel free to contact me.