ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Collect UGC from TikTok Hashtags
Tutorial

How to Collect UGC from TikTok Hashtags

Collect user-generated content from TikTok hashtags. Filter by engagement, download metadata, and build UGC libraries. Python at $0.005/call.

Get Free API KeyAPI Docs

User-generated content from TikTok hashtags is the richest source of authentic brand mentions, product reviews, and creative assets for marketing. This collector scans hashtag feeds, filters videos by engagement thresholds, and builds a structured UGC library with metadata. Each hashtag scan costs $0.005 through the Scavio TikTok API.

Prerequisites

  • Python 3.8+
  • requests library
  • A Scavio API key from scavio.dev
  • Target hashtags to scan for UGC

Walkthrough

Step 1: Scan hashtag feeds for videos

Pull recent videos from target hashtags.

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

def scan_hashtag(tag):
    data = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag/videos',
        headers=TH, json={'name': tag}).json()
    videos = data.get('videos', data.get('data', {}).get('videos', []))
    return [{'id': v.get('id', ''), 'desc': v.get('desc', '')[:100],
             'author': v.get('author', {}).get('uniqueId', 'unknown'),
             'plays': v.get('stats', {}).get('playCount', 0),
             'likes': v.get('stats', {}).get('diggCount', 0),
             'comments': v.get('stats', {}).get('commentCount', 0),
             'shares': v.get('stats', {}).get('shareCount', 0),
             'created': v.get('createTime', 0)} for v in videos]

videos = scan_hashtag('amazonfinds')
print(f'#amazonfinds: {len(videos)} videos found')
for v in videos[:3]:
    print(f'  @{v["author"]}: {v["desc"][:50]}... ({v["plays"]:,} plays)')

Step 2: Filter by engagement thresholds

Keep only high-performing UGC that meets minimum engagement criteria.

Python
def filter_ugc(videos, min_plays=10000, min_likes=500, min_engagement_rate=3.0):
    qualified = []
    for v in videos:
        plays = v.get('plays', 0)
        if plays < min_plays:
            continue
        engagement = v['likes'] + v['comments'] + v['shares']
        er = (engagement / plays * 100) if plays else 0
        if v['likes'] >= min_likes and er >= min_engagement_rate:
            v['engagement_rate'] = round(er, 2)
            qualified.append(v)
    qualified.sort(key=lambda x: x['engagement_rate'], reverse=True)
    print(f'Filtered: {len(qualified)}/{len(videos)} videos meet criteria')
    print(f'  Min plays: {min_plays:,}, Min likes: {min_likes}, Min ER: {min_engagement_rate}%')
    return qualified

filtered = filter_ugc(videos)
for v in filtered[:5]:
    print(f'  @{v["author"]:20} | {v["plays"]:>10,} plays | {v["engagement_rate"]}% ER | {v["desc"][:40]}')

Step 3: Scan multiple hashtags and deduplicate

Collect UGC across related hashtags and remove duplicate videos.

Python
def collect_ugc(hashtags, min_plays=10000, min_likes=500):
    all_videos = []
    seen_ids = set()
    for tag in hashtags:
        videos = scan_hashtag(tag)
        for v in videos:
            if v['id'] not in seen_ids:
                v['hashtag'] = tag
                all_videos.append(v)
                seen_ids.add(v['id'])
        print(f'  #{tag}: {len(videos)} videos ({len(seen_ids)} unique total)')
    filtered = filter_ugc(all_videos, min_plays=min_plays, min_likes=min_likes)
    cost = len(hashtags) * 0.005
    print(f'\nTotal: {len(filtered)} qualified UGC from {len(hashtags)} hashtags')
    print(f'Cost: ${cost:.3f}')
    return filtered

hashtags = ['amazonfinds', 'tiktokmademebuyit', 'musthave', 'productreview']
ugc_library = collect_ugc(hashtags)

Step 4: Build and export the UGC library

Save the curated UGC library with metadata for marketing use.

