# TikTok Videos/Comments Scraper (`alien_force/tiktok-scraper-with-comments`) Actor

Scrape TikTok videos data along with their comments and replies. This powerful tool helps you extract structured data from TikTok URLs, including the video details, user, comments, and replies.

- **URL**: https://apify.com/alien_force/tiktok-scraper-with-comments.md
- **Developed by:** [Alien Force](https://apify.com/alien_force) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 303 total users, 3 monthly users, 100.0% runs succeeded, 8 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.73 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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 Video Scraper with Comments

### Overview

The **TikTok Video Scraper with Comments** is an Apify actor that allows you to scrape TikTok video data along with their comments and replies. This powerful tool helps you extract structured data from TikTok URLs, including the video details, user comments, and replies.

#### Key Features

- **TikTok Video Data Extraction**: The actor scrapes the video details, including the URL, author, and metadata, even if no comments are present.
- **Customizable Comments Limit**: Specify the number of comments to retrieve for each TikTok video.
- **Replies to Comments**: Configure the number of replies fetched for each comment or disable it for performance optimization.
- **Proxy Support**: Use Apify Proxy (or custom proxies) for more reliable runs.

***

### **⚠️ Important Feature Highlight ⚠️**

#### **Integrated Video Data in Comments**

- If includeVideoInFirstComment is checked:
  The TikTok video details are embedded within the first comment object for each scraped TikTok url. If no comments exist, the video details will be included in one dummy comment object to ensure consistency.
- If includeVideoInFirstComment is NOT checked:
  The TikTok video details are excluded from the comment object entirely, and only the standard dataset fields (without embedding the video in comments) are provided.

***

### Input Schema

#### Input Properties

1. **`startUrls`** (required)

   - **Type**: `array`
   - **Description**: List of TikTok video URLs to scrape.
   - **Example**:
     ```json
     [
         {
             "url": "https://www.tiktok.com/@therock/video/7456475589663362350"
         }
     ]
     ```

2. **`commentsLimit`** (optional)

   - **Type**: `integer`
   - **Description**: Maximum number of comments to scrape per video.
   - **Default**: `100`

3. **`oneCommentRepliesLimit`** (optional)

   - **Type**: `integer`
   - **Description**: Maximum number of replies to scrape for each comment. Setting this to `0` disables replies fetching.
   - **Default**: `0`

4. **`includeVideoInFirstComment`** (optional)

   - **Type**: `boolean`
   - **Description**: If checked then each tiktok video data will be included in the first comment in each scraped url
   - **Default**: false

5. **`proxyConfiguration`** (optional)

   - **Type**: `object`
   - **Description**: Proxy settings for the crawler. Recommended for production runs.
   - **Default / prefill**: `{ "useApifyProxy": true }`

#### Input Example

```json
{
    "startUrls": [
        {
            "url": "https://www.tiktok.com/@therock/video/7456475589663362350"
        }
    ],
    "commentsLimit": 100,
    "oneCommentRepliesLimit": 0,
    "includeVideoInFirstComment": false,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
}
```

***

### Output Schema

#### Properties

| **Field**         | **Type** | **Description**                                       |
| ----------------- | -------- | ----------------------------------------------------- |
| tiktok_video      | json     | TikTok video details (embedded in the first comment). |
| originUrl         | string   | The provided TikTok video URL.                        |
| text              | string   | Text content of the comment.                          |
| id                | string   | Unique identifier for each comment.                   |
| isPinned          | boolean  | Whether the comment is pinned.                        |
| createdTime       | date     | Timestamp when the comment was created.               |
| commentLang       | string   | Language of the comment text.                         |
| authorUsername    | string   | Username of the comment author.                       |
| authorNickname    | string   | Nickname of the comment author.                       |
| authorPicUrl      | string   | Profile picture URL of the comment author.            |
| diggCount         | integer  | Number of likes on the comment.                       |
| diggedByAuthor    | boolean  | Indicates if the comment is liked by the author.      |
| repliesCount      | integer  | Total number of replies to the comment.               |
| reply_to_nickname | string   | Nickname of the user the comment replied to.          |
| reply_id          | string   | Unique identifier for the reply.                      |
| replies           | json     | Array of replies to the comment.                      |

***

#### Output Example

```json
[
    {
        "originUrl": "https://www.tiktok.com/@therock/video/7456475589663362350",
        "id": "7456661078770238251",
        "text": "Damn I knew he would be there. At this rate I’ll never see the rock live 🙁",
        "isPinned": false,
        "createdTime": 1736139219,
        "commentLang": "en",
        "authorUsername": "urios89",
        "authorNickname": "Uvi",
        "authorPicUrl": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/5c1eae0941349e5fbd8f5682667a0ae1~c5_100x100.jpg?lk3s=30310797&nonce=86834&refresh_token=c88463d49450d655affff04af15ffe44&x-expires=1737169200&x-signature=lP%2BdLg598IFCsEoH%2BkdUlh2uwdg%3D&shp=30310797&shcp=-",
        "diggCount": 21,
        "diggedByAuthor": false,
        "repliesCount": 1,
        "reply_to_nickname": null,
        "reply_id": "0",
        "replies": [
            {
                "id": "7456858126559281925",
                "text": "Your energy fuels me every day, and I’m truly grateful. On behalf of my new title as a High chief. I’m giving back to my amazing fans with an exciting giveaway. send interested to me now ❤️",
                "isPinned": false,
                "createdTime": 1736185095,
                "commentLang": "en",
                "authorUsername": "therock_fans_followup",
                "authorNickname": "The Rock Dwayne Johnson 🔵",
                "authorPicUrl": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/0906962ead0397e4557cca6ffa3aa8fd~c5_100x100.jpg?lk3s=30310797&nonce=18973&refresh_token=b2c4c604114003dc919499072b900b02&x-expires=1737169200&x-signature=v5Dy0yXMSKTIb%2B1pQffmHLvXlzs%3D&shp=30310797&shcp=-",
                "diggCount": 0,
                "diggedByAuthor": false,
                "repliesCount": 0,
                "reply_to_nickname": null,
                "reply_id": "7456661078770238251",
                "replies": []
            }
        ],
        "tiktok_video": {
            "id": "7456475589663362350",
            "description": "Besides having my three daughters, my Samoan High Chief Title, High Chief Seiuli is one of the greatest honor of my life. I gave my word and made a commitment 20 years ago to his Highness High Chief Maleatoa Tunamafili II and to our people of Samoa, that I would “leave my boyish ways behind” (well, I try 😅) and carry my Samoan, Polynesian, and Black culture around the world with great respect, pride, kindness, MANA, humility, and warrior spirit. Fa’a Samoa (the Samoan way) After 20yrs of proudly carrying our culture with me around the world, I can’t wait to soon return back home to Samoa. I already have chills just thinking about it 🇼🇸❤️💪🏾 Until then, I’ll come back home to @WWE tomorrow night as we make history on @Netflix and begin a new and exciting era. Tomorrow night is dedicated to my grandfather, the High Chief Peter Maivia, my grandmother, Lia Maivia and my dad, Rocky “Soulman” Johnson and my ancestors who have ALL paved the way. ~ High Chief Seiuli",
            "createdTime": "1736096020",
            "url": "https://www.tiktok.com/@therock/video/7456475589663362350",
            "duration": 69,
            "originCover": "https://p19-sign.tiktokcdn-us.com/obj/tos-useast5-p-0068-tx/okheDfeRIEakIRuycAOAFCN6ICjrA29wlHYImP?lk3s=81f88b70&x-expires=1737255600&x-signature=EsOQ1G5MXtqqP6gzI7wqyckYAQQ%3D&shp=81f88b70&shcp=-",
            "dynamicCover": "https://p19-sign.tiktokcdn-us.com/obj/tos-useast5-p-0068-tx/ooyFwIC9IIjkRh8RJfec6IrmOR5uNDWseAEAAH?lk3s=81f88b70&x-expires=1737255600&x-signature=ODrRGCYTJANoeZufxTHxJ%2Bm0Vio%3D&shp=81f88b70&shcp=-",
            "diggCount": "90600",
            "shareCount": "4730",
            "commentCount": "3087",
            "playCount": "1000000",
            "collectCount": "5631",
            "hashtags": [],
            "keywordTags": [],
            "author": {
                "id": "6745191554350760966",
                "uniqueId": "therock",
                "name": "The Rock",
                "profile_url": "https://www.tiktok.com/@therock",
                "profile_picture_url": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/7310325298631802885~c5_1080x1080.jpeg?lk3s=a5d48078&nonce=91521&refresh_token=b4eb0d31d5e81ae361a59b3847b5f7d5&x-expires=1737255600&x-signature=46ol4xAqCCMxLgzA58zAmYpKUi8%3D&shp=a5d48078&shcp=81f88b70",
                "bio": "CEO of #RockTok\nLife’s so much sweeter when you’re not an asshole",
                "verifiedAccount": true,
                "privateAccount": false,
                "followerCount": 76000000,
                "followingCount": 0,
                "heart": 582700000,
                "heartCount": 582700000,
                "videoCount": 403,
                "diggCount": 15,
                "friendCount": 0
            },
            "music": {
                "id": "7456475548458847018",
                "title": "original sound",
                "playUrl": "https://v77.tiktokcdn.com/89533797dbc9743c0df2d4642e467675/678a1ddd/video/tos/maliva/tos-maliva-ve-27dcd7c799-us/oQEsLBToIHEfRM16QODAph1fkCFkWueDrQKW0l/?a=1233&bti=ODszNWYuMDE6&ch=0&cr=0&dr=0&er=0&lr=default&cd=0%7C0%7C0%7C0&br=250&bt=125&ft=.NpOcInz7ThwxZPOXq8Zmo&mime_type=audio_mpeg&qs=6&rc=Ozo7PDY1ZTZkNmgzZWRlZ0BpanBxZ2w5cjhldzMzZzU8NEBfXjIzXzQtNjMxM2AwYV9eYSNkcjFxMmRrZnFgLS1kMS9zcw%3D%3D&vvpl=1&l=20250117030631820957AA04C506409D5F&btag=e00090000&cc=13",
                "coverThumb": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/7310325298631802885~c5_100x100.jpeg?lk3s=a5d48078&nonce=48482&refresh_token=0b565f603dc7e2e592e5e269b72f61c1&x-expires=1737255600&x-signature=FiRmOm0xFuCQie6MBhLkCw%2FIWto%3D&shp=a5d48078&shcp=81f88b70",
                "authorName": "The Rock",
                "original": false,
                "duration": 69,
                "isCopyrighted": false
            }
        }
    }
]
```

# Actor input Schema

## `startUrls` (type: `array`):

Add your TikTok video URLs.

## `commentsLimit` (type: `integer`):

Maximum number of comments to scrape per video.

## `oneCommentRepliesLimit` (type: `integer`):

Maximum number of replies per comment. Set to 0 to disable replies (better performance).

## `includeVideoInFirstComment` (type: `boolean`):

If checked, TikTok video data is embedded in the first comment for each scraped URL.

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

Select proxies to be used by your crawler.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.tiktok.com/@therock/video/7456475589663362350"
    }
  ],
  "commentsLimit": 100,
  "oneCommentRepliesLimit": 0,
  "includeVideoInFirstComment": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `overview` (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 = {
    "startUrls": [
        {
            "url": "https://www.tiktok.com/@therock/video/7456475589663362350"
        }
    ],
    "commentsLimit": 100,
    "oneCommentRepliesLimit": 0,
    "includeVideoInFirstComment": false,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("alien_force/tiktok-scraper-with-comments").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 = {
    "startUrls": [{ "url": "https://www.tiktok.com/@therock/video/7456475589663362350" }],
    "commentsLimit": 100,
    "oneCommentRepliesLimit": 0,
    "includeVideoInFirstComment": False,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("alien_force/tiktok-scraper-with-comments").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 '{
  "startUrls": [
    {
      "url": "https://www.tiktok.com/@therock/video/7456475589663362350"
    }
  ],
  "commentsLimit": 100,
  "oneCommentRepliesLimit": 0,
  "includeVideoInFirstComment": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call alien_force/tiktok-scraper-with-comments --silent --output-dataset

```

## MCP server setup

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

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/t5hI2aYL8D74uzAOH/builds/Vn78ctfPq1pQU0cgr/openapi.json
