# TikTok Comments Scraper (`tokfluence/tiktok-comments-scraper`) Actor

Scrape comments from TikTok videos by URL, one row per comment with text, likes, reply count and author, in Clockworks TikTok Comments Scraper field names. Includes TikTok's purchase-intent flags where Tokfluence captured them.

- **URL**: https://apify.com/tokfluence/tiktok-comments-scraper.md
- **Developed by:** [Tokfluence Tiktok API](https://apify.com/tokfluence) (community)
- **Categories:** Social media, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## TikTok Comments Scraper

Give it TikTok video URLs and it returns the comments on those videos, one row per comment. Rows use the same field names as Clockworks' TikTok Comments Scraper (`cid`, `text`, `diggCount`, `uniqueId`, `repliesToId`, ...). Full reply threads, profile inputs and error rows are not supported, so read the sections below before you point an existing pipeline at it.

### What it returns

One comment row per comment, in the Clockworks comment row shape. Filled when we have the comment:

- `cid`, `text`, `createTime`, `createTimeISO`
- `diggCount` (likes) and `replyCommentTotal` (replies TikTok reports for the comment)
- `uid`, `uniqueId` and `avatarThumbnail` for the comment's author
- `likedByAuthor` and `pinnedByAuthor`
- `mentions` (as `@handle`) and `detailedMentions`
- `videoWebUrl`, plus `submittedVideoUrl` and `input`, which echo the URL you entered
- `repliesToId` on a reply: the id of the comment it sits under

#### TikTok's purchase-intent flags

TikTok tags some comments with purchase-intent signals. Tokfluence captures them when it scrapes a comment; Clockworks' rows do not include them. They sit under `tokfluence`:

- `tokfluence.is_high_purchase_intent`: TikTok's own high-purchase-intent flag on the comment
- `tokfluence.ecom_intent`: TikTok marked a search keyword in the comment as e-commerce intent

These are TikTok's labels, passed through as they were when we scraped the comment. We do not add our own classification. Treat them as a signal to filter on, not a verdict. They are `null` for comments stored before we captured them.

The other `tokfluence` fields:

- `tokfluence.is_author_reply`: the video's creator wrote this comment
- `tokfluence.text_language`: the comment's language as TikTok reports it
- `tokfluence.scraped_at`: when Tokfluence scraped this comment, so you can judge how fresh it is

### Inputs

- **TikTok video URLs** (`postURLs`): up to 20 per run, in the full `https://www.tiktok.com/@user/video/<id>` form. Short links (`vm.tiktok.com/...`) are not supported yet; the run names any it could not use.
- **Maximum comments per post** (`commentsPerPost`, default 100, up to 1000): replies count toward it, as on Clockworks. See "Which comments you get" below.
- **Maximum replies per comment** (`maxRepliesPerComment`, default 0): see Replies below.
- **Max results** (`maxResults`): a cap on the whole run, across all videos.

Clockworks' `topLevelCommentsPerPost` and its profile inputs (scraping comments from a creator's latest videos) are not supported.

### Which comments you get

For each post you get the comments we hold, oldest first, up to **Maximum comments per post**. Replies are in that count even when **Maximum replies per comment** is 0: they take their place in the per-post limit first and are dropped afterwards, so a post can return fewer top-level comments than the limit you set.

### Replies

Not fully supported yet. When TikTok loads a video's comments it includes the first few replies under each one, and those are what we return. We do not open each comment's full reply thread. So `maxRepliesPerComment` caps what we have, but a comment with 40 replies can come back with far fewer. When you ask for replies and the run comes back short, its status message says this is why. `replyCommentTotal` still shows TikTok's full reply count.

### Fresh or fast: the Mode setting

Under **Advanced**, `mode` trades freshness for speed:

- `auto` (default): serves comments Tokfluence already stores when they were scraped in the last 7 days, and scrapes TikTok live for the rest. Most runs want this.
- `database`: fastest. Never scrapes. It only covers videos whose comments Tokfluence has already scraped; any other video is reported as not found. What you get is as old as our last scrape (check `tokfluence.scraped_at`).
- `live`: always scrapes TikTok now. Freshest, and slow.

**Live comment scraping is slow.** We load comments the way a browser does, scrolling the comment panel, for up to 12 minutes per video, and stop early when TikTok stops loading more. Videos are scraped one after another, on Tokfluence's shared scraping workers, behind other live requests, so a live run over several videos can take a long time. Raise the run's timeout for live runs over many videos. A video whose comments do not all load within the 12 minutes comes back partial.

If a live scrape outlasts the run's timeout, the run fails with the request id. The scrape keeps going and is stored when it finishes, so a `database` run shortly afterwards returns those comments without scraping again.

