Products that go viral on TikTok often see Amazon price and inventory changes within hours. This tracker watches TikTok hashtags for product mentions, matches them to Amazon listings, and alerts on price movements. Each TikTok check costs $0.005 and each Amazon search costs $0.005, making a daily scan of 20 products $0.20.
Prerequisites
- Python 3.8+
- requests library
- A Scavio API key from scavio.dev
- Target hashtags or creators to monitor
Walkthrough
Step 1: Scan TikTok hashtags for product mentions
Pull recent videos from trending product hashtags and extract product names.
import os, requests, re, json
API_KEY = os.environ['SCAVIO_API_KEY']
TT_H = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}
def scan_hashtag(tag):
data = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag/videos',
headers=TT_H, json={'name': tag}).json()
videos = data.get('videos', data.get('data', {}).get('videos', []))[:20]
products = []
for v in videos:
desc = v.get('desc', v.get('description', ''))
if any(w in desc.lower() for w in ['link in bio', 'amazon', 'must have', 'under $']):
products.append({'desc': desc[:120], 'views': v.get('stats', {}).get('playCount', 0),
'author': v.get('author', {}).get('uniqueId', 'unknown')})
print(f'#{tag}: {len(videos)} videos, {len(products)} product mentions')
return products
products = scan_hashtag('amazonfinds')
for p in products[:3]: print(f' {p["desc"][:60]}... ({p["views"]:,} views)')Step 2: Extract product names and search Amazon
Parse product names from TikTok descriptions and find matching Amazon listings.
def extract_product(desc):
patterns = [r'([A-Z][\w\s]+(?:Pro|Max|Plus|Mini|Ultra)?)', r'the ([\w\s]+?) (?:is|from|on)']
for p in patterns:
m = re.search(p, desc)
if m: return m.group(1).strip()[:50]
words = desc.split()[:6]
return ' '.join(w for w in words if not w.startswith('#'))[:50]
def search_amazon(product_name):
data = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': product_name, 'platform': 'amazon', 'country_code': 'us'}).json()
results = data.get('organic_results', data.get('shopping_results', []))[:3]
return [{'title': r.get('title', '')[:60], 'price': r.get('price', 'N/A'),
'rating': r.get('rating', 'N/A'), 'link': r.get('link', '')}
for r in results]
for p in products[:3]:
name = extract_product(p['desc'])
listings = search_amazon(name)
print(f'\n TikTok: {name}')
for l in listings: print(f' Amazon: {l["title"][:50]} - {l["price"]} ({l["rating"]})')Step 3: Track price changes over time
Store prices and detect movements between scans.
import json
from datetime import datetime
DB_FILE = 'tiktok_amazon_prices.json'
def load_db():
try:
with open(DB_FILE) as f: return json.load(f)
except: return {}
def save_db(db):
with open(DB_FILE, 'w') as f: json.dump(db, f, indent=2)
def track_price(product_name, amazon_listing):
db = load_db()
key = product_name.lower().strip()
price_str = str(amazon_listing.get('price', 'N/A')).replace('$', '').replace(',', '')
try: price = float(price_str)
except: return None
now = datetime.now().isoformat()
if key not in db: db[key] = []
prev = db[key][-1]['price'] if db[key] else price
change = ((price - prev) / prev * 100) if prev else 0
db[key].append({'price': price, 'date': now})
save_db(db)
if abs(change) > 5:
print(f' ALERT: {product_name} price moved {change:+.1f}% (${prev:.2f} -> ${price:.2f})')
return change
track_price('Stanley Cup', {'price': '$34.99'})
track_price('Stanley Cup', {'price': '$39.99'})Step 4: Run the full tracking pipeline
Combine hashtag scanning, Amazon matching, and price tracking.
def run_tracker(hashtags):
all_alerts = []
total_cost = 0
for tag in hashtags:
products = scan_hashtag(tag)
total_cost += 0.005 # 1 TikTok API call
for p in products[:5]: # Top 5 per hashtag
name = extract_product(p['desc'])
listings = search_amazon(name)
total_cost += 0.005 # 1 Amazon search
for l in listings[:1]:
change = track_price(name, l)
if change and abs(change) > 5:
all_alerts.append({'product': name, 'change': change,
'price': l['price'], 'views': p['views']})
print(f'\nScanned {len(hashtags)} hashtags. Cost: ${total_cost:.3f}')
print(f'Price alerts: {len(all_alerts)}')
for a in all_alerts:
print(f' {a["product"]}: {a["change"]:+.1f}% -> {a["price"]} ({a["views"]:,} TikTok views)')
return all_alerts
run_tracker(['amazonfinds', 'tiktokmademebuyit'])Python Example
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
TT_H = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}
def track(hashtag):
vids = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag/videos',
headers=TT_H, json={'name': hashtag}).json()
videos = vids.get('videos', vids.get('data', {}).get('videos', []))[:10]
for v in videos[:3]:
desc = v.get('desc', '')[:50]
amz = requests.post('https://api.scavio.dev/api/v1/search',
headers=SH, json={'query': desc, 'platform': 'amazon', 'country_code': 'us'}).json()
top = (amz.get('organic_results') or [{}])[0]
print(f'TikTok: {desc}\n Amazon: {top.get("title", "N/A")[:40]} - {top.get("price", "N/A")}')
track('amazonfinds')JavaScript Example
const API_KEY = process.env.SCAVIO_API_KEY;
const TH = { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' };
const SH = { 'x-api-key': API_KEY, 'Content-Type': 'application/json' };
async function track(hashtag) {
const vids = await fetch('https://api.scavio.dev/api/v1/tiktok/hashtag/videos', {
method: 'POST', headers: TH, body: JSON.stringify({ name: hashtag })
}).then(r => r.json());
const videos = (vids.videos || vids.data?.videos || []).slice(0, 3);
for (const v of videos) {
const desc = (v.desc || '').slice(0, 50);
const amz = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: SH,
body: JSON.stringify({ query: desc, platform: 'amazon', country_code: 'us' })
}).then(r => r.json());
const top = (amz.organic_results || [{}])[0];
console.log(`TikTok: ${desc}\n Amazon: ${(top.title||'N/A').slice(0,40)} - ${top.price||'N/A'}`);
}
}
track('amazonfinds').catch(console.error);Expected Output
#amazonfinds: 20 videos, 8 product mentions
Stanley Quencher H2.0 FlowState Tumbler... (2,400,000 views)
Dyson Airwrap Complete Long... (1,800,000 views)
TikTok: Stanley Quencher
Amazon: Stanley Quencher H2.0 FlowState Tumbler 40oz - $34.99 (4.7)
ALERT: Stanley Quencher price moved +14.3% ($30.62 -> $34.99)
Scanned 2 hashtags. Cost: $0.060
Price alerts: 1
Stanley Quencher: +14.3% -> $34.99 (2,400,000 TikTok views)