TikTok Comment Sentiment Analysis via API for Brand Signals
Extract brand signals from TikTok video comments at scale. Pull comments and replies via API, detect mentions, complaints, and purchase intent.
TikTok comment data via API costs $0.005 per page of 20 comments and returns structured text, like counts, reply counts, and author info. Feed this into any sentiment classifier to track brand perception at scale without scraping.
Why TikTok Comments Matter for Brands
TikTok comments are unfiltered consumer signals. Unlike curated reviews on Amazon or filtered feedback on brand websites, TikTok comments capture raw reactions to products, services, and campaigns. A video with 500K views and overwhelmingly negative comments tells a different story than the view count suggests.
Pulling Comments via API
import requests, os
API_KEY = os.environ["SCAVIO_API_KEY"]
BASE = "https://api.scavio.dev"
HEADERS = {"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"}
def get_comments(video_id, max_pages=5):
all_comments = []
cursor = "0"
for _ in range(max_pages):
resp = requests.post(f"{BASE}/api/v1/tiktok/video/comments",
headers=HEADERS,
json={"video_id": video_id, "cursor": cursor, "count": 50})
data = resp.json()["data"]
comments = data.get("comments", [])
all_comments.extend([{
"text": c["text"],
"likes": c["digg_count"],
"replies": c["reply_comment_total"],
"author": c["user"]["nickname"],
"author_liked": c.get("is_author_digged", 0) == 1,
} for c in comments])
if not data.get("has_more"):
break
cursor = str(data["cursor"])
return all_comments
comments = get_comments("7350810998023949599")
print(f"Pulled {len(comments)} comments")Basic Sentiment Classification
from collections import Counter
POSITIVE = {"love", "amazing", "best", "perfect", "great", "fire",
"obsessed", "need", "bought", "ordered"}
NEGATIVE = {"hate", "worst", "terrible", "scam", "fake", "waste",
"awful", "disappointed", "broke", "returned"}
def classify(text):
words = set(text.lower().split())
pos = len(words & POSITIVE)
neg = len(words & NEGATIVE)
if pos > neg: return "positive"
if neg > pos: return "negative"
return "neutral"
sentiments = Counter(classify(c["text"]) for c in comments)
total = len(comments)
for label, count in sentiments.most_common():
print(f"{label}: {count} ({count/total*100:.0f}%)")Tracking Threaded Replies
def get_replies(video_id, comment_id, max_pages=3):
all_replies = []
cursor = "0"
for _ in range(max_pages):
resp = requests.post(
f"{BASE}/api/v1/tiktok/video/comments/replies",
headers=HEADERS,
json={"video_id": video_id, "comment_id": comment_id,
"cursor": cursor, "count": 20})
data = resp.json()["data"]
all_replies.extend(data.get("comments", []))
if not data.get("has_more"):
break
cursor = str(data["cursor"])
return all_replies
# Find comments with the most replies (conversation drivers)
hot_threads = sorted(comments, key=lambda c: c["replies"], reverse=True)
for c in hot_threads[:5]:
print(f"{c['replies']} replies: {c['text'][:60]}")Cost at Scale
Pulling 1,000 comments costs about $1.00 (20 pages at 50 comments each). Monitoring 50 videos daily costs roughly $50/month for comments alone. Add $0.005 per video detail lookup to get the view/engagement context for each video. Compare this to Brandwatch or Sprinklr social listening tools at $1,000-5,000/month.
Limitations
The API returns comment text but does not run sentiment analysis. You bring your own classifier (keyword-based, transformer, or LLM). Comments are returned in TikTok default order, which favors high-engagement comments. Deleted or hidden comments are not included.