ScavioScavio
ProduitTarifsDocumentation
ConnexionCommencer
  1. Accueil
  2. Tutoriels
  3. Comment créer des alertes de prix multi-plateformes pour les produits
Tutoriel

Comment créer des alertes de prix multi-plateformes pour les produits

Surveillez les prix des produits sur Amazon, Walmart et Google Shopping à partir d'une seule API. Alertes automatisées de baisse de prix à $0.015/produit.

Obtenez une clé API gratuiteDocumentation API

La surveillance des prix sur plusieurs plateformes nécessite généralement des scrapers séparés ou des outils coûteux. Ce tutoriel construit un système d'alerte de prix unifié qui vérifie Amazon, Walmart et Google Shopping via l'API Scavio. Vous définissez des prix cibles et recevez des alertes en cas de baisse. Chaque vérification sur les trois plateformes coûte $0.015 par produit.

Prérequis

  • Python 3.8+
  • bibliothèque requests
  • Une clé API Scavio depuis scavio.dev
  • Produits à suivre avec des prix cibles

Parcours

Étape 1: Définissez les produits et vérifiez les prix sur toutes les plateformes

Recherchez des produits sur Amazon, Walmart et Google Shopping simultanément.

Python
import os, requests, json
from datetime import datetime

API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}

MONITOR_LIST = [
    {'name': 'AirPods Pro 2', 'query': 'Apple AirPods Pro 2nd generation', 'target_price': 180.00},
    {'name': 'Keychron K8 Pro', 'query': 'Keychron K8 Pro wireless mechanical keyboard', 'target_price': 95.00},
    {'name': 'Anker 737 Charger', 'query': 'Anker 737 portable charger 24000mah', 'target_price': 80.00},
]

PLATFORMS = ['amazon', 'walmart', None]  # None = Google Shopping

def extract_price(text):
    if not text:
        return None
    try:
        cleaned = str(text).replace('$', '').replace(',', '').split('-')[0].split(' ')[0].strip()
        return float(cleaned)
    except (ValueError, IndexError):
        return None

def check_prices(product):
    results = []
    for platform in PLATFORMS:
        body = {'query': product['query'], 'country_code': 'us'}
        if platform:
            body['platform'] = platform
        data = requests.post('https://api.scavio.dev/api/v1/search',
            headers=SH, json=body, timeout=10).json()
        for r in data.get('organic_results', [])[:3]:
            price = extract_price(r.get('price', r.get('extracted_price', '')))
            if price:
                results.append({
                    'platform': platform or 'google',
                    'title': r.get('title', '')[:50],
                    'price': price,
                    'link': r.get('link', ''),
                })
    return results

for product in MONITOR_LIST:
    prices = check_prices(product)
    print(f'\n{product["name"]} (target: ${product["target_price"]:.2f})')
    for p in sorted(prices, key=lambda x: x['price'])[:5]:
        below = ' << BELOW TARGET' if p['price'] <= product['target_price'] else ''
        print(f'  {p["platform"]:8} ${p["price"]:>8.2f} | {p["title"][:40]}{below}')
print(f'\nCost: ${len(MONITOR_LIST) * len(PLATFORMS) * 0.005:.3f}')

Étape 2: Générez des alertes de baisse de prix

Comparez les prix actuels avec les cibles et les prix précédents pour détecter les baisses.

Python
PRICE_HISTORY = 'price_alerts_history.json'

def load_price_history():
    try:
        with open(PRICE_HISTORY) as f:
            return json.load(f)
    except FileNotFoundError:
        return {}

def save_price_history(history):
    with open(PRICE_HISTORY, 'w') as f:
        json.dump(history, f, indent=2)

def check_alerts(monitor_list):
    history = load_price_history()
    alerts = []
    today = datetime.now().strftime('%Y-%m-%d')
    for product in monitor_list:
        prices = check_prices(product)
        if not prices:
            continue
        best = min(prices, key=lambda x: x['price'])
        prev_best = history.get(product['name'], {}).get('best_price')
        # Target price alert
        if best['price'] <= product['target_price']:
            alerts.append({
                'type': 'target_hit',
                'product': product['name'],
                'price': best['price'],
                'target': product['target_price'],
                'platform': best['platform'],
                'link': best['link'],
            })
        # Price drop alert
        if prev_best and best['price'] < prev_best * 0.95:
            drop_pct = (1 - best['price'] / prev_best) * 100
            alerts.append({
                'type': 'price_drop',
                'product': product['name'],
                'old_price': prev_best,
                'new_price': best['price'],
                'drop_pct': drop_pct,
                'platform': best['platform'],
            })
        history[product['name']] = {'best_price': best['price'], 'date': today, 'platform': best['platform']}
    save_price_history(history)
    return alerts

alerts = check_alerts(MONITOR_LIST)
print(f'\n=== Price Alerts ===')
print(f'  Alerts: {len(alerts)}')
for a in alerts:
    if a['type'] == 'target_hit':
        print(f'  TARGET: {a["product"]} at ${a["price"]:.2f} on {a["platform"]} (target: ${a["target"]:.2f})')
    elif a['type'] == 'price_drop':
        print(f'  DROP: {a["product"]} ${a["old_price"]:.2f} -> ${a["new_price"]:.2f} (-{a["drop_pct"]:.0f}%) on {a["platform"]}')

Étape 3: Résumé quotidien du suivi

Générez un résumé quotidien de tous les produits suivis et des tendances des prix.

