TikTok Video Comments Scraper avatar

TikTok Video Comments Scraper

Pricing

from $0.04 / 1,000 comments

Go to Apify Store
TikTok Video Comments Scraper

TikTok Video Comments Scraper

Extract every comment of TikTok videos, with the replies, and the video details. Returns structured data: comment text, author, likes, reply count, time and replies, plus video stats (views, likes, shares).

Pricing

from $0.04 / 1,000 comments

Rating

0.0

(0)

Developer

Kai

Kai

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

15 days ago

Last modified

Features

Limited permissions

Share

TikTok Video Comments Scraper - Comments, Replies and Video Stats

Get the comments of TikTok videos, with their replies, together with the details and stats of each video. Start with video URLs, or with profile URLs to read the videos of a profile. Each comment and each reply is one item in the Dataset. Each video also has one item in the Videos dataset, with its description, author, music, and counts of views, likes, comments, shares, and saves.

Read a sample of comments or every available comment. Run many videos in one run.

Use cases

Audience sentiment and topic research

Read what viewers say about a video. Send the comments to your own models.

{
"videoUrls": ["https://www.tiktok.com/@nasa/video/7700397098994273549"],
"maxCommentsPerVideo": 0
}

Use text, textLanguage, likes, type, repliesToId, and createTime in the Dataset.

Creator engagement

See which comments the creator wrote, pinned, or liked.

{
"videoUrls": ["https://www.tiktok.com/@nasa/video/7700397098994273549"],
"maxCommentsPerVideo": 200
}

Use isByCreator, isPinned, isLikedByCreator, and mentions in the Dataset.

Creator and brand monitoring

Track how the videos of a creator grow and what viewers say. Run the same input on an Apify schedule, and compare the results over time.

{
"profileUrls": ["https://www.tiktok.com/@nasa"],
"videosPerProfile": 5,
"maxCommentsPerVideo": 100
}

Use video.stats.views, video.stats.likes, video.stats.shares, video.stats.saves, and serverTotal in the Videos dataset. Use the cid of each comment in the Dataset to find new comments.

Content performance comparison

Compare several videos in one run.

{
"videoUrls": [
"https://www.tiktok.com/@nasa/video/7700397098994273549",
"https://www.tiktok.com/@mrbeast/video/7296168512408603947"
],
"maxCommentsPerVideo": 50
}

Use video.desc, video.author.uniqueId, video.stats, and serverTotal in the Videos dataset. Use videoId to join the two datasets.

Choose what to collect

GoalInputResult
All comments of a videomaxCommentsPerVideo set to 0Every available comment, with its replies
A sample of commentsmaxCommentsPerVideo set to a numberThe first comments, in TikTok's own order, with their replies
Comments without repliesincludeReplies set to falseNo reply items. replies still has the reply count
Comments without video detailsincludeVideoInfo set to falsevideo is null in the Videos dataset
Several videosMore than one entry in videoUrlsThe comments of all videos in one Dataset
The videos of a profileprofileUrls, and videosPerProfile for the number of videosThe comments of each video of the profile

What each comment includes

  • Comment: ID (cid), text, text language, likes, reply count, and creation time
  • Commenter: ID, handle, display name, verified flag, and avatar link
  • Flags: whether the creator pinned the comment, liked it, or wrote it
  • Extras: the users that the text mentions, the images, and the sticker
  • Reply: the same fields, with repliesToId for the comment that it answers, and repliesToReplyId when it answers another reply
  • Video, in the Videos dataset: ID, description, creation time, hashtags, author with follower counts, music, video details, and stats
  • Totals, in the Videos dataset: serverTotal, the comment count that TikTok shows, and commentCount, the number of comments saved
  • Source: inputUrl, the video URL or the profile URL from your input

Read the comments of a video

Start with one video URL:

{
"videoUrls": ["https://www.tiktok.com/@nasa/video/7700397098994273549"]
}

The Actor saves the video details and every available comment. Set maxCommentsPerVideo to set an upper limit. See Input reference.

Use the full video URL, with /video/ and the numeric video ID:

https://www.tiktok.com/@username/video/1234567890123456789

Other links give an error item. This includes short links, such as vm.tiktok.com, and photo posts. Open the short link, and copy the full URL that it leads to.

Limit the comments

{
"videoUrls": ["https://www.tiktok.com/@nasa/video/7700397098994273549"],
"maxCommentsPerVideo": 100
}

The Actor stops each video at 100 comments. The replies of those comments do not count in this number. Comments come in TikTok's own order, not by date. A limit gives the first comments in that order.

Comments without replies

{
"videoUrls": ["https://www.tiktok.com/@nasa/video/7700397098994273549"],
"includeReplies": false
}