Python
def export_ugc_library(ugc, filename='ugc_library.json'):
    library = {
        'collected_at': datetime.now().isoformat(),
        'total_videos': len(ugc),
        'videos': []
    }
    for v in ugc:
        library['videos'].append({
            'video_id': v['id'],
            'author': v['author'],
            'description': v['desc'],
            'hashtag_source': v.get('hashtag', ''),
            'metrics': {
                'plays': v['plays'], 'likes': v['likes'],
                'comments': v['comments'], 'shares': v['shares'],
                'engagement_rate': v.get('engagement_rate', 0)
            },
            'tiktok_url': f'https://www.tiktok.com/@{v["author"]}/video/{v["id"]}'
        })
    with open(filename, 'w') as f:
        json.dump(library, f, indent=2)
    # Stats
    avg_er = sum(v.get('engagement_rate', 0) for v in ugc) / len(ugc) if ugc else 0
    avg_plays = sum(v['plays'] for v in ugc) / len(ugc) if ugc else 0
    print(f'\nUGC Library saved to {filename}')
    print(f'  Videos: {len(ugc)}')
    print(f'  Avg engagement rate: {avg_er:.2f}%')
    print(f'  Avg plays: {avg_plays:,.0f}')
    print(f'  Top creator: @{ugc[0]["author"]}' if ugc else '')

export_ugc_library(ugc_library)

Python Example

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

def collect(hashtag, min_plays=10000):
    data = requests.post('https://api.scavio.dev/api/v1/tiktok/hashtag/videos',
        headers=TH, json={'name': hashtag}).json()
    videos = data.get('videos', data.get('data', {}).get('videos', []))
    filtered = [v for v in videos if v.get('stats', {}).get('playCount', 0) >= min_plays]
    print(f'#{hashtag}: {len(filtered)}/{len(videos)} videos with {min_plays:,}+ plays. Cost: $0.005')
    for v in filtered[:3]:
        print(f'  @{v.get("author", {}).get("uniqueId", "?")}: {v.get("desc", "")[:40]}')

collect('amazonfinds')

JavaScript Example

JavaScript
const TH = { 'Authorization': `Bearer ${process.env.SCAVIO_API_KEY}`, 'Content-Type': 'application/json' };
async function collect(hashtag, minPlays = 10000) {
  const data = 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 = (data.videos || data.data?.videos || []);
  const filtered = videos.filter(v => (v.stats?.playCount || 0) >= minPlays);
  console.log(`#${hashtag}: ${filtered.length}/${videos.length} with ${minPlays.toLocaleString()}+ plays`);
  filtered.slice(0, 3).forEach(v =>
    console.log(`  @${v.author?.uniqueId || '?'}: ${(v.desc || '').slice(0, 40)}`));
}
await collect('amazonfinds');

Expected Output

JSON
#amazonfinds: 20 videos found
  @sarahfinds: This Stanley tumbler color is everything... (2,400,000 plays)
  @dealsqueen: Under $15 Amazon finds you NEED... (1,800,000 plays)

  #amazonfinds: 20 videos (20 unique total)
  #tiktokmademebuyit: 18 videos (35 unique total)
  #musthave: 15 videos (44 unique total)
  #productreview: 12 videos (50 unique total)
Filtered: 18/50 videos meet criteria

UGC Library saved to ugc_library.json
  Videos: 18
  Avg engagement rate: 7.34%
  Avg plays: 890,000

Related Tutorials

  • How to Build a TikTok Competitor Tracker
  • How to Build TikTok Social Listening
  • How to Build Public Account Analytics via TikTok API

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. Target hashtags to scan for UGC. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, 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.

Related Resources

Best Of

Best TikTok UGC Campaign Tracking APIs (May 2026)

Read more
Best Of

Best TikTok Hashtag Analytics APIs (2026)

Read more
Use Case

TikTok UGC Campaign Tracking

Read more
Use Case

TikTok Hashtag Campaign Monitoring

Read more
Glossary

TikTok UGC API Tracking

Read more
Solution

TikTok UGC Collection via API

Read more

Start Building

Collect user-generated content from TikTok hashtags. Filter by engagement, download metadata, and build UGC libraries. Python at $0.005/call.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy