# Tiktok Comments Scraper (`api-ninja/tiktok-comments-scraper`) Actor

💬 Extract comments and reply threads from TikTok videos with structured author and engagement data.

- **URL**: https://apify.com/api-ninja/tiktok-comments-scraper.md
- **Developed by:** [API ninja](https://apify.com/api-ninja) (community)
- **Categories:** Social media, Videos, Automation
- **Stats:** 53 total users, 52 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.25 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

### What does TikTok Comments Scraper do?

**TikTok Comments Scraper** extracts **public comments and reply threads** from [TikTok](https://www.tiktok.com/) videos. Give it one or more TikTok video URLs or video IDs, choose how many comments and replies you want, and it will return a structured dataset with comment text, engagement metrics, author details, and thread relationships.

This Actor is built for people who need **TikTok comment data** without building their own scraper or maintaining pagination logic. It is suitable for no-code users, analysts, agencies, researchers, and developers who want a ready-to-use **TikTok comments API-style workflow** inside Apify.

### Why use this TikTok comment scraper?

Use this Actor when you want to:

- 💬 collect **top-level TikTok comments** from one video or many videos
- 🧵 extract **comment replies** and keep parent-child thread relationships
- 📊 analyze audience sentiment, engagement, and recurring discussion themes
- 🔎 monitor reactions to creators, brands, campaigns, or viral posts
- ⚙️ run scrapes on a schedule, via API, or as part of automations and integrations

Because it runs on **Apify**, you also get platform advantages:

- run from the Apify Console or API
- schedule recurring runs
- export results as **JSON, CSV, Excel, XML, or HTML**
- connect to webhooks, Make, Zapier, n8n, Google Sheets, and more
- monitor runs, logs, and history in one place

### What can this Actor extract from TikTok comments?

The dataset includes both **comments** and **replies** in one unified output table.

| Data group           | Example fields                                                                                            |
| -------------------- | --------------------------------------------------------------------------------------------------------- |
| Comment details      | `id`, `text`, `createdAt`, `status`, `images`                                                             |
| Engagement           | `diggCount`, `replyTotal`                                                                                 |
| Thread structure     | `itemType`, `parentCommentId`                                                                             |
| Video reference      | `videoId`, `sourceUrl`, `inputUrlOrId`                                                                    |
| Author details       | `user.id`, `user.nickname`, `user.uniqueId`, `user.region`, `user.avatar`, `user.verified`, `user.secret` |
| Raw provider payload | Original nested response in `data.raw`                                                                    |

### How to scrape TikTok comments

1. Open the **Input** tab.
2. Paste one or more TikTok video URLs or raw video IDs into `searchUrls`.
3. Set `commentsPerUrl` if you want a limited number of top-level comments.
4. Turn on `scrapeAll` if you want all available top-level comments.
5. Set `repliesPerComment` if you want replies for each fetched comment.
6. Turn on `parseAllReplies` if you want all available replies for each fetched comment.
7. Run the Actor and download the dataset in your preferred format.

This Actor automatically handles:

- comment pagination
- reply pagination
- retrying failed API calls
- preserving comment-to-reply relationships

### How much does it cost to scrape TikTok comments?

This Actor uses **Apify’s usage-based pricing model**, so the total cost depends mainly on:

- how many videos you scrape
- how many top-level comments you request
- whether you also collect replies
- how deep the reply threads go

The cheapest way to start is to use a small sample:

- one or two TikTok videos
- a limited `commentsPerUrl`
- `repliesPerComment` set to `0` or a small number

If you need large-scale TikTok comment scraping, Apify makes it easier to estimate, monitor, and optimize usage over time. In general, top-level comments are cheaper to collect than full comment threads with replies, so enabling `parseAllReplies` will usually increase run cost.

### Input example

TikTok Comments Scraper has the following input options. Open the **Input** tab for field descriptions and tooltips.

```json
{
    "searchUrls": ["https://www.tiktok.com/@tiktok/video/7093219391759764782", "7093219391759764782"],
    "commentsPerUrl": 120,
    "scrapeAll": false,
    "repliesPerComment": 10,
    "parseAllReplies": false
}
````

#### Input tips

- Use full video URLs when possible for easier run tracking.
- Use raw video IDs if that is what your upstream system already stores.
- Set `repliesPerComment` to `0` if you only need top-level comments.
- Use `scrapeAll` or `parseAllReplies` only when you really need full depth.

### Output example

You can download the dataset extracted by TikTok Comments Scraper in formats such as **JSON, CSV, Excel, XML, and HTML**.

Each item contains a lightweight top-level envelope plus a nested `data` object. That keeps the dataset easier to work with while still preserving the original provider response in `data.raw`.

```json
{
    "sourceUrl": "https://www.tiktok.com/@tiktok/video/7093219391759764782",
    "inputUrlOrId": "https://www.tiktok.com/@tiktok/video/7093219391759764782",
    "videoId": "7093219391759764782",
    "itemType": "comment",
    "parentCommentId": null,
    "data": {
        "id": "7093507464444461850",
        "text": "pliss verification in my account🥺",
        "images": [],
        "createTime": 1651585926,
        "createdAt": "2022-05-03T12:32:06.000Z",
        "diggCount": 11,
        "replyTotal": 16,
        "status": 1,
        "user": {
            "id": "6941564768987071490",
            "uniqueId": "junn_kaa",
            "nickname": "j⚡",
            "region": "ID",
            "avatar": "https://p16-common-sign.tiktokcdn-us.com/...",
            "verified": false,
            "secret": true
        },
        "raw": {
            "id": "7093507464444461850",
            "video_id": "7093219391759764782",
            "text": "pliss verification in my account🥺"
        }
    }
}
```

### FAQ

#### Does this Actor scrape TikTok replies too?

Yes. Set `repliesPerComment` to a value greater than `0`, or enable `parseAllReplies` to collect full reply threads.

#### Does `commentsPerUrl` include replies?

No. `commentsPerUrl` limits **top-level comments per video**. Replies are controlled separately by `repliesPerComment` or `parseAllReplies`.

#### Can I use TikTok video IDs instead of URLs?

Yes. The Actor accepts both:

- full TikTok video URLs
- raw TikTok video IDs

#### Is this an official TikTok API?

No. This Actor is an independent scraping solution for collecting **public TikTok comment data**. It is useful when you need TikTok comment extraction without building and maintaining your own infrastructure.

#### Is it legal to scrape TikTok?

Our scrapers are designed to collect **publicly available data only**. However, your output may still contain personal data, and your use of that data may be subject to GDPR and other privacy laws. You are responsible for making sure your use case is lawful and compliant with applicable regulations. If you are unsure, consult legal counsel.

### Tips for better results

- 🚀 Start with a small run before switching on full-depth scraping.
- 🧠 If you only need sentiment or keyword analysis, top-level comments are often enough.
- 💡 Use full reply scraping only for community, moderation, or conversation analysis.
- 🔁 Schedule recurring runs if you want to monitor new comments on the same videos over time.
- 📥 Use the Apify API or integrations if you want to send results directly into your pipeline.

### Related TikTok Actors

If you need more TikTok data, you can also use:

- [TikTok Video Downloader](https://apify.com/api-ninja/tiktok-video-downloader)
- [TikTok Data Scraper](https://apify.com/api-ninja/tiktok-data-scraper)
- [TikTok Followers Scraper](https://apify.com/api-ninja/tiktok-followers-scraper)

### Support

If you run into issues or want improvements:

- check the **Input** and **Output** tabs first
- review the run **Logs** for request and pagination details
- use the **API** tab if you want to automate runs programmatically
- open an issue or reach out through the Actor page if you want to suggest a feature or a custom variant

This README is intended to be the first place to check when something is unclear, especially around limits, reply scraping, and output structure.

# Actor input Schema

## `searchUrls` (type: `array`):

Provide one or more TikTok video URLs or raw video IDs. Each entry is processed independently.

## `commentsPerUrl` (type: `integer`):

Maximum number of top-level comments to collect from each video when full crawl mode is disabled.

## `scrapeAll` (type: `boolean`):

When enabled, collects all available top-level comments for each video and ignores the comment limit above.

## `repliesPerComment` (type: `integer`):

Maximum number of replies to collect for each comment. Set to 0 to skip replies entirely unless full reply crawl mode is enabled.

## `parseAllReplies` (type: `boolean`):

When enabled, collects every available reply for each fetched comment and ignores the reply limit above.

## Actor input object example

```json
{
  "searchUrls": [
    "https://www.tiktok.com/@billieeilish/video/7050551461734042926"
  ],
  "commentsPerUrl": 100,
  "scrapeAll": false,
  "repliesPerComment": 0,
  "parseAllReplies": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `raw_dataset` (type: `string`):

No description

# 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 = {
    "searchUrls": [
        "https://www.tiktok.com/@billieeilish/video/7050551461734042926"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-ninja/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 = { "searchUrls": ["https://www.tiktok.com/@billieeilish/video/7050551461734042926"] }

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

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

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

```

## CLI example

```bash
echo '{
  "searchUrls": [
    "https://www.tiktok.com/@billieeilish/video/7050551461734042926"
  ]
}' |
apify call api-ninja/tiktok-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=api-ninja/tiktok-comments-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Tiktok Comments Scraper",
        "description": "💬 Extract comments and reply threads from TikTok videos with structured author and engagement data.",
        "version": "0.0",
        "x-build-id": "vXOaAFV3NdhUXPMzO"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/api-ninja~tiktok-comments-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-api-ninja-tiktok-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/api-ninja~tiktok-comments-scraper/runs": {
            "post": {
                "operationId": "runs-sync-api-ninja-tiktok-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/api-ninja~tiktok-comments-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-api-ninja-tiktok-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "searchUrls"
                ],
                "properties": {
                    "searchUrls": {
                        "title": "🎬 TikTok Video URLs or IDs",
                        "type": "array",
                        "description": "Provide one or more TikTok video URLs or raw video IDs. Each entry is processed independently.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "commentsPerUrl": {
                        "title": "💬 Max Comments per Video",
                        "minimum": 100,
                        "type": "integer",
                        "description": "Maximum number of top-level comments to collect from each video when full crawl mode is disabled.",
                        "default": 100
                    },
                    "scrapeAll": {
                        "title": "Scrape All Comments",
                        "type": "boolean",
                        "description": "When enabled, collects all available top-level comments for each video and ignores the comment limit above.",
                        "default": false
                    },
                    "repliesPerComment": {
                        "title": "↩️ Max Replies per Comment",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum number of replies to collect for each comment. Set to 0 to skip replies entirely unless full reply crawl mode is enabled.",
                        "default": 0
                    },
                    "parseAllReplies": {
                        "title": "Scrape All Replies",
                        "type": "boolean",
                        "description": "When enabled, collects every available reply for each fetched comment and ignores the reply limit above.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
