# TikTok Comment Scraper (`datascrapers/tiktok-comment-scraper`) Actor

Extracts TikTok video comments — author profile, comment text, likes, reply count, and comment date — from one or more video URLs. Delivers structured comment records to the Apify dataset.

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

## Pricing

from $1.00 / 1,000 comments

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Comment Scraper** creates a structured dataset of comment records collected from TikTok videos. Each dataset item describes one comment and can include the author's profile image, username, and display name, the comment text, the number of likes and replies, the comment date, and the source video URL. Query the source by supplying one or more TikTok video URLs, control the result limit with `max_comments`, and retrieve records through the Apify Dataset API or export them as JSON, CSV, Excel, XML, or another supported format.

### Dataset at a glance

| Property | Value |
|---|---|
| Source | tiktok.com |
| Record unit | One comment |
| Input methods | `video_urls` (one or more video URLs) |
| Main identifiers | `username` + `date_of_comment` + `text` (per-video `video_url`) |
| Delivery | Apify Dataset and API |
| Export formats | JSON, CSV, Excel, XML |
| Update model | Fresh records per Actor run |
| Pricing | $1 per 1,000 comments |

### Coverage and available records

The Actor collects comments from each supplied TikTok video URL. Supported coverage includes:

- All paginated comments for each video (until `max_comments` is reached).
- Author profile image, username, and display name.
- Comment text, like count, and reply count.
- Comment date (`YYYY-MM-DD`).

Reply threads are not expanded into nested records; the reply count is captured as a number. A residential proxy is required because TikTok blocks datacenter IP addresses.

### Data dictionary

| Field | Type | Nullable | Description | Example |
|---|---:|---|---|---|
| `image` | string | Yes | Author profile image URL | `"https://p16-sign-va.tiktokcdn.com/..."` |
| `username` | string | No | Author TikTok username | `"freizeit_freaks"` |
| `name` | string | Yes | Author display name | `"Freizeit Freaks"` |
| `video_url` | string | No | Source video URL | `"https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102"` |
| `text` | string | No | Comment text | `"Amazing video!"` |
| `likes` | integer | Yes | Number of likes | `152` |
| `reply_count` | integer | Yes | Number of replies | `3` |
| `date_of_comment` | string | Yes | Comment date (`YYYY-MM-DD`) | `"2025-07-10"` |

For deduplication, combine `video_url` with `username`, `date_of_comment`, and `text`, since TikTok does not expose a stable per-comment ID in this dataset.

### Example dataset record

```json
{
  "image": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/avatar.jpeg",
  "username": "freizeit_freaks",
  "name": "Freizeit Freaks",
  "video_url": "https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102",
  "text": "Amazing video!",
  "likes": 152,
  "reply_count": 3,
  "date_of_comment": "2025-07-10"
}
```

This record was produced from the video URL `https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102`.

### Query and input reference

| Input | Type | Required | Default | Accepted values | Description |
|---|---:|---|---|---|---|
| `video_urls` | array of strings | Yes | — | TikTok video URLs | List of video URLs to scrape comments from. |
| `max_comments` | integer | No | `0` | `0` (unlimited) or any positive integer | Stop after this many comments across all videos. |
| `proxyConfiguration` | object | No | Apify Residential (DE) | Apify proxy settings | Residential proxy required; datacenter IPs are blocked. |

Minimal request:

```json
{
  "video_urls": [
    "https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102"
  ]
}
```

Request with a comment limit:

```json
{
  "video_urls": [
    "https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102"
  ],
  "max_comments": 500
}
```

### Retrieve the data through the API

1. Start the Actor with a JSON input containing `video_urls`.
2. Wait for the run to finish, or use the synchronous run endpoint.
3. Retrieve items from the run's default dataset.
4. Paginate or export the dataset.

