ScavioScavio
产品定价文档
登录开始使用
  1. 首页
  2. 教程
  3. 如何构建 TikTok 电子商务趋势跟踪器
教程

如何构建 TikTok 电子商务趋势跟踪器

构建 TikTok 电子商务趋势跟踪器,监控病毒式产品和主题标签,以进行直销和 DTC 研究。包含 Python 和 JS 代码。

获取免费API密钥API文档

使用 API 构建 TikTok 电子商务趋势跟踪器,让您可以实时监控病毒产品、趋势标签和新兴利基市场,以便您可以在竞争对手发现之前找到获胜产品。本教程将引导您搜索与电子商务相关的 TikTok 内容,从主题标签和标题中提取产品信号,以及构建一个按速度和参与度对趋势进行排名的评分系统。

前置条件

  • 具有 TikTok 访问权限的 Scavio API 密钥(在 scavio.dev 上每月免费 250 个积分)
  • Python 3.9+ 或 Node.js 18+
  • 对电商产品研究的基本了解

操作指南

步骤 1: 定义产品发现搜索查询

建立一个展示病毒式产品的 TikTok 搜索查询列表。使用 dropshippers 和 DTC 品牌通常监控的主题标签式查询和产品类别关键字。包括广泛的趋势查询和特定领域的查询。

Python
search_queries = [
    'tiktok made me buy it',
    'viral product 2026',
    'amazon finds must have',
    'small business check',
    'dropshipping winning product',
    'kitchen gadget viral',
    'skincare routine viral',
    'home organization hack',
]

步骤 2: 在 TikTok 中搜索热门内容

查询每个产品发现查询的 Scavio TikTok 搜索端点。收集视频元数据,包括观看次数、点赞、分享、主题标签和发布日期。这些原始数据将成为您的趋势信号。

Python
import requests

API_KEY = 'your_scavio_api_key'

def search_tiktok(query, count=20):
    resp = requests.post(
        'https://api.scavio.dev/api/v1/tiktok/search/videos',
        headers={'Authorization': f'Bearer {API_KEY}'},
        json={'query': query, 'count': count}
    )
    resp.raise_for_status()
    return resp.json().get('videos', [])

all_videos = []
for q in search_queries:
    videos = search_tiktok(q, count=20)
    for v in videos:
        v['search_query'] = q
    all_videos.extend(videos)

print(f'Collected {len(all_videos)} videos across {len(search_queries)} queries')

步骤 3: 按参与度提取主题标签并对其进行排名

从所有收集的视频中解析主题标签,并汇总每个主题标签的参与度指标。出现在多个高参与度视频中的主题标签标志着流行产品或利基市场。

Python
from collections import defaultdict

hashtag_stats = defaultdict(lambda: {'total_views': 0, 'total_likes': 0, 'video_count': 0})

for v in all_videos:
    for tag in v.get('hashtags', []):
        tag_lower = tag.lower()
        hashtag_stats[tag_lower]['total_views'] += v.get('views', 0)
        hashtag_stats[tag_lower]['total_likes'] += v.get('likes', 0)
        hashtag_stats[tag_lower]['video_count'] += 1

# Rank by a composite score: views * sqrt(video_count)
import math

ranked = sorted(
    hashtag_stats.items(),
    key=lambda x: x[1]['total_views'] * math.sqrt(x[1]['video_count']),
    reverse=True
)

print('Top trending hashtags:')
for tag, stats in ranked[:15]:
    print(f'  #{tag}: {stats["total_views"]:,} views, {stats["video_count"]} videos')

步骤 4: 对产品趋势进行评分和分类

根据参与速度(每个视频的观看次数)、广度(唯一视频的数量)和新近度,为每个主题标签集群分配趋势分数。根据分数阈值将趋势分类为新兴趋势、峰值趋势或饱和趋势。

Python
def score_trend(stats):
    views_per_video = stats['total_views'] / max(stats['video_count'], 1)
    breadth = stats['video_count']
    score = (views_per_video / 1000) * math.sqrt(breadth)
    if score > 100 and breadth < 10:
        phase = 'emerging'
    elif score > 50:
        phase = 'peaking'
    else:
        phase = 'saturated'
    return {'score': round(score, 1), 'phase': phase, 'views_per_video': int(views_per_video)}

