Tutorial

How to Build a Multi-Platform Price Monitor

Build a price monitoring pipeline that tracks products across Amazon and Google Shopping. Detect price drops, compare sellers, and alert on changes.

Multi-platform price monitoring compares the same product across Amazon and Google Shopping to find the best deal and detect price changes. Instead of building separate scrapers for each platform, the Scavio API provides both Amazon product data and Google Shopping results through a single endpoint. This tutorial builds a monitoring pipeline that tracks products across platforms, stores historical prices, and alerts when prices drop below a threshold. Each platform check costs $0.005.

Prerequisites

  • Python 3.9+ installed
  • requests library installed
  • A Scavio API key from scavio.dev
  • A list of products to monitor

Walkthrough

Step 1: Search products on both platforms

Create functions to search Amazon and Google Shopping for the same product. Both use the Scavio search API with different platform parameters.

Python
import requests, os

API_KEY = os.environ['SCAVIO_API_KEY']
ENDPOINT = 'https://api.scavio.dev/api/v1/search'

def search_amazon(query: str) -> list:
    resp = requests.post(ENDPOINT,
        headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'},
        json={'platform': 'amazon', 'query': query, 'marketplace': 'US'})
    return resp.json().get('products', [])

def search_google_shopping(query: str) -> list:
    resp = requests.post(ENDPOINT,
        headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'},
        json={'query': query, 'country_code': 'us', 'type': 'shopping'})
    return resp.json().get('shopping_results', [])

Step 2: Normalize prices across platforms

Amazon and Google Shopping return prices in different formats. Normalize them to float values for comparison.

Python
import re

def parse_price(price_str) -> float:
    if not price_str:
        return 0.0
    if isinstance(price_str, (int, float)):
        return float(price_str)
    cleaned = re.sub(r'[^0-9.]', '', str(price_str))
    try:
        return float(cleaned)
    except ValueError:
        return 0.0

def compare_prices(query: str) -> dict:
    amazon = search_amazon(query)
    google = search_google_shopping(query)
    amazon_prices = [{'title': p.get('title', '')[:60], 'price': parse_price(p.get('price')),
                      'platform': 'amazon', 'link': p.get('link', '')}
                     for p in amazon if parse_price(p.get('price')) > 0]
    google_prices = [{'title': p.get('title', '')[:60], 'price': parse_price(p.get('price')),
                      'platform': 'google_shopping', 'link': p.get('link', '')}
                     for p in google if parse_price(p.get('price')) > 0]
    all_prices = sorted(amazon_prices + google_prices, key=lambda x: x['price'])
    return {'query': query, 'total_listings': len(all_prices),
            'cheapest': all_prices[0] if all_prices else None,
            'all': all_prices[:10]}

result = compare_prices('Sony WH-1000XM5')
print(f'Cheapest: ${result["cheapest"]["price"]} on {result["cheapest"]["platform"]}')

Step 3: Store price history in JSON

Save daily price snapshots so you can track trends and detect drops. Each product gets a time-series of prices per platform.

Python
import json
from datetime import date

HISTORY_FILE = 'price_history.json'

def load_history() -> dict:
    try:
        with open(HISTORY_FILE) as f:
            return json.load(f)
    except FileNotFoundError:
        return {}

def save_snapshot(query: str, prices: list) -> None:
    history = load_history()
    today = date.today().isoformat()
    if query not in history:
        history[query] = []
    history[query].append({
        'date': today,
        'prices': [{'platform': p['platform'], 'price': p['price'],
                     'title': p['title'][:40]} for p in prices[:5]]
    })
    with open(HISTORY_FILE, 'w') as f:
        json.dump(history, f, indent=2)

# Save today's data:
result = compare_prices('Sony WH-1000XM5')
save_snapshot('Sony WH-1000XM5', result['all'])
print(f'Saved snapshot with {len(result["all"])} listings')

Step 4: Detect price drops from history

Compare today's prices with the previous snapshot. Alert when a product drops below a threshold or shows a significant percentage decrease.

Python
def detect_drops(query: str, drop_threshold_pct: float = 10.0) -> list:
    history = load_history()
    snapshots = history.get(query, [])
    if len(snapshots) < 2:
        return []
    prev = {p['title']: p['price'] for p in snapshots[-2]['prices']}
    current = {p['title']: p['price'] for p in snapshots[-1]['prices']}
    drops = []
    for title, curr_price in current.items():
        if title in prev and prev[title] > 0:
            pct_change = ((curr_price - prev[title]) / prev[title]) * 100
            if pct_change < -drop_threshold_pct:
                drops.append({
                    'product': title,
                    'old_price': prev[title],
                    'new_price': curr_price,
                    'drop_pct': round(abs(pct_change), 1)
                })
    return drops

drops = detect_drops('Sony WH-1000XM5')
for d in drops:
    print(f'PRICE DROP: {d["product"]} ${d["old_price"]} -> ${d["new_price"]} (-{d["drop_pct"]}%)')

Step 5: Run daily monitoring for all products

Create a main script that monitors multiple products and reports all findings. Schedule it with cron for daily execution.

Python
def daily_monitor(products: list) -> None:
    print(f'Price monitor: {len(products)} products, {date.today()}')
    all_drops = []
    for product in products:
        result = compare_prices(product)
        save_snapshot(product, result['all'])
        cheapest = result.get('cheapest')
        if cheapest:
            print(f'  {product}: ${cheapest["price"]} ({cheapest["platform"]})')
        drops = detect_drops(product)
        all_drops.extend(drops)
    if all_drops:
        print(f'\n{len(all_drops)} price drops detected:')
        for d in all_drops:
            print(f'  {d["product"]}: ${d["old_price"]} -> ${d["new_price"]} (-{d["drop_pct"]}%)')
    cost = len(products) * 2 * 0.005  # 2 API calls per product
    print(f'\nAPI cost: ${cost:.2f} ({len(products) * 2} credits)')

if __name__ == '__main__':
    daily_monitor(['Sony WH-1000XM5', 'Apple AirPods Pro', 'Samsung Galaxy Buds'])

Python Example

Python
import os, requests, re, json
from datetime import date

API_KEY = os.environ['SCAVIO_API_KEY']
EP = 'https://api.scavio.dev/api/v1/search'

def search(body):
    return requests.post(EP, headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'}, json=body).json()

def parse_price(p):
    try: return float(re.sub(r'[^0-9.]', '', str(p or '0')))
    except: return 0.0

def compare(query):
    amazon = search({'platform': 'amazon', 'query': query, 'marketplace': 'US'}).get('products', [])
    google = search({'query': query, 'country_code': 'us', 'type': 'shopping'}).get('shopping_results', [])
    all_p = [{'title': p.get('title','')[:50], 'price': parse_price(p.get('price')), 'src': 'amazon'} for p in amazon]
    all_p += [{'title': p.get('title','')[:50], 'price': parse_price(p.get('price')), 'src': 'google'} for p in google]
    return sorted([p for p in all_p if p['price'] > 0], key=lambda x: x['price'])

for q in ['Sony WH-1000XM5', 'AirPods Pro']:
    results = compare(q)
    if results:
        print(f'{q}: ${results[0]["price"]} ({results[0]["src"]})')

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
const EP = 'https://api.scavio.dev/api/v1/search';

async function search(body) {
  const r = await fetch(EP, {
    method: 'POST',
    headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify(body)
  });
  return r.json();
}

function parsePrice(p) {
  return parseFloat(String(p || '0').replace(/[^0-9.]/g, '')) || 0;
}

async function compare(query) {
  const [amazon, google] = await Promise.all([
    search({ platform: 'amazon', query, marketplace: 'US' }),
    search({ query, country_code: 'us', type: 'shopping' })
  ]);
  const all = [
    ...(amazon.products || []).map(p => ({ title: p.title, price: parsePrice(p.price), src: 'amazon' })),
    ...(google.shopping_results || []).map(p => ({ title: p.title, price: parsePrice(p.price), src: 'google' }))
  ].filter(p => p.price > 0).sort((a, b) => a.price - b.price);
  return all;
}

compare('Sony WH-1000XM5').then(r => {
  if (r.length) console.log(`Cheapest: $${r[0].price} (${r[0].src})`);
});

Expected Output

JSON
Price monitor: 3 products, 2026-05-13
  Sony WH-1000XM5: $278.00 (amazon)
  Apple AirPods Pro: $189.99 (google_shopping)
  Samsung Galaxy Buds: $99.99 (amazon)

1 price drops detected:
  Apple AirPods Pro: $199.99 -> $189.99 (-5.0%)

API cost: $0.03 (6 credits)

Related Tutorials

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.9+ installed. requests library installed. A Scavio API key from scavio.dev. A list of products to monitor. 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.

Start Building

Build a price monitoring pipeline that tracks products across Amazon and Google Shopping. Detect price drops, compare sellers, and alert on changes.