# Tiktok Scraper (`datadoping/tiktok-scraper`) Actor

Extract TikTok data from profiles, videos, and hashtags using URLs or search queries. Scrape usernames, followers, likes, shares, videos, music, and post details. Export data, run via API, automate schedules, monitor runs, or integrate with your tools.

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

## Pricing

from $0.40 / 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 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 Scraper

All-in-one TikTok data extraction for profiles, videos, followers, comments, search, hashtags, and music — in a single Apify Actor.

Fill only the input sections you need. Empty sections are skipped automatically. Results are split into separate, labeled datasets so each data type has its own clean table.

Built for influencer research, competitor intelligence, social listening, content analytics, lead generation, and data pipelines.

***

### Why Choose This Scraper?

- **One actor, seven workflows** — profiles, videos, followers/following, comments, creator & video search, hashtags, and music
- **Structured output** — separate datasets for posts, profiles, connections, comments, search, hashtags, music, and errors
- **Clockworks-style post views** — Overview, Posts, Authors, Music, and Video tabs inside the Posts dataset
- **Flat, export-ready fields** — captions, engagement, author info, music, and video URLs without nested JSON cleanup
- **Optional profile analytics** — engagement rate, averages, posting frequency, and viral post count
- **Mixed inputs** — usernames, profile URLs, video URLs, video IDs, hashtags, and music IDs in the same run
- **Partial success** — one failed target does not stop the rest; errors are recorded in a dedicated dataset
- **Export** to JSON, CSV, Excel, or integrate via the Apify API

***

### Built for Real-World Use Cases

#### Influencer & Creator Research

Audit creator profiles, recent posts, engagement patterns, and audience connections in one run.

#### Competitor & Market Intelligence

Track what competitors post, which sounds they use, and how their content performs.

#### Social Listening & UGC Research

Scrape comments and replies on viral videos; search creators and videos by keyword.

#### Hashtag Monitoring

Measure hashtag reach and track related videos by tag.

#### Lead Generation & Audience Building

Export follower and following lists with profile metadata for outreach or enrichment.

#### Data & AI Pipelines

Feed structured TikTok datasets into dashboards, warehouses, or LLM workflows.

***

### What You Can Scrape

| Section | What you get |
| --- | --- |
| **👤 Profiles** | Bio, followers, likes, video count, verification, region; optional recent posts and analytics |
| **🎬 Videos** | Full video metadata, author, engagement, music, download URL; optional related videos |
| **👥 Followers & Following** | Follower or following accounts with avatars and counts |
| **💬 Comments** | Top comments and optional replies per video |
| **🔍 Search** | Creator accounts by keyword; video search results go to Posts |
| **#️⃣ Hashtags** | Hashtag metadata plus videos using the tag |
| **🎶 Music** | Sound metadata plus videos using the sound |

***

### Setup

This actor requires a **DataDoping API key**.

1. In the Apify Console, open **Settings → Environment variables** for this Actor.
2. Add `API_KEY` with your DataDoping API key.
3. Save and run.

For local development, copy `.env.example` to `.env` and set `API_KEY` there.

***

### Input

Only fill the sections you need. At least one section must have input or the run exits with an error.

#### Example — profiles + videos

```json
{
  "profiles": ["taylorswift", "https://www.tiktok.com/@tiktok"],
  "includeRecentPosts": true,
  "maxPostsPerProfile": 50,
  "includeProfileAnalytics": true,
  "videoUrls": [
    "https://www.tiktok.com/@tiktok/video/7306132438047116586"
  ],
  "includeRelatedVideos": true,
  "maxRelatedVideos": 20
}
```

#### 👤 Profiles

| Field | Default | Description |
| --- | --- | --- |
| **Profiles** | — | Usernames, profile URLs, or user IDs. One per line. Duplicates removed. |
| **Include Recent Posts** | `true` | Fetch recent videos for each profile. |
| **Posts Per Profile** | `50` | Max recent posts per profile (min. 10). |
| **Include Profile Analytics** | `true` | Compute engagement rate, averages, posting frequency, viral post count. |

#### 🎬 Videos

| Field | Default | Description |
| --- | --- | --- |
| **Video URLs or IDs** | — | TikTok video URLs or numeric video IDs. |
| **Include Related Videos** | `true` | Collect videos related to each input video. |
| **Related Videos Per Input** | `20` | Max related videos per input (min. 10). |

#### 👥 Followers & Following

