Les marques ont besoin de savoir quand les créateurs TikTok les mentionnent dans des vidéos ou des commentaires. La surveillance manuelle implique de faire défiler sans fin les résultats de recherche et les fils de commentaires. L'API Scavio TikTok vous permet de rechercher des vidéos par mot-clé de marque, de récupérer les commentaires de chaque vidéo correspondante et de signaler ceux qui mentionnent votre nom de marque ou produit. Ce tutoriel construit un pipeline qui s'exécute selon un planning, analyse les nouveaux contenus TikTok pour les mentions de marque et enregistre chaque mention avec le pseudo du créateur, l'ID de la vidéo et les statistiques d'engagement. À 0,005 $ par appel API, surveiller 50 vidéos et leurs commentaires coûte moins de 1 $ par exécution.
Prérequis
- Python 3.8+ ou Node.js 18+
- Une clé API Scavio depuis scavio.dev
- bibliothèque requests installée (Python)
- Le nom de la marque ou du produit que vous souhaitez suivre
Parcours
Étape 1: Rechercher des vidéos TikTok mentionnant votre marque
Utilisez le point de terminaison search/videos pour trouver des vidéos TikTok qui mentionnent votre nom de marque dans la description ou les hashtags.
import requests, os
API_KEY = os.environ['SCAVIO_API_KEY']
HEADERS = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
def search_brand_videos(brand, pages=3):
videos = []
cursor = 0
for _ in range(pages):
resp = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
headers=HEADERS,
json={'keyword': brand, 'count': 20, 'cursor': cursor})
data = resp.json()['data']
videos.extend(data.get('videos', []))
if not data.get('has_more'):
break
cursor = data['cursor']
return videosÉtape 2: Analysez les commentaires de chaque vidéo pour les mentions de marque
Pour chaque vidéo renvoyée, récupérez les commentaires et vérifiez si certains mentionnent votre nom de marque. Cela capture les mentions indirectes où la vidéo elle-même peut ne pas faire référence à la marque mais les commentateurs le font.
def scan_comments_for_brand(video_id, brand, max_pages=2):
mentions = []
cursor = 0
for _ in range(max_pages):
resp = requests.post('https://api.scavio.dev/api/v1/tiktok/video/comments',
headers=HEADERS,
json={'aweme_id': video_id, 'count': 20, 'cursor': cursor})
data = resp.json()['data']
for c in data.get('comments', []):
if brand.lower() in c['text'].lower():
mentions.append({'user': c['user']['unique_id'],
'text': c['text'], 'likes': c['digg_count']})
if not data.get('has_more'):
break
cursor = data.get('cursor', cursor + 20)
return mentionsÉtape 3: Agrégez et enregistrez toutes les mentions
Combinez les mentions au niveau de la vidéo et des commentaires dans un seul journal avec des horodatages. Écrivez dans un fichier JSON pour les alertes ou tableaux de bord en aval.
import json
from datetime import datetime
def run_monitor(brand):
videos = search_brand_videos(brand)
log = []
for v in videos:
entry = {'type': 'video', 'creator': v.get('author', {}).get('unique_id', ''),
'video_id': v['aweme_id'], 'desc': v['desc'][:100],
'plays': v['stats']['playCount'], 'scanned_at': datetime.now().isoformat()}
log.append(entry)
comment_mentions = scan_comments_for_brand(v['aweme_id'], brand)
for cm in comment_mentions:
log.append({'type': 'comment', 'video_id': v['aweme_id'],
'user': cm['user'], 'text': cm['text'][:100],
'scanned_at': datetime.now().isoformat()})
with open(f'brand_mentions_{brand}_{datetime.now().strftime("%Y-%m-%d")}.json', 'w') as f:
json.dump(log, f, indent=2)
print(f'Logged {len(log)} mentions for {brand}')
return logExemple Python
import requests, os, json
from datetime import datetime
API_KEY = os.environ['SCAVIO_API_KEY']
HEADERS = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
def search_videos(brand, pages=3):
videos, cursor = [], 0
for _ in range(pages):
resp = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
headers=HEADERS, json={'keyword': brand, 'count': 20, 'cursor': cursor}).json()['data']
videos.extend(resp.get('videos', []))
if not resp.get('has_more'): break
cursor = resp['cursor']
return videos
def scan_comments(video_id, brand):
mentions, cursor = [], 0
for _ in range(2):
resp = requests.post('https://api.scavio.dev/api/v1/tiktok/video/comments',
headers=HEADERS, json={'aweme_id': video_id, 'count': 20, 'cursor': cursor}).json()['data']
for c in resp.get('comments', []):
if brand.lower() in c['text'].lower():
mentions.append({'user': c['user']['unique_id'], 'text': c['text'][:100]})
if not resp.get('has_more'): break
cursor = resp.get('cursor', cursor + 20)
return mentions
def monitor(brand):
videos = search_videos(brand)
log = []
for v in videos:
log.append({'type': 'video', 'creator': v.get('author', {}).get('unique_id', ''),
'video_id': v['aweme_id'], 'plays': v['stats']['playCount']})
for cm in scan_comments(v['aweme_id'], brand):
log.append({'type': 'comment', 'video_id': v['aweme_id'], **cm})
with open(f'mentions_{brand}_{datetime.now():%Y-%m-%d}.json', 'w') as f:
json.dump(log, f, indent=2)
print(f'{len(log)} mentions found')
monitor('scavio')Exemple JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
const H = { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' };
const fs = require('fs');
async function searchVideos(brand, pages = 3) {
const videos = [];
let cursor = 0;
for (let i = 0; i < pages; i++) {
const r = await fetch('https://api.scavio.dev/api/v1/tiktok/search/videos', {
method: 'POST', headers: H, body: JSON.stringify({ keyword: brand, count: 20, cursor })
}).then(r => r.json());
videos.push(...(r.data.videos || []));
if (!r.data.has_more) break;
cursor = r.data.cursor;
}
return videos;
}
async function scanComments(videoId, brand) {
const mentions = [];
let cursor = 0;
for (let i = 0; i < 2; i++) {
const r = await fetch('https://api.scavio.dev/api/v1/tiktok/video/comments', {
method: 'POST', headers: H,
body: JSON.stringify({ aweme_id: videoId, count: 20, cursor })
}).then(r => r.json());
for (const c of r.data.comments || []) {
if (c.text.toLowerCase().includes(brand.toLowerCase()))
mentions.push({ user: c.user.unique_id, text: c.text.slice(0, 100) });
}
if (!r.data.has_more) break;
cursor = r.data.cursor || cursor + 20;
}
return mentions;
}
async function monitor(brand) {
const videos = await searchVideos(brand);
const log = [];
for (const v of videos) {
log.push({ type: 'video', creator: v.author?.unique_id, videoId: v.aweme_id, plays: v.stats.playCount });
const cms = await scanComments(v.aweme_id, brand);
cms.forEach(cm => log.push({ type: 'comment', videoId: v.aweme_id, ...cm }));
}
fs.writeFileSync(`mentions_${brand}_${new Date().toISOString().slice(0, 10)}.json`, JSON.stringify(log, null, 2));
console.log(`${log.length} mentions found`);
}
monitor('scavio').catch(console.error);Sortie attendue
[
{
"type": "video",
"creator": "techreviewer42",
"video_id": "7345678901234",
"plays": 24500,
"scanned_at": "2026-05-17T14:30:00"
},
{
"type": "comment",
"video_id": "7345678901234",
"user": "devfan99",
"text": "just tried scavio api and it worked great for my project",
"scanned_at": "2026-05-17T14:30:01"
}
]