Obtenga videos de cualquier hashtag de TikTok a través de la API de Scavio a $0.005/solicitud. Proceso de dos pasos: obtenga información del hashtag (incluido Challenge_id) y luego busque videos para ese hashtag con métricas de participación completas.
Requisitos previos
- Clave API de Scavio
- Nombre del hashtag de destino
- Python 3.8+ o Node.js 18+
Guia paso a paso
Paso 1: Obtener información del hashtag
Busque metadatos de hashtag, incluido Challenge_id y recuento de vistas.
import requests, os
HEADERS = {'Authorization': f'Bearer {os.environ["SCAVIO_API_KEY"]}',
'Content-Type': 'application/json'}
info = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag',
headers=HEADERS, json={'hashtag': 'smallbusiness'}).json()['data']
print(f"Views: {info['stats']['view_count']:,}")
print(f"Videos: {info['stats']['video_count']:,}")
challenge_id = info['challenge_id']Paso 2: Buscar vídeos para el hashtag
Utilice el desafío_id para publicar videos con este hashtag.
videos = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag/videos',
headers=HEADERS,
json={'challenge_id': challenge_id, 'count': 20, 'cursor': 0}).json()['data']
for v in videos.get('videos', []):
print(f"{v['desc'][:40]} | {v['stats']['playCount']:,} plays")Ejemplo en Python
import requests, os
HEADERS = {'Authorization': f'Bearer {os.environ["SCAVIO_API_KEY"]}',
'Content-Type': 'application/json'}
def hashtag_research(hashtag, video_pages=3):
info = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag',
headers=HEADERS, json={'hashtag': hashtag}).json()['data']
challenge_id = info['challenge_id']
videos = []
cursor = 0
for _ in range(video_pages):
resp = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag/videos',
headers=HEADERS,
json={'challenge_id': challenge_id, 'count': 20, 'cursor': cursor}).json()['data']
videos.extend(resp.get('videos', []))
if not resp.get('has_more'):
break
cursor = resp['cursor']
return {'views': info['stats']['view_count'],
'video_count': info['stats']['video_count'],
'sample_videos': len(videos), 'videos': videos}
result = hashtag_research('smallbusiness')
print(f"{result['views']:,} views, {result['sample_videos']} videos sampled")Ejemplo en JavaScript
const H = {'Authorization': `Bearer ${process.env.SCAVIO_API_KEY}`, 'Content-Type': 'application/json'};
async function hashtagResearch(hashtag) {
const info = await fetch('https://api.scavio.dev/api/v1/tiktok/hashtag', {
method: 'POST', headers: H, body: JSON.stringify({hashtag})
}).then(r => r.json());
const cid = info.data.challenge_id;
const vids = await fetch('https://api.scavio.dev/api/v1/tiktok/hashtag/videos', {
method: 'POST', headers: H,
body: JSON.stringify({challenge_id: cid, count: 20, cursor: 0})
}).then(r => r.json());
console.log(`${info.data.stats.view_count} views, ${(vids.data.videos||[]).length} sample videos`);
}
hashtagResearch('smallbusiness');Salida esperada
Hashtag metadata (total views, video count) plus sample videos with engagement metrics for content research.