# 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
- **Stats:** 247 total users, 5 monthly users, 100.0% runs succeeded, 8 bookmarks
- **User rating**: No ratings yet

## Pricing

$15.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

## 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 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.

***

### **⚠️ 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

#### Input Exmaple

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

***

### 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`):

Number of comments per url

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

Number of replies per comment. (decrease it or set to 0 for better performance)

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

If checked then each tiktok video data will be included in the first comment in each scraped url

## Actor input object example

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

# 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
};

// 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,
}

# 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
}' |
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/3hTIMxY8QcbbOtHw9/openapi.json
