# TikTok Comments Scraper — Full Threads & Replies (`axery/tiktok-comments-scraper`) Actor

Scrape comments from any public TikTok video - text, author, like count, reply count, timestamp - with full pagination and optional nested reply threads. No login, no API key.

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

## Pricing

from $1.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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## TikTok Comments Scraper (with Replies)

Scrapes comments from any public TikTok video — text, author, like count, reply count, timestamp — with full pagination and optional nested reply threads. No login, no API key, no browser.

Useful for sentiment analysis, brand monitoring, audience research, and creator engagement studies.

### What makes this different

**Full reply threads, reassembled in order.** Most comment scrapers return top-level comments only, or return replies as a flat list you have to stitch back together yourself. Here each reply is emitted directly after its parent and carries `parent_comment_id`, so a conversation reads top-to-bottom in dataset order with no client-side re-sorting.

**`is_author_liked` — the signal creators actually care about.** Every row records whether the video's own creator liked that comment. That's the difference between a comment that got traction and one the creator personally endorsed, and it isn't something a plain comment dump surfaces.

**`reply_count` is null on replies, not zero.** TikTok doesn't report a reply count for reply rows themselves. Writing `0` there would look like "this reply has no responses," which isn't a claim the data supports — so it's null, and only top-level rows carry a real number.

**Deduplicated across pages.** Comment IDs are tracked within a run, so a paginated walk returns distinct comments rather than repeats padding out your requested count.

**Per-comment hashtags and TikTok's own language guess** travel with every row, so filtering a multilingual comment section doesn't need a second pass.

### Input

| Field | Type | Notes |
|---|---|---|
| `videos` | array | Full TikTok video URLs or bare numeric video IDs. |
| `maxItems` | integer | Rows per video, counting replies. `0` walks every page. |
| `includeReplies` | boolean | Fetch nested reply threads. |
| `maxRepliesPerComment` | integer | Cap on replies per parent comment. |
| `proxyConfiguration` | object | Defaults to Residential. |

### Output

```json
{
  "comment_id": "tiktok.com:6718335906996502533",
  "video_id": "tiktok.com:6718335390845095173",
  "rank": 1,
  "is_reply": false,
  "text": "ok ;) have fun~",
  "like_count": 166,
  "reply_count": 20,
  "created_at": "2019-07-27T14:54:35Z",
  "is_author_liked": false,
  "author_username": "flamigo_kisses",
  "author_nickname": "flamigoo"
}
```

A removed video and a video with comments switched off look identical from the outside — TikTok answers both with an empty list rather than an error — so a video returning nothing is reported explicitly in `RUN_COVERAGE` instead of passing as a clean empty run. Each run writes that record to the key-value store with what was requested, what came back, and any per-video failures.

### Local development

```bash
pip install -r requirements.txt
python test_local.py 6718335390845095173 --max 45
python test_local.py 6718335390845095173 --max 40 --replies --out sample_output.json
```

`sample_output.json` is real output from a live run with reply threads enabled.

# Actor input Schema

## `videos` (type: `array`):

Full TikTok video URLs or bare numeric video IDs. Each is fetched independently into the same dataset.

## `maxItems` (type: `integer`):

Total rows per video, counting replies when they are enabled. `0` walks every page TikTok serves for that video.

## `includeReplies` (type: `boolean`):

Fetch each comment's nested replies too. Replies are emitted directly after their parent comment and carry `parent_comment_id`, so a thread reads in order without re-sorting. Costs one extra request per comment that has replies.

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

Cap on replies fetched for each parent comment. Only applies when reply threads are enabled.

## `proxyConfiguration` (type: `object`):

Apify Proxy settings. Defaults to Residential - TikTok throttles this endpoint per-IP and answers an over-eager client with an empty body rather than an error status, so a clean IP matters more here than a clever request shape.

## Actor input object example

```json
{
  "videos": [
    "https://www.tiktok.com/@scout2015/video/6718335390845095173"
  ],
  "maxItems": 100,
  "includeReplies": false,
  "maxRepliesPerComment": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `comments` (type: `string`):

One row per comment: text, author, like count, reply count, timestamp, thread position.

# 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 = {
    "videos": [
        "https://www.tiktok.com/@scout2015/video/6718335390845095173"
    ],
    "maxItems": 100,
    "maxRepliesPerComment": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("axery/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 = {
    "videos": ["https://www.tiktok.com/@scout2015/video/6718335390845095173"],
    "maxItems": 100,
    "maxRepliesPerComment": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("axery/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 '{
  "videos": [
    "https://www.tiktok.com/@scout2015/video/6718335390845095173"
  ],
  "maxItems": 100,
  "maxRepliesPerComment": 10
}' |
apify call axery/tiktok-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,axery/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/vlaoZe3xssZW01SO3/builds/Oa1LpATcHTKOjFlMz/openapi.json