The Dataset has no reply items. replies still has the number of replies. This run is faster.

Comments without video details

{
"videoUrls": ["https://www.tiktok.com/@nasa/video/7700397098994273549"],
"includeVideoInfo": false
}

video is null in each item of the Videos dataset. The comments, serverTotal, and commentCount stay the same.

Read the comments of a profile

{
"profileUrls": ["https://www.tiktok.com/@nasa"],
"videosPerProfile": 5,
"maxCommentsPerVideo": 50
}

The Actor reads the public videos of each profile and collects the comments of each video like for a video URL. videosPerProfile sets the number of videos for each profile. 0, the default, reads every public video of the profile, which can take a long time. Each video has an item in the Videos dataset, and inputUrl holds the profile URL from your input. A profile URL looks like https://www.tiktok.com/@handle. You can use videoUrls and profileUrls in the same run.

How results are ordered and limited

Order. Items of different videos can be mixed in the Dataset. Use videoId to tell them apart. Inside one video, the items come in TikTok's own order, and each reply follows its comment. The order is not by date or by likes. Sort the items on createTime or likes in your own tool.

Limit. maxCommentsPerVideo applies to each video, not to the complete run. Replies do not count in it. videosPerProfile applies to each profile. A limit gives the first items in TikTok's own order.

Same video twice. The Actor reads a video once. A video that two inputs point to, such as a video URL and a profile, gives its items once. inputUrl names one of the two inputs.

Input

Provide at least one video URL or one profile URL.

Input reference

ParameterTypeDefaultEffect
videoUrlsstring[]emptyFull TikTok video URLs. Provide at least one video URL or one profile URL. See Supported links.
profileUrlsstring[]emptyTikTok profile URLs. The Actor reads the public videos of each profile and collects their comments. See Read the comments of a profile.
videosPerProfileinteger, 0 or more0Upper limit on the videos that the Actor reads for each profile. 0 removes the limit.
maxCommentsPerVideointeger, 0 or more0Upper limit on saved comments for each video. 0 removes the limit. Replies do not count. See How many comments can I collect?.
includeRepliesbooleantrueAdds the replies of each comment as items in the Dataset. When false, there are no reply items. Replies add time. See Are replies included?.
includeVideoInfobooleantrueAdds the video details to each item of the Videos dataset. When false, video is null.
proxyConfigurationobject{"useApifyProxy":true}Connection settings for the run. Keep the default.
  • Use full URLs. A video URL looks like https://www.tiktok.com/@handle/video/<ID>. A profile URL looks like https://www.tiktok.com/@handle.
  • A value that is not a URL stops the run before collection.
  • Unknown input fields are ignored.

Output

The Actor writes three datasets. The Dataset holds the comments and the replies. The Videos dataset holds one item for each video. The Errors dataset holds the error items. The Output tab of the run links to all three. The Export button of the run exports only the Dataset.

Every documented field is present in every comment item. When a value is not available, the field is null, or an empty list for mentions and images. A comment without text has an empty text. A count that TikTok does not give is 0.

Sample items

These Dataset items are from a real run. They show a comment with one of its replies. The values of the commenters are removed.

This item of the Videos dataset is from the same run. The links are removed.

Comment fields

FieldType and contents
cidstring. The ID of the comment or reply.
typestring. comment or reply.
textstring. The text. It is empty when the comment has no text, for example a sticker.
createTimestring or null. The creation time in Unix seconds, such as "1793524282".
likesnumber. The likes of the comment or reply.
repliesnumber or null. For a comment, the reply count that TikTok shows. It can differ from the number of reply items. null for a reply.
repliesToIdstring or null. For a reply, the cid of its comment. null for a comment.
repliesToReplyIdstring or null. For a reply that answers another reply, the cid of that reply. Otherwise null.
textLanguagestring or null. The language code of the text, such as en. un means that TikTok does not know the language.
isPinnedboolean or null. true for the comment that the creator pinned. null for a reply.
isLikedByCreatorboolean or null. true when the creator liked the comment.
isByCreatorboolean or null. true when the creator of the video wrote the comment.
mentionsobject[]. The users that the text mentions. Empty when there are none.
mentions[].idstring. The ID of the mentioned user.
mentions[].namestring. The name as the commenter wrote it after the @. It is a display name, so it can contain spaces.
imagesstring[]. The links of the images in the comment. The links expire.
stickerstring or null. The link of the sticker in the comment. The link expires.
author.idstring. The ID of the commenter.
author.uniqueIdstring. The handle of the commenter, without @.
author.nicknamestring. The display name of the commenter.
author.verifiedboolean or null. Whether the commenter is verified.
author.avatarstring or null. A link to the avatar image. The link expires.
videoIdstring. The ID of the video.
videoUrlstring. The link to the video.
inputUrlstring. The URL from your input that led to the comment: the video URL, or the profile URL.