| Field | Default | Description |
| --- | --- | --- |
| **Profiles for Followers / Following** | — | Source profiles to scrape connections from. |
| **Scrape Followers** | `true` | Collect accounts that follow the profile. |
| **Scrape Following** | `false` | Collect accounts the profile follows. |
| **Maximum Items Per Profile** | `1000` | Max followers or following per source profile (min. 10). The DataDoping/TikTok API typically exposes only the **first ~1,000** connections per profile regardless of this limit — large accounts like `@tiktok` cannot return all followers through this endpoint. |

> **Followers & following at scale:** Connections are fetched from DataDoping with `max_time` pagination. Duplicates are skipped by user id. If the API returns an error-shaped empty page after partial results, the run exits with what was collected so far.

#### 💬 Comments

| Field | Default | Description |
| --- | --- | --- |
| **Video URLs or IDs for Comments** | — | Videos to scrape comments from. |
| **Include Replies** | `true` | Collect replies for each comment. |
| **Comments Per Video** | `100` | Max comments per video (min. 10). |
| **Replies Per Comment** | `20` | Max replies per comment (min. 10). |

#### 🔍 Search

| Field | Default | Description |
| --- | --- | --- |
| **Creator Search Keywords** | — | Keywords to find TikTok creators (e.g. `fitness`, `ai`). |
| **Video Search Keywords** | — | Keywords to find TikTok videos. |
| **Results Per Search Query** | `100` | Max results per keyword (min. 10). |

#### #️⃣ Hashtags

| Field | Default | Description |
| --- | --- | --- |
| **Hashtags** | — | Hashtag names or URLs, with or without `#`. |
| **Posts Per Hashtag** | `50` | Max videos per hashtag (min. 10). |

#### 🎶 Music

| Field | Default | Description |
| --- | --- | --- |
| **Music URLs or IDs** | — | TikTok sound URLs or numeric music IDs. |
| **Videos Per Sound** | `50` | Max videos per sound (min. 10). |

***

### Output

Results are stored in **typed datasets** in the Output dropdown, and **every row is also mirrored into All results** (the default dataset used by Export).

| Dataset | Contents |
| --- | --- |
| **📦 All results** | Every scraped row — used by Export |
| **📱 Posts** | Videos/posts from Profiles, Videos, Hashtags, Music, Video Search |
| **🎞️ Related Videos** | Related videos when Include Related Videos is enabled |
| **👤 Profiles** | Profile rows and optional analytics |
| **👥 Followers & Following** | Follower and following accounts |
| **💬 Comments** | Comments and replies |
| **🔍 Search** | Creator search results (video search → Posts) |
| **#️⃣ Hashtags** | Hashtag metadata (videos → Posts) |
| **🎶 Music** | Sound metadata (videos → Posts) |
| **⚠️ Errors** | Failed inputs with error messages |

#### Profile example

```json
{
  "type": "profile",
  "sourceInput": "taylorswift",
  "username": "taylorswift",
  "nickname": "Taylor Swift",
  "bio": "This is pretty much just a cat account",
  "profileUrl": "https://www.tiktok.com/@taylorswift",
  "avatar": "https://...",
  "verified": true,
  "followerCount": 33400000,
  "followingCount": 0,
  "likeCount": 273700000,
  "videoCount": 83,
  "scrapedAt": "2026-06-25T12:04:47.692Z"
}
```

#### Post / video example

```json
{
  "type": "post",
  "sourceInput": "taylorswift",
  "videoId": "7606213554449992991",
  "videoUrl": "https://www.tiktok.com/@taylorswift/video/7606213554449992991",
  "captionPreview": "I never want to forget a single detail of this hysterical shoot…",
  "playCount": 16200000,
  "likeCount": 1700000,
  "commentCount": 71300,
  "shareCount": 47900,
  "collectCount": 51100,
  "authorUsername": "taylorswift",
  "authorNickname": "Taylor Swift",
  "authorVerified": true,
  "musicTitle": "original sound",
  "musicAuthor": "Taylor Swift",
  "musicOriginal": true,
  "durationSeconds": 26,
  "createdAt": "2026-02-12T...",
  "scrapedAt": "2026-06-25T12:04:47.692Z"
}
```

#### Comment example

```json
{
  "type": "comment",
  "videoId": "7306132438047116586",
  "textPreview": "The way her voice has matured still gets me",
  "likeCount": 41678,
  "replyCount": 54,
  "authorUsername": "kyler",
  "authorNickname": "Kyler<3",
  "createdAt": "2023-11-27T...",
  "scrapedAt": "2026-06-25T12:39:10.000Z"
}
```

#### Error example

```json
{
  "type": "error",
  "sourceInput": "https://www.tiktok.com/@tiktok/video/7234567890123456789",
  "error": "Video not found",
  "workflow": "videos",
  "scrapedAt": "2026-06-25T12:39:12.000Z"
}
```

***

### Notes

