# TikTok Data Extractor - Videos & Profiles (`api_heros/tiktok-data-extractor`) Actor

Scrape TikTok videos, profiles, hashtags & search. Get plays, likes, shares, comments, bookmarks, captions, hashtags, music, subtitles, ad/sponsored flags, location, plus real creator stats (followers, following, total likes). Clean JSON. Residential-proxy ready.

- **URL**: https://apify.com/api\_heros/tiktok-data-extractor.md
- **Developed by:** [API HEROS](https://apify.com/api_heros) (community)
- **Categories:** Social media, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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.

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 Data Extractor

> Scrape TikTok **videos, profiles, hashtags & search** with full engagement metrics, **real creator stats**, captions, hashtags, music, subtitles, ad flags and location — delivered as clean, flat JSON. Built for scale on residential proxies.

### ✨ Why this Actor

- **Complete video data** — plays, likes, shares, comments, bookmarks, caption, hashtags, music, publish date, download & cover URLs.
- **Real creator stats** — followers, following, total likes, verification and bio, enriched from TikTok's own profile data (not estimates).
- **4 source types in one run** — profiles, single videos, hashtag pages and keyword search.
- **Anti‑bot resilient** — 3‑tier extraction (TikTok internal API → embedded page state → DOM), stealth browser fingerprinting, automatic session rotation and retries.
- **Ad & language detection** — flags sponsored/ad posts and auto‑detects content language.
- **Optional subtitles/captions.**
- **Clean flat JSON** — ready for spreadsheets, BI tools, ML pipelines or your API.

### 📦 What you get

| Group | Fields |
|---|---|
| Creator | `profile_name`, `profile_handle`, `profile_url`, `bio`, `profile_verified`, `profile_followers`, `profile_following`, `profile_total_likes` |
| Engagement | `plays`, `likes`, `shares`, `comments`, `bookmarks` |
| Content | `video_id`, `video_url`, `description`, `hashtags[]`, `language`, `music_title`, `music_author`, `duration_seconds`, `created_at`, `subtitles[]` |
| Flags & location | `is_ad`, `is_pinned`, `is_sponsored`, `location_created` |
| Media | `video_download_url`, `video_cover_url` |
| Meta | `scraped_at`, `source_type` |

### 🚀 Quick start

#### No code (Apify Console)

1. Open the Actor, paste TikTok URLs or search terms into **Start URLs**.
2. Set **Max videos**, click **Start**.
3. Download the dataset as JSON, CSV or Excel.

#### Via API

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/runs" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "startUrls": ["https://www.tiktok.com/@tiktok"], "maxItems": 50 }'
```

#### Via Apify SDK (JavaScript)

```javascript
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('YOUR_ACTOR_ID').call({
    startUrls: ['https://www.tiktok.com/@tiktok', 'https://www.tiktok.com/tag/dance', 'funny cats'],
    maxItems: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

### ⚙️ Input

| Field | Type | Default | Description |
|---|---|---|---|
| `startUrls` | string\[] | — | Profile / video / hashtag URLs or search terms (required) |
| `maxItems` | int | `50` | Total videos to return (required) |
| `maxItemsPerProfile` | int | `30` | Cap per source |
| `proxyConfiguration` | object | Apify Residential | Proxy settings (Apify Proxy recommended) |
| `downloadSubtitles` | bool | `false` | Extract captions/subtitles |
| `includeProfileDetails` | bool | `true` | Add creator follower/like stats |
| `scrollPaginationCount` | int | `5` | Scroll loads per page (~15-20 videos each) |
| `customMsDelay` | int | `2500` | Delay between actions (ms) |

#### Supported URLs

```
https://www.tiktok.com/@username          → Profile
https://www.tiktok.com/@user/video/123    → Single video
https://www.tiktok.com/tag/dance          → Hashtag
funny cats                                → Search (auto-detected)
```

### 📤 Output — real example

```json
{
  "profile_name": "TikTok",
  "profile_handle": "@tiktok",
  "profile_url": "https://www.tiktok.com/@tiktok",
  "bio": "One TikTok can make a big impact",
  "profile_verified": true,
  "profile_followers": 94980390,
  "profile_following": 0,
  "profile_total_likes": 462128553,
  "likes": 3027,
  "shares": 151,
  "plays": 160100,
  "comments": 680,
  "bookmarks": 184,
  "video_id": "7666214645006421278",
  "video_url": "https://www.tiktok.com/@tiktok/video/7666214645006421278",
  "description": "for 39 days, the For You Feed made the whole world feel like next door 🏆⚽",
  "hashtags": [],
  "language": "eng",
  "music_title": "original sound - TikTok",
  "created_at": "2026-07-24T21:48:21.000Z",
  "is_ad": false,
  "is_pinned": false,
  "is_sponsored": false,
  "location_created": null,
  "video_download_url": "https://v16-webapp-prime.tiktok.com/video/tos/...",
  "video_cover_url": "https://p16-common-sign.tiktokcdn.com/...",
  "scraped_at": "2026-07-26T22:19:56.135Z",
  "source_type": "profile_api"
}
```

Hashtag and ad detection in action (another real record):

```json
{ "hashtags": ["TechTok", "TikTokAlgorithm", "ForYouPage", "LearnOnTikTok"], "is_ad": true }
```

### 🛡️ Reliability & anti‑bot

1. **API interception (primary)** — captures TikTok's internal JSON responses for the cleanest, fullest data.
2. **Embedded state fallback** — parses `__UNIVERSAL_DATA_FOR_REHYDRATION__` / `SIGI_STATE` if the API path is unavailable.
3. **DOM fallback** — last‑resort scraping of visible elements.
   Plus stealth fingerprinting, residential‑proxy session rotation, and automatic retries on 403/429/CAPTCHA.

### 🔌 Proxy

TikTok aggressively blocks datacenter IPs. **Use Apify Residential proxy** (the default) for reliable results. Advanced users can supply their own proxies via `proxyConfiguration.proxyUrls`.

### ⚡ Performance

\~8–20 videos/minute depending on `customMsDelay` and proxy latency. Raise `scrollPaginationCount` and `maxItemsPerProfile` for large profiles.

### 💰 Pricing

- **Free trial** — first **100 videos free**.
- **Pay‑as‑you‑go** — **$2 per 1,000 videos** (~$0.002/video); pay only for what you scrape.
- **Monthly** — Starter **$29/mo** (5,000 videos), Professional **$99/mo** (30,000 + subtitles + priority), Enterprise **custom** (unlimited, dedicated proxies, SLA).

> Set pricing in Apify Console → your Actor → **Monetization**. Apify Residential proxy usage is billed by Apify.

### ❓ FAQ

**Do I need my own proxies?** No — Apify Residential proxy is the default and recommended.
**Why are some fields empty?** TikTok doesn't always return every field (e.g. photo carousels have no `video_download_url`). `source_type` shows which extraction tier produced the record.
**Can I scrape a whole profile?** Yes — raise `maxItemsPerProfile` and `scrollPaginationCount`.
**Is this compliant?** Designed for legitimate research/analytics. You must comply with TikTok's ToS, GDPR and CCPA.

### 📞 Support

Issues? Open the Actor's **Issues** tab or email support@yourcompany.com. Licensed under Apache‑2.0.

# Actor input Schema

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

TikTok profile URLs, video URLs, hashtag URLs, or plain search terms. All can be mixed in one run.

## `maxItems` (type: `integer`):

Maximum number of videos to return across all start URLs.

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

Cap per profile / hashtag / search so one source can't consume the whole budget.

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

Residential proxies are strongly recommended for TikTok. On the Apify platform just keep Apify Proxy enabled.

## `downloadSubtitles` (type: `boolean`):

Extract caption/subtitle tracks where available.

## `includeProfileDetails` (type: `boolean`):

Add followers, following and total likes for each video's creator.

## `scrollPaginationCount` (type: `integer`):

How many infinite-scroll loads to perform on profile/hashtag/search pages (~15-20 videos each).

## `customMsDelay` (type: `integer`):

Human-like delay between page actions. Higher = gentler on TikTok.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.tiktok.com/@tiktok",
    "https://www.tiktok.com/@tiktok/video/7106594312292453675",
    "https://www.tiktok.com/tag/dance",
    "funny cats"
  ],
  "maxItems": 50,
  "maxItemsPerProfile": 30,
  "downloadSubtitles": false,
  "includeProfileDetails": true,
  "scrollPaginationCount": 5,
  "customMsDelay": 2500
}
```

# Actor output Schema

## `overview` (type: `string`):

All scraped TikTok video records (open the table view).

# 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": [
        "https://www.tiktok.com/@tiktok"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api_heros/tiktok-data-extractor").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": ["https://www.tiktok.com/@tiktok"] }

# Run the Actor and wait for it to finish
run = client.actor("api_heros/tiktok-data-extractor").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 '{
  "startUrls": [
    "https://www.tiktok.com/@tiktok"
  ]
}' |
apify call api_heros/tiktok-data-extractor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/gzUViZARB8aslcdZW/builds/MQpeShpBqMrsYgMGk/openapi.json