trends = []
for tag, stats in ranked[:30]:
    trend = score_trend(stats)
    trend['hashtag'] = tag
    trend['total_views'] = stats['total_views']
    trend['video_count'] = stats['video_count']
    trends.append(trend)

for t in trends[:10]:
    print(f'#{t["hashtag"]} | score: {t["score"]} | phase: {t["phase"]} | {t["views_per_video"]:,} views/vid')

步骤 5: 出口趋势报告

将评分趋势保存到 JSON 文件,您可以将其输入到产品研究工作流程、Slack 警报或仪表板中。包含原始数据,以便您稍后可以使用不同的阈值重新评分。

Python
import json

report = {
    'scan_date': '2026-05-12',
    'total_videos_analyzed': len(all_videos),
    'unique_hashtags': len(hashtag_stats),
    'top_trends': trends,
}

with open('tiktok_ecommerce_trends.json', 'w') as f:
    json.dump(report, f, indent=2)

print(f'Exported {len(trends)} trends to tiktok_ecommerce_trends.json')

Python 示例

Python
import requests
import math
import json
from collections import defaultdict

API_KEY = 'your_scavio_api_key'

search_queries = [
    'tiktok made me buy it',
    'viral product 2026',
    'amazon finds must have',
    'dropshipping winning product',
]

def search_tiktok(query, count=20):
    resp = requests.post(
        'https://api.scavio.dev/api/v1/tiktok/search/videos',
        headers={'Authorization': f'Bearer {API_KEY}'},
        json={'query': query, 'count': count}
    )
    resp.raise_for_status()
    return resp.json().get('videos', [])

all_videos = []
for q in search_queries:
    videos = search_tiktok(q, count=20)
    for v in videos:
        v['search_query'] = q
    all_videos.extend(videos)

hashtag_stats = defaultdict(lambda: {'total_views': 0, 'total_likes': 0, 'video_count': 0})
for v in all_videos:
    for tag in v.get('hashtags', []):
        tag_lower = tag.lower()
        hashtag_stats[tag_lower]['total_views'] += v.get('views', 0)
        hashtag_stats[tag_lower]['total_likes'] += v.get('likes', 0)
        hashtag_stats[tag_lower]['video_count'] += 1

ranked = sorted(
    hashtag_stats.items(),
    key=lambda x: x[1]['total_views'] * math.sqrt(x[1]['video_count']),
    reverse=True
)

trends = []
for tag, stats in ranked[:30]:
    vpv = stats['total_views'] / max(stats['video_count'], 1)
    score = (vpv / 1000) * math.sqrt(stats['video_count'])
    phase = 'emerging' if score > 100 and stats['video_count'] < 10 else ('peaking' if score > 50 else 'saturated')
    trends.append({
        'hashtag': tag,
        'score': round(score, 1),
        'phase': phase,
        'total_views': stats['total_views'],
        'video_count': stats['video_count'],
    })

report = {
    'scan_date': '2026-05-12',
    'total_videos': len(all_videos),
    'top_trends': trends,
}

with open('tiktok_ecommerce_trends.json', 'w') as f:
    json.dump(report, f, indent=2)

print(f'Analyzed {len(all_videos)} videos, found {len(trends)} trends')
for t in trends[:5]:
    print(f'  #{t["hashtag"]} | score: {t["score"]} | {t["phase"]}')

JavaScript 示例

JavaScript
const fs = require('fs');

const API_KEY = 'your_scavio_api_key';

const searchQueries = [
  'tiktok made me buy it',
  'viral product 2026',
  'amazon finds must have',
  'dropshipping winning product',
];

async function searchTiktok(query, count = 20) {
  const resp = await fetch('https://api.scavio.dev/api/v1/tiktok/search/videos', {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ query, count }),
  });
  const data = await resp.json();
  return data.videos || [];
}

