ScavioScavio
FeaturesPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Fetch Google Shopping Results via API
Tutorial

How to Fetch Google Shopping Results via API

Pull Google Shopping product listings in JSON using the Scavio API. Extract prices, merchants, ratings, and product images for price intelligence tools.

Get Free API KeyAPI Docs

Google Shopping results aggregate product listings from thousands of retailers and appear prominently in Google search results. They are a valuable source of competitive pricing intelligence, merchant discovery, and market price benchmarking. The Scavio API returns Google Shopping results in the shopping_results field of SERP responses, including product title, price, merchant, rating, and image URL. This tutorial shows how to extract and analyze Google Shopping data for any product category.

Prerequisites

  • Python 3.8 or higher
  • requests library installed
  • A Scavio API key
  • Familiarity with price data analysis

Walkthrough

Step 1: Fetch Google Shopping results

Add "shopping" context to your query or query a product name directly. Google Shopping results appear in shopping_results in the Scavio response.

Python
def get_shopping(product: str) -> list[dict]:
    response = requests.post(
        "https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"query": product, "country_code": "us"}
    )
    response.raise_for_status()
    data = response.json()
    return data.get("shopping_results", [])

Step 2: Extract pricing by merchant

Build a dictionary mapping merchant names to their listed prices for the product.

Python
def prices_by_merchant(items: list[dict]) -> dict:
    result = {}
    for item in items:
        merchant = item.get("source", "Unknown")
        price = item.get("price", "N/A")
        result[merchant] = price
    return result

Step 3: Find the lowest price

Parse prices and identify the merchant offering the lowest listed price.

Python
def lowest_price(items: list[dict]) -> dict | None:
    def parse(item):
        p = item.get("price", "")
        return float(p.replace("$", "").replace(",", "")) if p else float("inf")
    return min(items, key=parse, default=None)

Step 4: Generate a price intelligence summary

Print a summary of the price range across merchants and highlight the best deal.

Python
items = get_shopping("iPhone 16 Pro")
merchants = prices_by_merchant(items)
best = lowest_price(items)
print(f"Found {len(items)} listings")
print(f"Best price: {best.get('price')} from {best.get('source')}")
for m, p in list(merchants.items())[:5]:
    print(f"  {m}: {p}")

Python Example

Python
import os
import requests

API_KEY = os.environ.get("SCAVIO_API_KEY", "your_scavio_api_key")
ENDPOINT = "https://api.scavio.dev/api/v1/search"

def get_shopping(product: str) -> list[dict]:
    r = requests.post(ENDPOINT, headers={"x-api-key": API_KEY},
                      json={"query": product, "country_code": "us"})
    r.raise_for_status()
    return r.json().get("shopping_results", [])

def lowest_price(items: list[dict]) -> dict | None:
    def val(item):
        p = item.get("price", "")
        return float(p.replace("$", "").replace(",", "")) if p else float("inf")
    return min(items, key=val, default=None)

if __name__ == "__main__":
    items = get_shopping("Sony WH-1000XM5 headphones")
    best = lowest_price(items)
    print(f"{len(items)} shopping listings found")
    if best:
        print(f"Lowest: {best.get('price')} at {best.get('source')}")
    for item in items[:5]:
        print(f"  {item.get('source', 'N/A')}: {item.get('price', 'N/A')}")

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY || "your_scavio_api_key";
const ENDPOINT = "https://api.scavio.dev/api/v1/search";

async function getShopping(product) {
  const res = await fetch(ENDPOINT, {
    method: "POST",
    headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify({ query: product, country_code: "us" })
  });
  const data = await res.json();
  return data.shopping_results || [];
}

async function main() {
  const items = await getShopping("Sony WH-1000XM5 headphones");
  const sorted = items.sort((a, b) => {
    const pa = parseFloat((a.price || "").replace(/[$,]/g, "")) || Infinity;
    const pb = parseFloat((b.price || "").replace(/[$,]/g, "")) || Infinity;
    return pa - pb;
  });
  console.log(`${items.length} listings found`);
  sorted.slice(0, 5).forEach(i => console.log(`${i.source}: ${i.price}`));
}
main().catch(console.error);

Expected Output

JSON
{
  "shopping_results": [
    {
      "title": "Sony WH-1000XM5 Wireless Headphones",
      "price": "$279.00",
      "source": "Best Buy",
      "rating": "4.8",
      "reviews": 9842,
      "link": "https://bestbuy.com/...",
      "thumbnail": "https://cdn.bestbuy.com/..."
    }
  ]
}

Related Tutorials

  • How to Build a Price Comparison Tool for Amazon and Walmart
  • How to Fetch Walmart Product Search Data via API

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8 or higher. requests library installed. A Scavio API key. Familiarity with price data analysis. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Best Of

Best Google Shopping Data APIs in 2026

Read more
Best Of

Best Google Shopping Data APIs in 2026

Read more
Glossary

Google Shopping Structured Search

Read more
Solution

Google Ads Data from SERP APIs

Read more
Use Case

Google Ads SERP Extraction

Read more
Solution

Get Google Shopping Data Without Proxies

Read more

Start Building

Pull Google Shopping product listings in JSON using the Scavio API. Extract prices, merchants, ratings, and product images for price intelligence tools.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy