How to Scrape TikTok Video Comments - The Easy Way
Need to extract TikTok video comments programmatically? Whether you're building sentiment analysis tools, community management dashboards, or social listening platforms, getting reliable TikTok comment data is essential.
In this guide, we'll show you the easiest way to scrape TikTok video comments using the TikTok Comments API - no complex scraping infrastructure required.
What Data Can You Extract?
The TikTok Comments API provides comprehensive comment information:
- Comment Content - Full comment text with emoji and sticker support
- Author Information - Username, display name, and profile avatar
- Engagement Metrics - Like counts for each comment
- Reply Data - Reply counts for threaded discussions
- Timestamps - Comment dates for temporal analysis
- Filtering & Sorting - Control how many comments to retrieve
Video Tutorial
Watch this step-by-step tutorial on scraping TikTok video comments:
The Easy Way: TikTok Comments API
The simplest and most reliable method is using the TikTok Comments API. Here's why:
✅ No Infrastructure Needed - No need to manage proxies, browsers, or anti-bot systems
✅ Always Up-to-Date - API automatically handles TikTok changes
✅ Fast & Reliable - Get comment data in seconds with 99.9% uptime
✅ Simple Integration - Just one API call with a TikTok video URL
✅ Structured Data - Clean JSON response ready for your application
API Endpoint
https://api.socialkit.dev/tiktok/comments
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | TikTok video URL (e.g., https://www.tiktok.com/@user/video/123) |
access_key | string | Yes | Your API access key |
limit | number | No | Number of comments to retrieve (max 100, default 10) |
Example Request
GET https://api.socialkit.dev/tiktok/comments?access_key=<your-access-key>&url=https://www.tiktok.com/@xkikicat/video/7526606933470612744&limit=20
Example Response
{
"success": true,
"data": {
"url": "https://www.tiktok.com/@xkikicat/video/7526606933470612744",
"comments": [
{
"author": "John",
"username": "shahdoos",
"text": "[sticker]",
"likes": 28600,
"date": "7-14",
"avatar": "https://p16-sign.tiktokcdn-us.com/...",
"replyCount": 81
},
{
"author": "xanax",
"username": "xanax_r6",
"text": "smol car [cry]",
"likes": 10500,
"date": "7-13",
"avatar": "https://p16-sign.tiktokcdn-us.com/...",
"replyCount": 95
}
]
}
}
Code Examples
JavaScript / Node.js
const axios = require('axios');
async function getTikTokComments(videoUrl, accessKey, limit = 50) {
try {
const response = await axios.get('https://api.socialkit.dev/tiktok/comments', {
params: {
access_key: accessKey,
url: videoUrl,
limit: limit
}
});
return response.data;
} catch (error) {
console.error('Error fetching TikTok comments:', error);
throw error;
}
}
// Usage
const videoUrl = 'https://www.tiktok.com/@xkikicat/video/7526606933470612744';
const accessKey = 'your-access-key';
getTikTokComments(videoUrl, accessKey, 50)
.then(data => {
console.log(`Total comments retrieved: ${data.data.comments.length}`);
data.data.comments.forEach(comment => {
console.log(`\n@${comment.username}: ${comment.text}`);
console.log(` Likes: ${comment.likes} | Replies: ${comment.replyCount}`);
});
});
Python
import requests
def get_tiktok_comments(video_url, access_key, limit=50):
endpoint = 'https://api.socialkit.dev/tiktok/comments'
params = {
'access_key': access_key,
'url': video_url,
'limit': limit
}
response = requests.get(endpoint, params=params)
response.raise_for_status()
return response.json()
# Usage
video_url = 'https://www.tiktok.com/@xkikicat/video/7526606933470612744'
access_key = 'your-access-key'
data = get_tiktok_comments(video_url, access_key, 50)
print(f"Total comments: {len(data['data']['comments'])}")
for comment in data['data']['comments']:
print(f"\n@{comment['username']}: {comment['text']}")
print(f" Likes: {comment['likes']:,} | Replies: {comment['replyCount']}")
PHP
<?php
function getTikTokComments($videoUrl, $accessKey, $limit = 50) {
$endpoint = 'https://api.socialkit.dev/tiktok/comments';
$url = $endpoint . '?' . http_build_query([
'access_key' => $accessKey,
'url' => $videoUrl,
'limit' => $limit
]);
$response = file_get_contents($url);
return json_decode($response, true);
}
// Usage
$videoUrl = 'https://www.tiktok.com/@xkikicat/video/7526606933470612744';
$accessKey = 'your-access-key';
$data = getTikTokComments($videoUrl, $accessKey, 50);
echo "Total comments: " . count($data['data']['comments']) . "\n\n";
foreach ($data['data']['comments'] as $comment) {
echo "@{$comment['username']}: {$comment['text']}\n";
echo " Likes: " . number_format($comment['likes']) . " | Replies: {$comment['replyCount']}\n\n";
}
cURL
curl -X GET "https://api.socialkit.dev/tiktok/comments?access_key=your-access-key&url=https://www.tiktok.com/@xkikicat/video/7526606933470612744&limit=50"
Use Cases
1. Sentiment Analysis Dashboard
Analyze comment sentiment to gauge audience reaction:
async function analyzeCommentSentiment(videoUrl, accessKey) {
const data = await getTikTokComments(videoUrl, accessKey, 100);
const comments = data.data.comments;
// Simple sentiment analysis
const positiveKeywords = ['love', 'amazing', 'great', 'awesome', 'best'];
const negativeKeywords = ['hate', 'bad', 'terrible', 'worst'];
let positive = 0, negative = 0, neutral = 0;
comments.forEach(comment => {
const text = comment.text.toLowerCase();
const hasPositive = positiveKeywords.some(word => text.includes(word));
const hasNegative = negativeKeywords.some(word => text.includes(word));
if (hasPositive && !hasNegative) positive++;
else if (hasNegative && !hasPositive) negative++;
else neutral++;
});
return {
total: comments.length,
positive: positive,
negative: negative,
neutral: neutral,
positiveRate: ((positive / comments.length) * 100).toFixed(2) + '%'
};
}
2. Top Commenters Identifier
Find the most engaged users in your comments:
def find_top_commenters(video_url, access_key):
"""Identify most engaged commenters by likes received"""
data = get_tiktok_comments(video_url, access_key, 100)
comments = data['data']['comments']
# Sort by likes
sorted_comments = sorted(comments, key=lambda x: x['likes'], reverse=True)
top_commenters = []
for comment in sorted_comments[:10]:
top_commenters.append({
'username': comment['username'],
'comment': comment['text'],
'likes': comment['likes'],
'replies': comment['replyCount']
})
return top_commenters
3. Comment Keywords Extractor
Extract trending keywords from comments:
async function extractCommentKeywords(videoUrl, accessKey) {
const data = await getTikTokComments(videoUrl, accessKey, 100);
const comments = data.data.comments;
const wordFrequency = {};
const stopWords = new Set(['the', 'a', 'an', 'and', 'or', 'but', 'in', 'on', 'at']);
comments.forEach(comment => {
const words = comment.text.toLowerCase()
.replace(/[^\w\s]/g, '')
.split(/\s+/);
words.forEach(word => {
if (word.length > 3 && !stopWords.has(word)) {
wordFrequency[word] = (wordFrequency[word] || 0) + 1;
}
});
});
// Sort by frequency
return Object.entries(wordFrequency)
.sort((a, b) => b[1] - a[1])
.slice(0, 20)
.map(([word, count]) => ({ word, count }));
}
4. Community Management Alert System
Monitor for comments requiring attention:
def monitor_comments(video_urls, access_key, keywords_to_flag):
"""Monitor multiple videos for specific keywords"""
flagged_comments = []
for video_url in video_urls:
data = get_tiktok_comments(video_url, access_key, 50)
comments = data['data']['comments']
for comment in comments:
text_lower = comment['text'].lower()
# Check for flagged keywords
for keyword in keywords_to_flag:
if keyword.lower() in text_lower:
flagged_comments.append({
'video_url': video_url,
'username': comment['username'],
'comment': comment['text'],
'likes': comment['likes'],
'flagged_keyword': keyword
})
break
return flagged_comments
# Usage
videos = [
'https://www.tiktok.com/@user1/video/123',
'https://www.tiktok.com/@user2/video/456'
]
keywords = ['help', 'issue', 'problem', 'broken', 'refund']
alerts = monitor_comments(videos, 'your-key', keywords)
Response Data Explained
Comment Object Fields
author- Commenter's display nameusername- TikTok username (without @ prefix)text- Comment text (may include[sticker]or[emoji]placeholders)likes- Number of likes on the commentdate- Comment date in MM-DD formatavatar- Profile picture URLreplyCount- Number of replies to the comment
Understanding Stickers and Emojis
TikTok comments may contain stickers or emojis shown as placeholders:
[sticker]- A TikTok sticker was used[cry],[laugh], etc. - Named emoji placeholders
Supported URL Formats
The API accepts various TikTok video URL formats:
https://www.tiktok.com/@username/video/1234567890https://tiktok.com/@username/video/1234567890https://vm.tiktok.com/xxx(short URLs)https://www.tiktok.com/@username/video/1234567890?lang=en(with parameters)
Error Handling
Always implement proper error handling in production:
async function getTikTokCommentsWithRetry(videoUrl, accessKey, limit = 50, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
const response = await axios.get('https://api.socialkit.dev/tiktok/comments', {
params: { access_key: accessKey, url: videoUrl, limit: limit }
});
if (response.data.success) {
return response.data;
}
throw new Error('API returned unsuccessful response');
} catch (error) {
console.error(`Attempt ${i + 1} failed:`, error.message);
if (i === maxRetries - 1) {
throw error;
}
// Wait before retrying (exponential backoff)
await new Promise(resolve => setTimeout(resolve, Math.pow(2, i) * 1000));
}
}
}
Pricing
The TikTok Comments API is included in all SocialKit plans:
- Free: 20 credits (20 comment extractions)
- Basic: $13/month (2,000 credits)
- Pro: $27/month (10,000 credits)
- Ultimate: $79/month (50,000 credits)
Each API request costs 1 credit. View full pricing →
Alternative: Build Your Own Scraper
Want to build your own TikTok comment scraper? It's possible but complex:
Challenges
- Anti-Bot Protection - TikTok uses sophisticated bot detection
- Dynamic Content - Requires JavaScript rendering with Puppeteer/Selenium
- Infinite Scroll - Comments load dynamically as you scroll
- IP Blocking - Need rotating proxies to avoid rate limits
- Frequent Changes - TikTok regularly updates their HTML structure
- Legal Risks - Scraping may violate TikTok's Terms of Service
Basic Puppeteer Example
const puppeteer = require('puppeteer');
async function scrapeTikTokComments(videoUrl) {
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
try {
await page.goto(videoUrl, {
waitUntil: 'networkidle2',
timeout: 30000
});
// Wait for comments to load
await page.waitForSelector('[data-e2e="comment-item"]', { timeout: 10000 });
// Scroll to load more comments
for (let i = 0; i < 5; i++) {
await page.evaluate(() => {
window.scrollTo(0, document.body.scrollHeight);
});
await new Promise(resolve => setTimeout(resolve, 2000));
}
// Extract comments (this is fragile and will break)
const comments = await page.evaluate(() => {
const commentElements = document.querySelectorAll('[data-e2e="comment-item"]');
return Array.from(commentElements).map(el => ({
text: el.querySelector('[data-e2e="comment-text"]')?.textContent,
author: el.querySelector('[data-e2e="comment-author"]')?.textContent
}));
});
await browser.close();
return comments;
} catch (error) {
await browser.close();
throw error;
}
}
Why Use an API Instead?
- Reliability - APIs handle all the complexity for you
- Maintenance - No need to update selectors when TikTok changes
- Scale - Process thousands of videos without proxy management
- Legal - Using compliant APIs reduces legal risk
- Time - Focus on building features, not fighting anti-bot systems
Complete TikTok Data Toolkit
Beyond comments, you might need other TikTok data:
TikTok APIs:
- TikTok Comments API - Comment extraction and analysis
- TikTok Transcript API - Video transcripts
- TikTok Summary API - AI-powered video summaries
- TikTok Stats API - Video statistics and engagement
- TikTok Channel Stats API - Creator analytics
Free TikTok Tools:
Frequently Asked Questions
How many comments can I retrieve per request?
You can retrieve up to 100 comments per request using the limit parameter. For more comments, you'll need to make multiple requests.
Are comment replies included?
The API returns top-level comments with reply counts. To get nested replies, you would need to make additional requests or use a more advanced scraping solution.
How fresh is the comment data?
Comments are retrieved in real-time from TikTok, so you always get the latest data.
Can I filter comments by date or engagement?
Currently, comments are returned in TikTok's default order. You can sort and filter them in your application after retrieval.
What happens with deleted comments?
Deleted comments won't appear in the API response since they're no longer visible on TikTok.
Get Started
Ready to start extracting TikTok comments? Sign up for free and get 20 credits to test the API.
For complete API documentation, visit the TikTok Comments API docs.