Videos dataset fields

The Videos dataset holds one item for each video that the Actor read. The item holds the IDs, the counts, and video. The object video holds the details, and video.video holds the file details of the video.

FieldType and contents
videoIdstring. The ID of the video.
videoUrlstring. The link to the video.
inputUrlstring. The URL from your input that led to the video: the video URL, or the profile URL.
videoobject or null. null when includeVideoInfo is false, or when the details could not be read.
serverTotalnumber. The comment count that TikTok shows for the video. See the limits.
commentCountnumber. The number of comments saved for the video. Replies are not in this number.
video.descstring. The description. It is empty when the video has none.
video.descLanguagestring or null. The language code of the description, such as en.
video.createTimestring or null. The creation time in Unix seconds, such as "1793436711".
video.locationCreatedstring or null. The country code where the video was made. Filled only for a video URL.
video.categoriesstring[]. The topic labels of the video. Filled only for a video URL.
video.hashtagsstring[]. The hashtags of the description, without #.
video.mentionsstring[]. The accounts that the description mentions, without @.
video.effectsstring[]. The names of the effects that the video uses.
video.isAdboolean or null. true for a paid ad.
video.isAiGeneratedboolean or null. true when the video is marked as AI generated. Filled only for a video URL.
video.isPinnedboolean or null. true for a video that the creator pinned. Filled only for the videos of a profile.
video.duetEnabledboolean or null. Whether other users can make a duet with the video.
video.stitchEnabledboolean or null. Whether other users can stitch the video.
video.shareEnabledboolean or null. Whether the video can be shared.
video.captionLanguagesstring[]. The caption languages that the video offers, such as eng-US.
video.imagesstring[]. The image links of a photo post. Empty for a video.

video.video

FieldType and contents
video.video.durationnumber. The duration in seconds.
video.video.widthnumber or null. The width in pixels.
video.video.heightnumber or null. The height in pixels.
video.video.ratiostring or null. The resolution label, such as 540p.
video.video.definitionstring or null. The quality label, such as 540p.
video.video.formatstring or null. The file format, such as mp4.
video.video.codecstring or null. The video codec, such as h264.
video.video.bitratenumber or null. The bitrate in bits per second.
video.video.sizenumber or null. The file size in bytes. It is null for a video URL.
video.video.coverstring or null. A link to the cover image. The link expires.
video.video.originCoverstring or null. A link to the original cover image. The link expires.
video.video.dynamicCoverstring or null. A link to the animated cover. The link expires.

video.author

FieldType and contents
video.author.idstring. The account ID.
video.author.uniqueIdstring. The handle, without @.
video.author.nicknamestring. The display name.
video.author.verifiedboolean or null. Whether the account is verified.
video.author.signaturestring or null. The bio.
video.author.createTimestring or null. The account creation time in Unix seconds. Filled only for a video URL.
video.author.privateboolean or null. Whether the account is private.
video.author.sellerboolean or null. Whether the account sells in TikTok Shop. Filled only for a video URL.
video.author.avatarstring or null. A link to the avatar image. The link expires.
video.author.followersnumber or null. The follower count.
video.author.followingnumber or null. The count of accounts that the author follows.
video.author.likesnumber or null. The total likes that the account received.
video.author.videosnumber or null. The video count of the account.
video.author.likesGivennumber or null. The count of videos that the account liked.

video.stats

FieldType and contents
video.stats.viewsnumber. The play count.
video.stats.likesnumber. The like count.
video.stats.commentsnumber. The comment count.
video.stats.sharesnumber. The share count.
video.stats.savesnumber. The count of users who saved the video.
video.stats.repostsnumber. The repost count.

video.music

FieldType and contents
video.music.idstring or null. The sound ID.
video.music.titlestring or null. The sound title.
video.music.authorstring or null. The name of the sound author.
video.music.albumstring or null. The album, when the sound has one.
video.music.durationnumber or null. The duration in seconds.
video.music.playUrlstring or null. A link to the audio file.
video.music.coverstring or null. A link to the sound cover image.
  • The values in video.stats are the values at the time of the run. They change over time.
  • TikTok rounds large counts, such as video.author.followers of 202100.
  • Links to avatars, covers, images, and stickers expire. A comment avatar link lasts about one day. A cover link or the avatar link of a video author lasts about two days. An image or sticker link of a comment lasts about 30 days. Download what you need soon after the run.

Which fields are empty for which input