Example in Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("datascrapers/tiktok-comment-scraper").call(run_input={
    "video_urls": ["https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102"],
    "max_comments": 500,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["username"], item["text"])
```

For other languages, use the generated API tab in the Apify Console. Never place a real token in a URL or example.

### Data quality and record handling

- Comment fields are returned as collected; missing values are null or empty.
- TikTok's rate limiting can affect long runs; a residential proxy is required.
- Source-side changes to TikTok's comment response can change availability.
- The Actor does not perform internal cross-run deduplication; each run is a fresh dataset.
- Recommended external deduplication: `video_url` + `username` + `date_of_comment` + `text`.
- Failed requests are retried and logged; they do not abort the whole run.

### Export and pipeline examples

| Destination | Recommended method | Typical use |
|---|---|---|
| PostgreSQL/Supabase | Dataset API or webhook consumer | Comment sentiment archive |
| Google Sheets | Apify integration | Manual comment review |
| S3/cloud storage | Scheduled export or integration | Periodic comment snapshot |

### Pricing and cost examples

The Actor charges per comment record written to the dataset, plus a one-time Actor start event. The per-result rate is $0.001.

| Comments | Estimated base cost |
|---:|---:|
| 1,000 | $1.00 |
| 10,000 | $10.00 |

Estimates depend on the verified pricing model and any selected proxy options. Standard Apify plan discounts may apply.

### Limitations and responsible data use

- Collects publicly visible TikTok comments only.
- Availability depends on source-site uptime and rate limiting.
- Comment likes and reply counts reflect the value at collection time.
- No historical snapshots are stored unless you keep the datasets yourself.
- You are responsible for complying with TikTok's terms and applicable law when using the data.

### Dataset questions

#### What does one dataset item represent?

One comment on a supplied TikTok video, including author identity, comment text, engagement counts, and date.

#### Which field should I use as a unique identifier?

TikTok does not expose a stable comment ID here; combine `video_url` + `username` + `date_of_comment` + `text` for deduplication.

#### Are fields nullable or conditional?

Yes. `image`, `name`, `likes`, `reply_count`, and `date_of_comment` can be empty for some comments.

#### Can I retrieve the records as CSV or JSON?

Yes. The dataset can be exported as JSON, CSV, Excel, or XML from the Apify Console or Dataset API.

#### How do I paginate large datasets?

Use the Dataset API pagination, or set `max_comments` to `0` to collect all comments in a single run.

#### Does the Actor return historical data?

No. Each run returns comments visible at run time.

#### What counts as a billable result?

Each comment record written to the dataset is one billable result, at $0.001 per comment.

### Related datasets from Data Scrapers

- [TikTok Creator Stats](https://apify.com/datascrapers/tiktok-creator-stats) — profile-level metrics and engagement that complement comment-level data.
- [TikTok Profile Scraper](https://apify.com/datascrapers/tiktok-profile-scraper) — post and profile records for the same creators.
- [YouTube Comment Scraper](https://apify.com/datascrapers/youtube-comment-scraper) — cross-platform comment datasets for sentiment analysis.
- [Instagram Post Scraper](https://apify.com/datascrapers/instagram-post-scraper) — Instagram post and engagement records for social research.

### Data Scrapers support

Need an additional field, record type, or export workflow? Contact Data Scrapers at stardustspotlight@gmail.com. Include a sample source URL, required fields, expected record volume, and preferred delivery format.

# Actor input Schema

## `video_urls` (type: `array`):

List of TikTok Video URLs to scrape comments from

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

Residential proxy required. Datacenter IPs are blocked by TikTok.

## `max_comments` (type: `integer`):

Stop after this many comments across all videos. 0 = unlimited.

## Actor input object example

```json
{
  "video_urls": [
    "https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "DE"
  },
  "max_comments": 0
}
```

# Actor output Schema

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

JSON array of scraped comments at {{links.apiDefaultDatasetUrl}}/items

## `runStats` (type: `string`):

Aggregate run statistics including total comments scraped

## `run` (type: `string`):

Apify Console link to inspect this run

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

// Run the Actor and wait for it to finish
const run = await client.actor("datascrapers/tiktok-comment-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 = { "video_urls": ["https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102"] }

# Run the Actor and wait for it to finish
run = client.actor("datascrapers/tiktok-comment-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 '{
  "video_urls": [
    "https://www.tiktok.com/@freizeit_freaks/video/7537396732502478102"
  ]
}' |
apify call datascrapers/tiktok-comment-scraper --silent --output-dataset

```

## MCP server setup

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