Tutorial

How to Build TikTok-to-Amazon Product Trend Pipeline

Detect trending TikTok products and check Amazon availability and pricing. Dropshipping and affiliate trend pipeline.

Products go viral on TikTok days before Amazon sellers stock them. This pipeline detects trending product mentions on TikTok, then checks Amazon for availability, pricing, and review counts. Catching the gap between TikTok virality and Amazon supply gives affiliate marketers and dropshippers a first-mover window.

Prerequisites

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

Walkthrough

Step 1: Search TikTok for trending product mentions

Find product-related TikTok videos with high engagement.

Python
import os, requests, json
from datetime import datetime

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'}

PRODUCT_QUERIES = [
    'tiktok made me buy it 2026',
    'viral amazon find',
    'amazon must haves trending',
    'best amazon products tiktok',
]

def search_tiktok_trends(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 [{'desc': v.get('desc', '')[:100], 'plays': v.get('stats', {}).get('playCount', 0),
             'likes': v.get('stats', {}).get('diggCount', 0),
             'author': v.get('author', {}).get('uniqueId', '')} for v in videos]

all_trends = []
for q in PRODUCT_QUERIES:
    videos = search_tiktok_trends(q)
    all_trends.extend(videos)
    print(f'"{q}": {len(videos)} videos')
print(f'Total: {len(all_trends)} product videos. Cost: ${len(PRODUCT_QUERIES) * 0.005:.3f}')

Step 2: Extract product names from TikTok descriptions

Parse product names and keywords from video descriptions.

Python
import re

def extract_products(videos):
    """Extract likely product names from TikTok video descriptions."""
    products = []
    for v in videos:
        desc = v['desc']
        # Look for product-like patterns
        words = desc.split()
        # Filter for multi-word product names (capitalized sequences)
        current = []
        for w in words:
            clean = re.sub(r'[^a-zA-Z0-9]', '', w)
            if clean and (clean[0].isupper() or clean.lower() in ['led', 'usb', 'mini']):
                current.append(clean)
            else:
                if len(current) >= 2:
                    products.append(' '.join(current))
                current = []
        if len(current) >= 2:
            products.append(' '.join(current))
    # Count frequency
    from collections import Counter
    freq = Counter(products)
    top = freq.most_common(10)
    print(f'\nTop trending products from TikTok:')
    for product, count in top:
        print(f'  {product}: mentioned in {count} videos')
    return [p for p, _ in top]

product_names = extract_products(all_trends)
print(f'\nProducts to check on Amazon: {len(product_names)}')

Step 3: Cross-reference products on Amazon

Check Amazon availability, price, and review count for each trending product.

Python
def check_amazon(product):
    """Search Amazon for a product and return pricing data."""
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': product, 'platform': 'amazon', 'country_code': 'us'}).json()
    results = data.get('organic_results', [])
    if not results:
        return {'product': product, 'available': False}
    top = results[0]
    return {
        'product': product,
        'available': True,
        'title': top.get('title', '')[:60],
        'price': top.get('price', 'N/A'),
        'rating': top.get('rating', 'N/A'),
        'reviews': top.get('reviews', 0),
        'link': top.get('link', '')
    }

def trend_report(product_names):
    print(f'\n=== TikTok -> Amazon Trend Report - {datetime.now().strftime("%Y-%m-%d")} ===')
    for product in product_names[:8]:
        info = check_amazon(product)
        if info['available']:
            print(f'  FOUND: {product}')
            print(f'    Amazon: {info["title"]}')
            print(f'    Price: {info["price"]} | Rating: {info["rating"]} | Reviews: {info["reviews"]}')
        else:
            print(f'  GAP: {product} - not yet on Amazon (opportunity)')
    cost = len(product_names[:8]) * 0.005 + len(PRODUCT_QUERIES) * 0.005
    print(f'\nTotal cost: ${cost:.3f}')

trend_report(product_names)

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'}

# Find trending on TikTok
tt = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
    headers=TH, json={'query': 'viral amazon find'}).json()
videos = tt.get('videos', tt.get('data', {}).get('videos', []))
print(f'TikTok: {len(videos)} trending videos')

# Check Amazon
az = requests.post('https://api.scavio.dev/api/v1/search',
    headers=SH, json={'query': 'LED strip lights', 'platform': 'amazon', 'country_code': 'us'}).json()
print(f'Amazon: {len(az.get("organic_results", []))} products')
print('Cost: $0.010')

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: 'viral amazon find' })
}).then(r => r.json());
console.log(`TikTok: ${(tt.videos || []).length} videos`);
const az = await fetch('https://api.scavio.dev/api/v1/search', {
  method: 'POST', headers: SH, body: JSON.stringify({ query: 'LED strip lights', platform: 'amazon', country_code: 'us' })
}).then(r => r.json());
console.log(`Amazon: ${(az.organic_results || []).length} products`);

Expected Output

JSON
"tiktok made me buy it 2026": 12 videos
"viral amazon find": 8 videos
"amazon must haves trending": 10 videos
Total: 42 product videos. Cost: $0.020

Top trending products from TikTok:
  LED Strip Lights: mentioned in 5 videos
  Mini Projector: mentioned in 3 videos

=== TikTok -> Amazon Trend Report ===
  FOUND: LED Strip Lights
    Amazon: LED Strip Lights 50ft with Remote Control RGB...
    Price: $12.99 | Rating: 4.3 | Reviews: 2340
  GAP: Cloud Light Lamp - not yet on Amazon (opportunity)

Total cost: $0.060

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 categories 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

Detect trending TikTok products and check Amazon availability and pricing. Dropshipping and affiliate trend pipeline.