How to Scrape Google Inline Shopping Results

You may know Google Shopping for a big products aggregator page.

Google returns different kinds of results from your search keywords, and you may notice, that Google also returns inline shopping results in your search results.

Not only from normal search pages but when you search for image results or Google Lens or many other Google products, the product shopping results are still available.

Google Product shopping results are valuable for your market research, allowing businesses to gather insights into market trends, pricing dynamics and competitor offerings.

You can also monitor product availability, pricing fluctuations and promotional activities. You can optimize your SEO for product listing, website content based on the keywords, descriptions and metadata displayed in Inline Shopping Results.

Scraping Google inline shopping results will be very easy with SerpApi. We provide rich, high-quality results from the Google Search page. Let's look closer.

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 Inline Shopping Results with SerpApi

Head to the Google Inline Shopping Results from the documentation on SerpApi for details.

In this tutorial, we will scrape all inline shopping results when searching "PlayStation 5" . The data contains: "position", "title", "price", "extracted_price", "link", "second_hand_condition", "source", "thumbnail", "rating", "reviews" 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',                    # SerpApi search engine
    'q': 'PlayStation 5'
}

To retrieve Google Inline Shopping Results for a given search query, you can use the following code:

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

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

import csv

results = serpapi.Client().search(params)['shopping_results']

header = ["position", "title", "price", "extracted_price", "link", "second_hand_condition", "source", "thumbnail", "rating", "reviews"]

with open("google_shopping_results.csv", "w", encoding="UTF8", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(header)
    for item in results:
        writer.writerow([item.get('position'), item.get('title'), item.get('price'), item.get('extracted_price'), item.get('link'), item.get('second_hand_condition'), item.get('source'), item.get('thumbnail'), item.get('rating'), item.get('reviews')])

This example is using 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.