Tutorial

How to Build TikTok to Amazon Product Trend Pipeline

Spot trending products on TikTok before they blow up on Amazon. Cross-platform trend detection pipeline at $0.010/trend.

Products that go viral on TikTok often see a surge in Amazon sales 2-4 weeks later. This pipeline spots trending products on TikTok and cross-references them with Amazon search data to identify arbitrage opportunities. Each trend check across both platforms costs $0.010.

Prerequisites

  • Python 3.8+
  • requests library
  • A Scavio API key from scavio.dev
  • Product niches to monitor

Walkthrough

Step 1: Find trending products on TikTok

Search TikTok for product-related content and identify trending items.

Python
import os, requests, json
from datetime import datetime
from collections import Counter

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

NICHES = ['skincare routine', 'desk setup', 'kitchen gadgets', 'gym accessories']

def find_tiktok_trends(niche):
    data = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
        headers=TH, json={'query': f'{niche} must have 2026'}).json()
    videos = data.get('videos', data.get('data', {}).get('videos', []))
    products = []
    for v in videos:
        desc = v.get('desc', '')
        plays = v.get('stats', {}).get('playCount', 0)
        likes = v.get('stats', {}).get('diggCount', 0)
        if plays > 10000:  # Only viral content
            products.append({
                'desc': desc[:100],
                'plays': plays,
                'likes': likes,
                'engagement': likes / plays if plays else 0,
                'author': v.get('author', {}).get('uniqueId', ''),
            })
    return sorted(products, key=lambda x: x['plays'], reverse=True)

trends = {}
for niche in NICHES:
    trending = find_tiktok_trends(niche)
    trends[niche] = trending
    print(f'\n{niche}: {len(trending)} trending videos')
    for t in trending[:3]:
        print(f'  {t["plays"]:>10,} plays | @{t["author"]:15} | {t["desc"][:45]}')
print(f'\nCost: ${len(NICHES) * 0.005:.3f}')

Step 2: Cross-reference with Amazon search

Check if trending TikTok products are available and selling on Amazon.

Python
def check_amazon_availability(product_desc, niche):
    # Extract product keywords from TikTok description
    query = f'{niche} {product_desc[:30]}'
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': query, 'platform': 'amazon', 'country_code': 'us'}, timeout=10).json()
    results = data.get('organic_results', [])
    if not results:
        return None
    top = results[0]
    return {
        'title': top.get('title', '')[:60],
        'price': top.get('price', top.get('extracted_price', '')),
        'rating': top.get('rating', ''),
        'link': top.get('link', ''),
        'amazon_position': 1,
    }

print(f'\n=== TikTok -> Amazon Cross-Reference ===')
cross_ref = []
for niche, trending in trends.items():
    for trend in trending[:2]:  # Top 2 per niche
        amazon = check_amazon_availability(trend['desc'], niche)
        if amazon:
            cross_ref.append({
                'niche': niche,
                'tiktok_plays': trend['plays'],
                'tiktok_engagement': trend['engagement'],
                'amazon_title': amazon['title'],
                'amazon_price': amazon['price'],
            })
            print(f'  TikTok: {trend["plays"]:>10,} plays | Amazon: {amazon["price"]} - {amazon["title"][:40]}')
        else:
            print(f'  TikTok: {trend["plays"]:>10,} plays | Amazon: NOT FOUND (opportunity?)')
print(f'\nCross-ref cost: ${len(NICHES) * 2 * 0.005:.3f}')

Step 3: Score and rank opportunities

Score each trend by TikTok virality and Amazon market presence.

Python
def score_opportunities(cross_ref):
    print(f'\n{"=" * 60}')
    print(f'  TIKTOK -> AMAZON TREND REPORT')
    print(f'  Date: {datetime.now().strftime("%Y-%m-%d")}')
    print(f'{"=" * 60}')
    for item in cross_ref:
        # Virality score (0-50)
        virality = min(50, item['tiktok_plays'] / 20000)
        # Engagement quality (0-30)
        engagement = min(30, item['tiktok_engagement'] * 300)
        # Total opportunity score
        score = virality + engagement
        item['opportunity_score'] = score
    cross_ref.sort(key=lambda x: x['opportunity_score'], reverse=True)
    print(f'\n  Ranked Opportunities:')
    for i, item in enumerate(cross_ref, 1):
        print(f'  {i}. [{item["opportunity_score"]:5.1f}] {item["niche"]}')
        print(f'     TikTok: {item["tiktok_plays"]:,} plays | {item["tiktok_engagement"]*100:.1f}% engagement')
        print(f'     Amazon: {item["amazon_price"]} - {item["amazon_title"][:45]}')
    total_cost = (len(NICHES) + len(NICHES) * 2) * 0.005
    print(f'\n  Total cost: ${total_cost:.3f}')
    print(f'  Monthly (daily scans): ${total_cost * 30:.2f}')
    print(f'  Spot trends 2-4 weeks before Amazon sales spike.')

score_opportunities(cross_ref)

Python Example

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

def trend_check(niche):
    tt = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
        headers=TH, json={'query': f'{niche} must have'}).json()
    videos = tt.get('videos', tt.get('data', {}).get('videos', []))
    print(f'TikTok: {len(videos)} videos for "{niche}"')
    am = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': niche, 'platform': 'amazon', 'country_code': 'us'}).json()
    print(f'Amazon: {len(am.get("organic_results", []))} products')

trend_check('desk setup gadgets')

JavaScript Example

JavaScript
const TH = { 'Authorization': `Bearer ${process.env.SCAVIO_API_KEY}`, 'Content-Type': 'application/json' };
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
const tt = await fetch('https://api.scavio.dev/api/v1/tiktok/search/videos', {
  method: 'POST', headers: TH, body: JSON.stringify({ query: 'desk setup must have' })
}).then(r => r.json());
const am = await fetch('https://api.scavio.dev/api/v1/search', {
  method: 'POST', headers: SH,
  body: JSON.stringify({ query: 'desk setup', platform: 'amazon', country_code: 'us' })
}).then(r => r.json());
console.log(`TikTok: ${(tt.videos || []).length} | Amazon: ${(am.organic_results || []).length}`);

Expected Output

JSON
skincare routine: 8 trending videos
     2,500,000 plays | @skincarebysara   | This vitamin C serum changed everything
     1,200,000 plays | @dermglow          | Morning routine must-haves for 2026

desk setup: 5 trending videos
     3,100,000 plays | @techsetups        | Minimal desk setup 2026 essentials

=== TikTok -> Amazon Cross-Reference ===
  TikTok:  3,100,000 plays | Amazon: $34.99 - Desk Organizer Minimal Wood Stand
  TikTok:  2,500,000 plays | Amazon: $28.99 - Vitamin C Serum with Hyaluronic

============================================================
  TIKTOK -> AMAZON TREND REPORT
============================================================

  1. [ 47.5] desk setup
     TikTok: 3,100,000 plays | 8.2% engagement
     Amazon: $34.99 - Desk Organizer Minimal Wood Stand

  Total cost: $0.060
  Monthly (daily scans): $1.80

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8+. requests library. A Scavio API key from scavio.dev. Product niches to monitor. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Spot trending products on TikTok before they blow up on Amazon. Cross-platform trend detection pipeline at $0.010/trend.