Some fields of the Videos dataset are empty for the videos of a profile. The Actor still saves the video and sets the field to null or an empty list. A filled field can still be empty for one video, for example when the video has no captions. The comment fields do not depend on the input.

FieldprofileUrlsvideoUrls
video.locationCreated, video.categories, video.isAiGenerated, video.author.createTime, video.author.sellerEmptyFilled
video.isPinnedtrue or falsenull
video.video.sizeFillednull

video.hashtags and video.mentions are filled for both inputs.

Error items

An input URL that the Actor cannot read gives one error item in the Errors dataset. The run goes on with the next URL.

{
"inputUrl": "https://www.tiktok.com/@nasa/video/7000000000000000001",
"error": "The video is removed or private.",
"errorCode": "VIDEO_UNAVAILABLE"
}

An error item has three fields:

FieldType and contents
inputUrlstring. The entry from your input.
errorstring. A short sentence that says what went wrong.
errorCodestring. One of the codes below.
errorCodeMeaning
NOT_A_VIDEO_URLThe entry of videoUrls has no /video/ and video ID, or it is not a TikTok URL.
NOT_A_PROFILE_URLThe entry of profileUrls is not a profile URL such as https://www.tiktok.com/@handle.
VIDEO_UNAVAILABLEThe video is removed or private.
PROFILE_UNAVAILABLEThe profile does not exist or is not available.
COMMENTS_OFFThe creator switched the comments off for this video. This is a result, not a failure. The Videos dataset still has the item of the video.
READ_FAILEDThe video or profile could not be read. Try again later.

COMMENTS_OFF appears for a video in videoUrls. A video of a profile with the comments off gives its Videos dataset item with commentCount set to 0, and no error item.

Limits and field notes

How many comments can I collect?

maxCommentsPerVideo is an upper limit, not a required count. With 0, the Actor saves every available comment. Each comment and each reply is its own item. A video with thousands of comments takes minutes, so set a limit when you need only a sample. See How fast is a run?.

A video with no comments is a result, not a failure. It gives a Videos dataset item with commentCount set to 0, and no error item.

Are replies included?

Yes, by default. Each reply is an item in the Dataset, right after its comment. Its type is reply, and repliesToId holds the cid of the comment. replies in the comment item is the reply count that TikTok shows. It can differ from the number of reply items, because the count can include replies that are not available. Replies come in TikTok's own order, which is not strictly by date.

Set includeReplies to false to save only the comments. A run without replies is faster.

How do I tell comments from replies?

Use type. A comment has type set to comment and repliesToId set to null. A reply has type set to reply, and repliesToId holds the cid of its comment. A reply to another reply also has repliesToReplyId. In a spreadsheet, filter on type. To build a thread, group the reply items on repliesToId. Each reply follows its comment in the Dataset.

Does each comment appear once?

Yes. The Actor keeps each cid once in the whole Dataset.

Why is commentCount lower than serverTotal?

Both fields are in the Videos dataset. serverTotal is the comment count that TikTok shows for the video. commentCount is the number of comments that the Actor saved. TikTok can show a higher count than the number of comments and replies that are available. So commentCount can be lower, even when you set no limit.

In two test runs without a limit and with replies:

VideoserverTotalComments savedReplies saved
A small video1391129
A video with a long thread2,9921,1571,354

How fast is a run?

A run with replies is slower than a run without them. The time can change from run to run. In test runs, the small video took 8 to 14 seconds with replies. The video with a long thread took 52 to 82 seconds with replies. A video with 10,744 reported comments gave 1,500 comments in 27 to 36 seconds without replies. Set maxCommentsPerVideo for a faster run.

A video or a profile that does not exist gives its error item within seconds.

Why are some fields empty?

TikTok does not give every detail for every video or comment. Then the field is null or an empty list. See Which fields are empty for which input. A comment without text has an empty text, and its images or sticker hold the content. The name in mentions is the name as the commenter typed it.

What happens when a video fails?

The Actor retries before it gives up. When a video cannot be read in full, the Actor saves the comments that it has for that video. It writes a warning in the run log and goes on with the next video. When the replies of a comment cannot be read, it saves the replies that it has and writes a warning. commentCount shows how many comments it saved. When the video details fail, video is null and the comments still follow. A video that cannot be read at all gives an error item.

If no video and no profile can be read, the run fails with the message "No video or profile could be read. Check the URLs and try again." The error items stay in the Errors dataset. A profile with no public videos is not a failure. Invalid input also fails the run with a message that names the problem.

Can a comment disappear after I collect it?

Yes. Viewers and creators can delete comments at any time. Run the Actor again to get the current comments, and compare the cid values.

Similar Actors