- **Public data only** — only publicly available TikTok content is returned.
- **Empty sections are skipped** — you do not need to clear unused workflow fields.
- **Freemium limits** apply on the free plan (caps on list sizes and per-section maximums). Paid Apify users receive full configured limits.
- **Duplicate inputs** are removed automatically within each list.
- **Numeric minimums** — most limit fields require at least `10`.
- **Related videos** depend on upstream API availability; some video IDs may return errors (check **⚠️ Errors**).
- Per-target failures are logged and written to the errors dataset; other targets continue processing.

***

### Related Actors

Prefer a focused single-purpose scraper? These actors cover individual workflows:

- [TikTok Profile Scraper](https://apify.com/datadoping/tiktok-profile-scraper)
- [TikTok Followers Scraper](https://apify.com/datadoping/tiktok-followers-scraper)
- [TikTok Following Scraper](https://apify.com/datadoping/tiktok-following-scraper)
- [TikTok Comments and Replies Scraper](https://apify.com/datadoping/tiktok-comment-and-replies-scraper)

***

### Responsible Data Use

Use this actor only for lawful and ethical processing of publicly available data. Respect TikTok's terms of service and applicable privacy and data-protection regulations in your jurisdiction.

# Actor input Schema

## `profiles` (type: `array`):

TikTok usernames, profile URLs, or user IDs. One per line. Duplicate entries are removed automatically.

## `includeRecentPosts` (type: `boolean`):

Fetch recent videos for each profile.

## `maxPostsPerProfile` (type: `integer`):

Maximum recent posts to collect per profile. Only used when Include Recent Posts is enabled. Minimum is 10.

## `includeProfileAnalytics` (type: `boolean`):

Compute engagement rate, averages, posting frequency, and viral post count from profile and post data already collected in this run.

## `videoUrls` (type: `array`):

TikTok video URLs or numeric video IDs. One per line.

## `includeRelatedVideos` (type: `boolean`):

Collect videos related to each input video.

## `maxRelatedVideos` (type: `integer`):

Maximum related videos to collect per input video. Only used when Include Related Videos is enabled. Minimum is 10.

## `followersProfiles` (type: `array`):

TikTok usernames, profile URLs, or user IDs to scrape followers or following lists from.

## `scrapeFollowers` (type: `boolean`):

Collect accounts that follow the provided profiles.

## `scrapeFollowing` (type: `boolean`):

Collect accounts followed by the provided profiles.

## `maxItemsPerProfile` (type: `integer`):

Maximum followers or following accounts to scrape per source profile. Minimum is 10.

## `commentVideoUrls` (type: `array`):

TikTok video URLs or IDs to scrape comments from. One per line.

## `includeCommentReplies` (type: `boolean`):

Collect replies for each comment.

## `maxComments` (type: `integer`):

Maximum comments to collect per video. Minimum is 10.

## `maxReplies` (type: `integer`):

Maximum replies to collect per comment. Only used when Include Replies is enabled. Minimum is 10.

## `creatorSearchKeywords` (type: `array`):

Keywords to search for TikTok creators. Examples: fitness, gaming, fashion, ai.

## `videoSearchKeywords` (type: `array`):

Keywords to search for TikTok videos.

## `maxSearchResultsPerQuery` (type: `integer`):

Maximum results to collect per search keyword. Minimum is 10.

## `hashtags` (type: `array`):

Hashtag names or URLs (with or without #). One per line.

## `maxHashtagPosts` (type: `integer`):

Maximum posts to collect per hashtag. Minimum is 10.

## `musicUrlsOrIds` (type: `array`):

TikTok music/sound URLs or numeric music IDs. One per line.

## `maxMusicPosts` (type: `integer`):

Maximum videos to collect per music/sound. Minimum is 10.

## Actor input object example

```json
{
  "profiles": [
    "tiktok"
  ],
  "includeRecentPosts": true,
  "maxPostsPerProfile": 50,
  "includeProfileAnalytics": true,
  "videoUrls": [
    "https://www.tiktok.com/@tiktok/video/7234567890123456789"
  ],
  "includeRelatedVideos": true,
  "maxRelatedVideos": 20,
  "followersProfiles": [
    "tiktok"
  ],
  "scrapeFollowers": true,
  "scrapeFollowing": false,
  "maxItemsPerProfile": 1000,
  "commentVideoUrls": [
    "https://www.tiktok.com/@tiktok/video/7234567890123456789"
  ],
  "includeCommentReplies": true,
  "maxComments": 100,
  "maxReplies": 20,
  "creatorSearchKeywords": [
    "fitness"
  ],
  "videoSearchKeywords": [
    "ai"
  ],
  "maxSearchResultsPerQuery": 100,
  "hashtags": [
    "fyp"
  ],
  "maxHashtagPosts": 50,
  "musicUrlsOrIds": [],
  "maxMusicPosts": 50
}
```

# Actor output Schema

## `allResults` (type: `string`):

Every scraped row in one dataset. Use this for Export and full result counts.

## `posts` (type: `string`):

TikTok videos and posts from Profiles, Videos, Hashtags, Music, and Video Search.

## `relatedVideos` (type: `string`):

Related / recommended videos for each input video when Include Related Videos is enabled.

## `profiles` (type: `string`):

Creator profile info (bio, followers, verification) from the Profiles input section. May also include computed engagement analytics when enabled.

## `connections` (type: `string`):

Follower and following accounts from the Followers & Following workflow (also included in All results).

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

Comments and replies on videos from the Comments input section (also included in All results).

## `search` (type: `string`):

Creator accounts found by Creator Search keywords. Video search hits appear under Posts.

## `hashtags` (type: `string`):

Hashtag metadata (name, views, video count) from the Hashtags section. Videos tagged with the hashtag are listed under Posts.

## `music` (type: `string`):

Sound / music metadata from the Music section. Videos using the sound are listed under Posts.

## `errors` (type: `string`):

Failed inputs with error messages. Check here if a section returned no data or fewer rows than expected.

# 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 = {
    "profiles": [
        "tiktok"
    ],
    "includeRecentPosts": true,
    "maxPostsPerProfile": 50,
    "includeProfileAnalytics": true,
    "videoUrls": [
        "https://www.tiktok.com/@tiktok/video/7234567890123456789"
    ],
    "includeRelatedVideos": true,
    "maxRelatedVideos": 20,
    "followersProfiles": [
        "tiktok"
    ],
    "scrapeFollowers": true,
    "scrapeFollowing": false,
    "maxItemsPerProfile": 1000,
    "commentVideoUrls": [
        "https://www.tiktok.com/@tiktok/video/7234567890123456789"
    ],
    "includeCommentReplies": true,
    "maxComments": 100,
    "maxReplies": 20,
    "creatorSearchKeywords": [
        "fitness"
    ],
    "videoSearchKeywords": [
        "ai"
    ],
    "maxSearchResultsPerQuery": 100,
    "hashtags": [
        "fyp"
    ],
    "maxHashtagPosts": 50,
    "musicUrlsOrIds": [],
    "maxMusicPosts": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("datadoping/tiktok-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 = {
    "profiles": ["tiktok"],
    "includeRecentPosts": True,
    "maxPostsPerProfile": 50,
    "includeProfileAnalytics": True,
    "videoUrls": ["https://www.tiktok.com/@tiktok/video/7234567890123456789"],
    "includeRelatedVideos": True,
    "maxRelatedVideos": 20,
    "followersProfiles": ["tiktok"],
    "scrapeFollowers": True,
    "scrapeFollowing": False,
    "maxItemsPerProfile": 1000,
    "commentVideoUrls": ["https://www.tiktok.com/@tiktok/video/7234567890123456789"],
    "includeCommentReplies": True,
    "maxComments": 100,
    "maxReplies": 20,
    "creatorSearchKeywords": ["fitness"],
    "videoSearchKeywords": ["ai"],
    "maxSearchResultsPerQuery": 100,
    "hashtags": ["fyp"],
    "maxHashtagPosts": 50,
    "musicUrlsOrIds": [],
    "maxMusicPosts": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("datadoping/tiktok-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 '{
  "profiles": [
    "tiktok"
  ],
  "includeRecentPosts": true,
  "maxPostsPerProfile": 50,
  "includeProfileAnalytics": true,
  "videoUrls": [
    "https://www.tiktok.com/@tiktok/video/7234567890123456789"
  ],
  "includeRelatedVideos": true,
  "maxRelatedVideos": 20,
  "followersProfiles": [
    "tiktok"
  ],
  "scrapeFollowers": true,
  "scrapeFollowing": false,
  "maxItemsPerProfile": 1000,
  "commentVideoUrls": [
    "https://www.tiktok.com/@tiktok/video/7234567890123456789"
  ],
  "includeCommentReplies": true,
  "maxComments": 100,
  "maxReplies": 20,
  "creatorSearchKeywords": [
    "fitness"
  ],
  "videoSearchKeywords": [
    "ai"
  ],
  "maxSearchResultsPerQuery": 100,
  "hashtags": [
    "fyp"
  ],
  "maxHashtagPosts": 50,
  "musicUrlsOrIds": [],
  "maxMusicPosts": 50
}' |
apify call datadoping/tiktok-scraper --silent --output-dataset

```

## MCP server setup

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