Python
def daily_summary(monitor_list):
    print(f'\n{"=" * 60}')
    print(f'  CROSS-PLATFORM PRICE MONITOR - {datetime.now().strftime("%Y-%m-%d")}')
    print(f'{"=" * 60}')
    total_queries = 0
    for product in monitor_list:
        prices = check_prices(product)
        total_queries += len(PLATFORMS)
        if not prices:
            print(f'\n  {product["name"]}: No prices found')
            continue
        best = min(prices, key=lambda x: x['price'])
        worst = max(prices, key=lambda x: x['price'])
        savings = worst['price'] - best['price']
        on_target = best['price'] <= product['target_price']
        status = 'BUY' if on_target else 'WAIT'
        print(f'\n  {product["name"]} [{status}]')
        print(f'    Target: ${product["target_price"]:.2f} | Best: ${best["price"]:.2f} ({best["platform"]})')
        print(f'    Range: ${best["price"]:.2f} - ${worst["price"]:.2f} | Save ${savings:.2f} cross-platform')
    cost = total_queries * 0.005
    print(f'\n  Daily cost: ${cost:.3f}')
    print(f'  Monthly: ${cost * 30:.2f}')
    print(f'  Products: {len(monitor_list)} | Platforms: {len(PLATFORMS)} | Queries: {total_queries}')

daily_summary(MONITOR_LIST)

Exemple Python

Python
import os, requests
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

def check_price(query, platform):
    body = {'query': query, 'country_code': 'us'}
    if platform: body['platform'] = platform
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json=body, timeout=10).json()
    for r in data.get('organic_results', [])[:1]:
        print(f'{platform or "google":8} | {r.get("price", "N/A")} | {r.get("title", "")[:40]}')

for p in ['amazon', 'walmart', None]:
    check_price('AirPods Pro 2', p)

Exemple JavaScript

JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
for (const platform of ['amazon', 'walmart', null]) {
  const body = { query: 'AirPods Pro 2', country_code: 'us', ...(platform && { platform }) };
  const data = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: SH, body: JSON.stringify(body)
  }).then(r => r.json());
  const r = (data.organic_results || [])[0];
  if (r) console.log(`${platform || 'google'}: ${r.price || 'N/A'} - ${r.title?.slice(0, 40)}`);
}

Sortie attendue

JSON
AirPods Pro 2 (target: $180.00)
  amazon   $  189.99 | Apple AirPods Pro 2nd Generation - USB
  walmart  $  179.99 | Apple AirPods Pro (2nd Generation) USB << BELOW TARGET
  google   $  184.99 | Apple AirPods Pro 2 - Best Buy

Cost: $0.045

=== Price Alerts ===
  Alerts: 1
  TARGET: AirPods Pro 2 at $179.99 on walmart (target: $180.00)

============================================================
  CROSS-PLATFORM PRICE MONITOR - 2026-05-21
============================================================

  AirPods Pro 2 [BUY]
    Target: $180.00 | Best: $179.99 (walmart)
    Range: $179.99 - $189.99 | Save $10.00 cross-platform

  Daily cost: $0.045
  Monthly: $1.35

Tutoriels associés

  • Comment construire un moniteur de produits Amazon sans scrapers
  • Comment construire un pipeline de recherche de vendeurs Walmart
  • Comment détecter les changements de mise en page Amazon via l'API

Questions fréquentes

La plupart des développeurs terminent ce tutoriel en 15 à 30 minutes. Vous aurez besoin d'une clé API Scavio (l'offre gratuite suffit) et d'un environnement Python ou JavaScript fonctionnel.

Python 3.8+. bibliothèque requests. Une clé API Scavio depuis scavio.dev. Produits à suivre avec des prix cibles. Une clé API Scavio vous donne 50 crédits gratuits à l'inscription.

Oui. L'offre gratuite comprend 50 crédits à l'inscription, ce qui est largement suffisant pour terminer ce tutoriel et prototyper une solution fonctionnelle.

Scavio dispose d'un package natif LangChain (langchain-scavio), d'un serveur MCP et d'une API REST simple qui fonctionne avec tout client HTTP. Ce tutoriel utilise the raw REST API, mais vous pouvez l'adapter à votre framework de prédilection.

Ressources connexes

Best Of

Meilleure API pour la surveillance des prix multiplateforme en 2026

Read more
Best Of

Meilleure API de suivi des prix e-commerce en 2026

Read more
Use Case

Surveillance des prix de produits multiplateforme

Read more
Use Case

Suivi des tendances produits multiplateforme

Read more
Solution

Surveillez les annonces de produits sur Amazon, Walmart et Google Shopping

Read more
Workflow

Workflow de surveillance de produits e-commerce multi-plateforme

Read more

Commencer

Surveillez les prix des produits sur Amazon, Walmart et Google Shopping à partir d'une seule API. Alertes automatisées de baisse de prix à $0.015/produit.

Obtenez une clé API gratuiteLire la documentation
ScavioScavio

API de recherche en temps réel pour agents IA. Recherchez sur toutes les plateformes, pas seulement Google.

Produit

  • Fonctionnalités
  • Tarifs
  • Tableau de bord
  • Affiliés

Développeurs

  • Documentation
  • Référence API
  • Démarrage rapide
  • Intégration MCP
  • SDK Python

Alternatives

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

Outils

  • Formateur JSON
  • cURL vers code
  • Compteur de jetons
  • Tous les outils

© 2026 Scavio. Tous droits réservés.

Featured on TAAFT
Conditions d'utilisationPolitique de confidentialité