Les mentions de marque apparaissent simultanément sur Google, Reddit, TikTok et YouTube. Surveiller chaque plateforme séparément est coûteux et fragmenté. Ce pipeline interroge les quatre plateformes depuis une seule API, déduplique les mentions, évalue le sentiment et génère un résumé quotidien unifié. Coût total : 0,020 $ par marque par jour.
Prérequis
- Python 3.8+
- bibliothèque requests
- Une clé API Scavio depuis scavio.dev
- Nom de la marque et noms des concurrents
Parcours
Étape 1: Interroger toutes les plateformes pour les mentions de marque
Recherchez votre marque sur Google, Reddit, TikTok et YouTube en une seule fois.
import os, requests, json
from datetime import datetime
from collections import Counter
API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}
TH = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
BRAND = 'Scavio'
def search_platform(query, platform=None):
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).json()
return [{'title': r.get('title', ''), 'link': r.get('link', ''),
'snippet': r.get('snippet', ''), 'platform': platform or 'google'}
for r in data.get('organic_results', [])]
def search_tiktok(query):
data = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
headers=TH, json={'query': query}).json()
videos = data.get('videos', data.get('data', {}).get('videos', []))
return [{'title': v.get('desc', '')[:80], 'link': f'tiktok.com/@{v.get("author", {}).get("uniqueId", "")}',
'snippet': v.get('desc', ''), 'platform': 'tiktok',
'plays': v.get('stats', {}).get('playCount', 0)} for v in videos]
all_mentions = []
for platform in [None, 'reddit', 'youtube']:
mentions = search_platform(BRAND, platform)
all_mentions.extend(mentions)
print(f'{platform or "google":10}: {len(mentions)} mentions')
tiktok_mentions = search_tiktok(BRAND)
all_mentions.extend(tiktok_mentions)
print(f'{"tiktok":10}: {len(tiktok_mentions)} mentions')
print(f'\nTotal: {len(all_mentions)} mentions. Cost: $0.020')Étape 2: Évaluer le sentiment et la portée par plateforme
Classifier le sentiment des mentions et estimer la portée sur les plateformes.
POSITIVE = ['best', 'great', 'love', 'recommend', 'amazing', 'excellent', 'perfect']
NEGATIVE = ['worst', 'terrible', 'avoid', 'hate', 'broken', 'expensive', 'scam']
def score_mention(mention):
text = f'{mention["title"]} {mention["snippet"]}'.lower()
pos = sum(1 for w in POSITIVE if w in text)
neg = sum(1 for w in NEGATIVE if w in text)
if pos > neg: return 'positive'
if neg > pos: return 'negative'
return 'neutral'
def platform_report(mentions):
by_platform = {}
for m in mentions:
p = m['platform']
if p not in by_platform:
by_platform[p] = []
by_platform[p].append(m)
print(f'\n=== Cross-Platform Brand Report - {BRAND} ===')
for platform, items in by_platform.items():
sentiments = Counter(score_mention(m) for m in items)
print(f'\n [{platform.upper()}] {len(items)} mentions')
print(f' Positive: {sentiments["positive"]} | Neutral: {sentiments["neutral"]} | Negative: {sentiments["negative"]}')
for item in items[:2]:
print(f' - {item["title"][:55]}')
platform_report(all_mentions)Étape 3: Générer un résumé quotidien unifié
Compiler toutes les données des plateformes en un rapport unique et exploitable.
def daily_digest(mentions):
total = len(mentions)
sentiments = Counter(score_mention(m) for m in mentions)
platforms = Counter(m['platform'] for m in mentions)
print(f'\n=== Daily Brand Digest - {datetime.now().strftime("%Y-%m-%d")} ===')
print(f' Brand: {BRAND}')
print(f' Total mentions: {total}')
print(f' Sentiment: +{sentiments["positive"]} neutral:{sentiments["neutral"]} -{sentiments["negative"]}')
print(f' Platforms: {", ".join(f"{p}({c})" for p, c in platforms.most_common())}')
# Highlight negative mentions that need attention
negative = [m for m in mentions if score_mention(m) == 'negative']
if negative:
print(f'\n NEEDS ATTENTION ({len(negative)} negative mentions):')
for m in negative[:3]:
print(f' [{m["platform"]}] {m["title"][:50]}')
print(f' {m["link"][:60]}')
# Highlight high-reach mentions
tiktok_high = [m for m in mentions if m.get('plays', 0) > 10000]
if tiktok_high:
print(f'\n HIGH REACH TikTok ({len(tiktok_high)} videos >10K plays):')
for m in tiktok_high[:3]:
print(f' {m["plays"]:,} plays: {m["title"][:40]}')
print(f'\n Daily cost: $0.020 (4 platform searches)')
daily_digest(all_mentions)Exemple Python
import os, requests
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}
TH = {'Authorization': f'Bearer {os.environ["SCAVIO_API_KEY"]}', 'Content-Type': 'application/json'}
brand = 'Scavio'
for p in [None, 'reddit', 'youtube']:
body = {'query': brand, 'country_code': 'us'}
if p: body['platform'] = p
data = requests.post('https://api.scavio.dev/api/v1/search', headers=SH, json=body).json()
print(f'{p or "google"}: {len(data.get("organic_results", []))} mentions')
tt = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos', headers=TH, json={'query': brand}).json()
print(f'tiktok: {len(tt.get("videos", []))} mentions')
print('Cost: $0.020')Exemple JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
for (const p of [null, 'reddit', 'youtube']) {
const body = { query: 'Scavio', country_code: 'us' };
if (p) body.platform = p;
const data = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: SH, body: JSON.stringify(body)
}).then(r => r.json());
console.log(`${p || 'google'}: ${(data.organic_results || []).length} mentions`);
}Sortie attendue
google : 8 mentions
reddit : 5 mentions
youtube : 4 mentions
tiktok : 6 mentions
Total: 23 mentions. Cost: $0.020
=== Daily Brand Digest - 2026-05-20 ===
Brand: Scavio
Total mentions: 23
Sentiment: +12 neutral:9 -2
Platforms: google(8), tiktok(6), reddit(5), youtube(4)
NEEDS ATTENTION (2 negative mentions):
[reddit] Scavio API returning 429 errors today
Daily cost: $0.020 (4 platform searches)