# TikTok Video Detail Scraper (`airy_armadillo/tiktok-detail`) Actor

Fetch TikTok video details (caption, author, stats, media URLs) by ID. Requests are signed in pure Python - no browser and no JS engine.

- **URL**: https://apify.com/airy_armadillo/tiktok-detail.md
- **Developed by:** [COIN J](https://apify.com/airy_armadillo) (community)
- **Categories:** Social media, Videos
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 video details

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?

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 Detail Scraper

Fetch TikTok video details - caption, hashtags, mentions, author counters, engagement stats, music, and CDN media URLs - for a list of video URLs or IDs. Every request is signed locally in **pure Python**: no browser, no Node.js, no JS engine, no external TikTok API.

### What you get

One dataset item per input, with the same field layout as the popular TikTok video scrapers, so existing pipelines keep working.

| Group | Fields |
|---|---|
| Video | `id`, `text`, `textLanguage`, `createTime`, `createTimeISO`, `webVideoUrl`, `submittedVideoUrl`, `isAd`, `isSlideshow`, `isMuted`, `isPinned`, `isSponsored`, `locationCreated` |
| Stats (flat) | `playCount`, `diggCount`, `commentCount`, `shareCount`, `collectCount`, `repostCount` |
| `authorMeta` | `id`, `name`, `profileUrl`, `nickName`, `verified`, `privateAccount`, `signature`, `avatar`, `originalAvatarUrl`, `fans`, `video`, `following`, `heart`, `followDatasetUrl` |
| `musicMeta` | `musicName`, `musicAuthor`, `musicOriginal`, `musicId`, `playUrl`, `coverMediumUrl` |
| `videoMeta` | `width`, `height`, `duration`, `coverUrl`, `definition`, `format`, `downloadAddr` |
| Media | `mediaUrls` (CDN ladder, best first), `slideshowImageLinks` |
| Text extras | `mentions`, `detailedMentions`, `hashtags`, `effectStickers` |
| Provenance | `input`, `url`, `fromProfileSection`, `searchQuery`, `searchHashtag`, `searchMusic`, `originalVideoDetail`, `commentsDatasetUrl` |
| Errors | `error`, `errorCode`, `invalidUrls` |

### Input

```json
{
  "postURLs": [
    "https://www.tiktok.com/@user/video/7621991999251467550",
    "7621991999251467550"
  ],
  "maxConcurrency": 5,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

Accepted inputs: full video URLs, short links (`vt.` / `vm.` forms), bare numeric video IDs.

### Error handling

Failures never abort a run - each one becomes its own dataset item with the same field shape:

| `errorCode` | Meaning |
|---|---|
| `INVALID_URLS` | Input carried no TikTok video ID |
| `POST_NOT_FOUND_OR_PRIVATE` | Video deleted, private, or unavailable |
| `POST_SENSITIVE` | TikTok restricts this video (region or sensitive content) |
| `FETCH_FAILED` | Network or parsing failure after retries |

### How it works

1. Resolves the input to a numeric video ID.
2. Builds the `/api/item/detail/` query from a captured desktop-web request profile.
3. Signs it locally in Python: `X-Dynosaur` (SDK envelope), `X-Gnarly` (behaviour envelope), `X-Bogus`.
4. Sends the request with `curl_cffi` impersonating Chrome, so the TLS fingerprint matches what TikTok's SDK expects.
5. Maps the payload into the flat record shape above.

Signatures are generated fresh for every request, so the same video can be re-fetched any number of times.

### Fields that are always `null`

These keys exist for shape compatibility but the detail endpoint does not expose the data:

`locationCreated`, `locationMeta`, `isMuted`, `isPinned`, `isSponsored`, `originalVideoDetail`, `commentsDatasetUrl`, `fromProfileSection`, `searchQuery`, `searchHashtag`, `searchMusic`

`isPinned` additionally needs profile context, and `commentsDatasetUrl` would require a comments collector (out of scope for this Actor).

### Notes and limits

- Video URLs and IDs only - profiles, hashtags and search feeds are out of scope.
- The MP4 files themselves are not downloaded: `mediaUrls` and `videoMeta.downloadAddr` return TikTok CDN links, which are short-lived. Save what you need promptly.
- `repostCount` is `null` on videos where TikTok does not report it.
- Residential proxies give the best success rate, because requests are signed for the desktop web client.
- TikTok changes its signing SDK periodically. If runs start returning empty bodies, the signing profile needs refreshing.

### Local development

```bash
uv venv .venv
uv pip install --python .venv/Scripts/python.exe -r requirements.txt
python tests/check_mapper.py     # offline field-shape checks
apify run                        # local run; input in storage/key_value_stores/default/INPUT.json
apify push                       # deploy
```

# Actor input Schema

## `postURLs` (type: `array`):

TikTok video URLs (tiktok.com/@user/video/<id>), short links (vt./vm. forms), or bare numeric video IDs.

## `maxConcurrency` (type: `integer`):

How many videos to fetch in parallel (1-20). Higher values risk rate limiting.

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

Apify Proxy settings. Requests are signed for the desktop web client, so residential proxies give the best success rate.

## Actor input object example

```json
{
  "postURLs": [
    "https://www.tiktok.com/@tiktok/video/7621991999251467550"
  ],
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (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 = {
    "postURLs": [
        "https://www.tiktok.com/@tiktok/video/7621991999251467550"
    ]
};

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

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

```

## MCP server setup

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

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/4dcvI7gvxMG2MkBcN/builds/VJi8tBwnt8MWZXkYU/openapi.json