async function main() {
  const allVideos = [];
  for (const q of searchQueries) {
    const videos = await searchTiktok(q, 20);
    videos.forEach(v => { v.search_query = q; });
    allVideos.push(...videos);
  }

  const hashtagStats = {};
  for (const v of allVideos) {
    for (const tag of v.hashtags || []) {
      const t = tag.toLowerCase();
      if (!hashtagStats[t]) hashtagStats[t] = { totalViews: 0, totalLikes: 0, videoCount: 0 };
      hashtagStats[t].totalViews += v.views || 0;
      hashtagStats[t].totalLikes += v.likes || 0;
      hashtagStats[t].videoCount += 1;
    }
  }

  const ranked = Object.entries(hashtagStats)
    .sort((a, b) => b[1].totalViews * Math.sqrt(b[1].videoCount) - a[1].totalViews * Math.sqrt(a[1].videoCount))
    .slice(0, 30);

  const trends = ranked.map(([tag, stats]) => {
    const vpv = stats.totalViews / Math.max(stats.videoCount, 1);
    const score = (vpv / 1000) * Math.sqrt(stats.videoCount);
    const phase = score > 100 && stats.videoCount < 10 ? 'emerging' : score > 50 ? 'peaking' : 'saturated';
    return { hashtag: tag, score: Math.round(score * 10) / 10, phase, totalViews: stats.totalViews, videoCount: stats.videoCount };
  });

  const report = { scan_date: '2026-05-12', total_videos: allVideos.length, top_trends: trends };
  fs.writeFileSync('tiktok_ecommerce_trends.json', JSON.stringify(report, null, 2));
  console.log(`Analyzed ${allVideos.length} videos, found ${trends.length} trends`);
  trends.slice(0, 5).forEach(t => console.log(`  #${t.hashtag} | score: ${t.score} | ${t.phase}`));
}

main();

预期输出

JSON
Analyzed 80 videos, found 30 trends
  #tiktokmademebuyit | score: 245.3 | peaking
  #viralproduct | score: 189.7 | peaking
  #amazonfind | score: 134.2 | emerging
  #kitchengadget | score: 98.4 | peaking
  #dropshipping2026 | score: 76.1 | emerging

相关教程

  • 如何在赞助前使用 API 清单审查 TikTok 创作者
  • 如何使用 API + LLM 分析 TikTok 评论情绪
  • 如何使用搜索 API 构建潜在客户发掘渠道

常见问题

大多数开发者在15到30分钟内完成本教程。您需要一个Scavio API密钥(免费套餐即可)和可用的Python或JavaScript环境。

具有 TikTok 访问权限的 Scavio API 密钥(在 scavio.dev 上每月免费 250 个积分). Python 3.9+ 或 Node.js 18+. 对电商产品研究的基本了解. Scavio API密钥注册即送50个免费积分。

可以。免费套餐注册即送50个积分,完全足够完成本教程并构建一个可运行的原型解决方案。

Scavio提供原生LangChain包(langchain-scavio)、MCP服务器以及适用于任何HTTP客户端的REST API。本教程使用 the raw REST API, 但您可以根据需要适配您选择的框架。

相关资源

Best Of

最佳 TikTok 标签分析 API (2026)

Read more
Best Of

2026 年最佳无需身份验证的 TikTok 数据 API

Read more
Glossary

TikTok 非官方 API

Read more
Comparison

TikTok Proxy Scraping vs TikTok Third-Party API (Scavio, TikAPI)

Read more
Solution

TikTok

Read more
Glossary

TikTok API 合规与抓取对比

Read more

开始构建

构建 TikTok 电子商务趋势跟踪器,监控病毒式产品和主题标签,以进行直销和 DTC 研究。包含 Python 和 JS 代码。

获取免费API密钥阅读文档
ScavioScavio

面向AI智能体的实时搜索API。搜索所有平台,不仅仅是Google。

产品

  • 功能
  • 定价
  • 控制台
  • 联盟计划

开发者

  • 文档
  • API参考
  • 快速开始
  • MCP集成
  • Python SDK

替代方案

  • Tavily替代方案
  • SerpAPI替代方案
  • Firecrawl替代方案
  • Exa替代方案

工具

  • JSON格式化
  • cURL转代码
  • Token计数器
  • 全部工具

© 2026 Scavio. 保留所有权利。

Featured on TAAFT
服务条款隐私政策