### Fields that can be null

This actor never fills a gap itself: when we do not have a field it is `null`, not `0`, `false` or an empty string. One exception comes from how Tokfluence stores comments: `diggCount` and `replyCommentTotal` are `0`, and `likedByAuthor` and `pinnedByAuthor` are `false`, when TikTok's comment data left them out.

Always null today:

- `detailedMentions[].nickName` and `detailedMentions[].postUrl`: not captured

Sometimes null:

- `detailedMentions[].id` and `detailedMentions[].secUid`: filled only when TikTok tagged the mention with the account
- `tokfluence.is_high_purchase_intent`, `tokfluence.ecom_intent`, `likedByAuthor`, `pinnedByAuthor`: null on comments stored before we captured them
- `uid`, `uniqueId`, `avatarThumbnail`: null if TikTok returned no author for the comment

`avatarThumbnail` is TikTok's signed image URL and stops working after a while; copy the image if you need to keep it.

### Zero or short results

When a run returns nothing, or fewer comments than `maxResults`, it still succeeds, but it logs a warning and sets the run's status message to the likely cause: videos we could not find, `database` mode (which never scrapes), a short link we could not use, a per-post limit too low to reach `maxResults`, replies, or a live scrape that stopped early. Fix the one it names and run again.

The actor uses one Tokfluence account for every run. If that account is out of API credits, or Tokfluence's scrape service is down, the run fails with a message saying so. You are charged only for rows already in the dataset.

### What Tokfluence keeps from a run

Tokfluence logs every request the actor makes: the URLs, the mode, where each row was served from, and a reference made of a one-way hash of your Apify user id plus the run id. Every TikTok handle and hashtag in your URLs and in the returned comments, commenters included, is recorded as a candidate for Tokfluence's creator discovery. Every video scraped live is stored in Tokfluence with its comments like any other scrape, and later runs, anyone's, can be served that stored copy.

### Memory

The actor defaults to 256 MB and allows up to 512 MB. It makes one API call, maps the rows and writes them to the dataset in batches of 100.

### Pricing

PLACEHOLDER (Daniel): pay per result, one `result` event per dataset row. Price to be set in Console at publish.

If your plan's remaining budget covers fewer rows than you asked for, the actor collects up to that ceiling, says so in the log, and stops cleanly rather than returning a silently short list.

### Notes

Data comes from public TikTok pages, scraped and stored by Tokfluence. You are the data controller for anything you export; follow GDPR and any local rules that apply to you. More at [Tokfluence](https://tokfluence.com).

# Actor input Schema

## `postURLs` (type: `array`):

The videos to get comments from, in the full https://www.tiktok.com/@user/video/<id> form. Short links (vm.tiktok.com) are not supported yet. At most 20 per run.

## `commentsPerPost` (type: `integer`):

The most comments to return from each video. Replies count toward it, as on Clockworks. Posts with thousands of comments may return fewer: a live scrape reads comments for up to 12 minutes per post.

## `maxRepliesPerComment` (type: `integer`):

Not fully supported yet. Tokfluence returns only the first few replies TikTok shows under each comment, not full reply threads, so you may get fewer than this. 0 returns top-level comments only.

## `maxResults` (type: `integer`):

Stops once this many comments are in the dataset, across all videos. Each comment is one result.

## `mode` (type: `string`):

Trades freshness for speed. Auto serves comments Tokfluence already stores when they are fresh enough and scrapes live for the rest. Database only is fastest and never scrapes, so any video whose comments we have not already scraped is missing from the results. Live always scrapes TikTok now: freshest, and slower, often minutes per video.

## Actor input object example

```json
{
  "postURLs": [
    "https://www.tiktok.com/@looooooooch/video/7332342275151760642"
  ],
  "commentsPerPost": 100,
  "maxRepliesPerComment": 0,
  "maxResults": 100,
  "mode": "auto"
}
```

# Actor output Schema

## `results` (type: `string`):

Comments written to the run's dataset, one item per comment, in Clockworks field names.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "postURLs": [
        "https://www.tiktok.com/@looooooooch/video/7332342275151760642"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tokfluence/tiktok-comments-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "postURLs": ["https://www.tiktok.com/@looooooooch/video/7332342275151760642"] }

# Run the Actor and wait for it to finish
run = client.actor("tokfluence/tiktok-comments-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "postURLs": [
    "https://www.tiktok.com/@looooooooch/video/7332342275151760642"
  ]
}' |
apify call tokfluence/tiktok-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tokfluence/tiktok-comments-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/e72WfZC9qbGEnaBFn/builds/1a0Wam1OeCvo8feVg/openapi.json
