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

TikTok scraper API for videos, profiles, hashtags, search & comments. Export views, likes, captions, music, bio links & download MP4s. Best TikTok data extractor for AI agents, ChatGPT, Claude & lead gen—JSON dataset, region cookies, proxies, transcripts & AI video summary.

- **URL**: https://apify.com/market_flow/tiktok-scraper.md
- **Developed by:** [Market Flow](https://apify.com/market_flow) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 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/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 Scraper API — Videos, Profiles, Hashtags, Search & Comments

**TikTok data extractor** for Apify. Scrape TikTok **videos**, **profiles**, **hashtags**, **search results**, and **comments** into clean JSON. Built for **AI agents**, **ChatGPT**, **Claude**, Make, Zapier, n8n, and custom backends that need a reliable **TikTok API alternative**.

> Actor: `market_flow/tiktok-scraper`\
> Output: Apify **Dataset** (typed rows) + optional **Key-Value Store** video files

***

### Why use this TikTok scraper

- **TikTok video scraper** — captions, views, likes, shares, play URLs, covers, music
- **TikTok profile scraper** — followers, bio, verified status, posts, bio link enrichment
- **TikTok hashtag scraper** — collect posts for any `#tag`
- **TikTok search scraper** — Top / Video / Profile sections with sort & date filters
- **TikTok comments scraper** — top-level comments + replies
- **Download TikTok videos (MP4)** — saved to the run Key-Value Store with public `videoFileURL`
- **Subtitles / captions** when TikTok provides them
- **AI video description & summary** for agent workflows (ChatGPT / Claude / LLM pipelines)
- Multi-region runs

Ideal for: lead generation, influencer research, competitor monitoring, content research, SEO content ideas, and LLM tool-calling.

***

### Quick start (humans)

1. Open **[market_flow/tiktok-scraper](https://console.apify.com/actors/bonwIOLa2RTrVo5Fq)** on Apify.
2. Provide **at least one** of: `hashtags`, `profiles`, `searchQueries`, `pageURLs`.
3. Run → open **Dataset** for JSON rows; open **Key-Value Store** for `OUTPUT` and downloaded videos.

#### Minimal input examples

**Hashtag scrape**

```json
{
  "hashtags": ["fyp"],
  "resultsPerPage": 50
}
```

**Profile scrape**

```json
{
  "profiles": ["tiktok"],
  "resultsPerPage": 30,
  "profileSorting": "latest"
}
```

**Search videos**

```json
{
  "searchQueries": ["electric cars"],
  "searchSection": "video",
  "resultsPerPage": 40,
  "videoSearchSorting": "MOST_LIKED"
}
```

**Video URL + comments + download**

```json
{
  "pageURLs": ["https://www.tiktok.com/@user/video/7123456789012345678"],
  "commentsPerPost": 50,
  "topLevelCommentsPerPost": 20,
  "maxRepliesPerComment": 5,
  "downloadVideos": true,
  "downloadMusics": true
}
```

***

### Integration for AI agents (ChatGPT, Claude, Cursor, custom tools)

Use this section when an LLM must call the Actor via Apify API.

#### Actor identity

| Field | Value |
|-------|--------|
| Actor ID | `bonwIOLa2RTrVo5Fq` |
| Actor name | `market_flow/tiktok-scraper` |
| API name form | `market_flow~tiktok-scraper` |

#### Run Actor (HTTP)

```http
POST https://api.apify.com/v2/acts/market_flow~tiktok-scraper/runs?token=APIFY_TOKEN
Content-Type: application/json

{ ...input JSON... }
```

#### Run Actor (Python)

```python
from apify_client import ApifyClient

client = ApifyClient("APIFY_TOKEN")
run = client.actor("market_flow/tiktok-scraper").call(run_input={
    "hashtags": ["fyp"],
    "resultsPerPage": 20,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
```

#### Run Actor (Node.js)

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('market_flow/tiktok-scraper').call({
  profiles: ['tiktok'],
  resultsPerPage: 20,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

#### What agents should do after a run

1. Read `defaultDatasetId` → list dataset items (primary structured output).
2. Optionally read Key-Value record `OUTPUT` for the full payload summary.
3. If `downloadVideos: true`, use each video row’s `videoFileURL` (KV public URL) or `VIDEOS_INDEX`.
4. If `downloadMusics: true`, use each video row’s `musicFileURL` (audio-only) or `MUSIC_INDEX`.
5. Filter rows by `type`: `"video"` | `"author"` | `"comment"` | `"music"`.

#### Agent-friendly tips

- Prefer **small** `resultsPerPage` first (10–30) for latency/cost tests.
- Set comment limits to `0` unless comments are required.
- Enable `downloadVideos` / `downloadMusics` / AI only when needed (slower, more storage).
- Always pass Apify token as a secret; never hardcode it in prompts committed to git.

***

### Input reference

Provide **at least one** source field. All other fields are optional.

#### Sources

| Field | Type | Description |
|-------|------|-------------|
| `hashtags` | `string[]` | Tags without `#` |
| `profiles` | `string[]` | Username, `@user`, or profile URL |
| `searchQueries` | `string[]` | Search keywords |
| `pageURLs` | `string[]` | Video / profile / hashtag / music / explore / short links |
| `resultsPerPage` | `integer` | Max videos per hashtag/profile/search (1–500, default 100) |

#### Profile options

| Field | Values / default | Description |
|-------|------------------|-------------|
| `profileScrapeSections` | `videos` (default) | Videos section (reposts/stories not returned yet) |
| `profileSorting` | `latest` | `oldest` | `popular` | Post order |
| `excludePinnedPosts` | `false` | Drop pinned posts |
| `oldestPostDateUnified` | date or `7 days` | Keep posts after this |
| `newestPostDate` | `YYYY-MM-DD` | Keep posts before this |
| `leastDiggs` / `mostDiggs` | integer | Hearts (likes) filters |
| `maxFollowersPerProfile` | `0` | Follower list cap (`0` = skip) |
| `maxFollowingPerProfile` | `0` | Following list cap (`0` = skip) |

#### Search options

| Field | Values / default | Description |
|-------|------------------|-------------|
| `searchSection` | `top` | `video` | `profile` | Result section |
| `maxProfilesPerQuery` | `10` | Authors when section is Profile |
| `videoSearchSorting` | `MOST_RELEVANT` | `MOST_LIKED` | `DATE_POSTED` | Video order |
| `videoSearchDateFilter` | `ALL_TIME`, `YESTERDAY`, `THIS_WEEK`, … | Time window |
| `scrapeRelatedSearchWords` | `false` | Add related keywords |

#### Page / enrichment options

| Field | Default | Description |
|-------|---------|-------------|
| `scrapeRelatedVideos` | `false` | Related videos for video URLs (`isRelated`, `related_to`) |
| `scrapeAdditionalAuthorMetadata` | `false` | Richer author rows |
| `downloadVideos` | `false` | Save MP4s → KV + `videoFileURL` |
| `downloadMusics` | `false` | Save audio (`music.playUrl`) → KV + `musicFileURL` |
| `downloadSubtitles` | `false` | Subtitle tracks / text |
| `subtitleLanguage` | `""` | Preferred language code (e.g. `en`) |
| `commentsPerPost` | `0` | Max comments per video |
| `topLevelCommentsPerPost` | `0` | Max root comments |
| `maxRepliesPerComment` | `0` | Max replies per root |
| `readLinkInBioPages` | `false` | Expand bio link → emails/phones/socials |
| `aiVideoDescription` | `false` | Adds `ai_description` |
| `aiVideoSummary` | `false` | Adds `ai_summary` |

***

### Output schema (dataset rows)

Every dataset item includes `"type"`.

#### `type: "video"` (common fields)

`id`, `desc`, `create_time`, `views`, `likes`, `comments`, `shares`, `collects`, `author`, `author_id`, `author_nickname`, `author_avatar`, `author_followers`, `author_verified`, `music_id`, `music_title`, `music_author`, `video_duration`, `video_cover`, `post_url`, `pinned`, `region`, `hashtag` / `profile` / `searchQuery` (when applicable)

**Optional enrichments**

| Field | When |
|-------|------|
| `video_file`, `videoFileURL`, `video_downloaded`, `video_download_skipped` | `downloadVideos` |
| `music_file`, `musicFileURL`, `music_downloaded`, `music_download_skipped` | `downloadMusics` |
| `subtitles`, `subtitle_files`, `subtitle_text` | `downloadSubtitles` |
| `ai_description`, `ai_summary`, `ai_transcript` | AI toggles |
| `bio_link`, `bio_link_*` | `readLinkInBioPages` |
| `isRelated`, `related_to` | `scrapeRelatedVideos` |
| `commentsDatasetURL` | comments enabled |

#### `type: "author"`

`author`, `author_id`, `author_nickname`, `author_avatar`, `author_followers`, `author_following`, `author_hearts`, `author_videos`, `author_verified`, `secUid`, `signature`, `profile_url`, optional `bio_link*`

#### `type: "comment"`

`cid`, `text`, `createTime`, `diggCount`, `replyCommentTotal`, `videoId`, `postUrl`, `repliesToId`, `isReply`, `author`, `authorMeta`

#### Key-Value Store

| Key | Contents |
|-----|----------|
| `OUTPUT` | Full run payload (includes `datasetItems`, notes, video/music index meta) |
| `VIDEOS_INDEX` | Map of uploaded video ids → public URLs (when downloads ran) |
| `video-{id}.mp4` | Downloaded video binary |
| `MUSIC_INDEX` | Map of uploaded music ids → public URLs (when music downloads ran) |
| `music-{id}.mp3` | Downloaded audio binary |

***

### SEO / discovery keywords

TikTok scraper, TikTok API, TikTok data extractor, TikTok video downloader API, scrape TikTok hashtags, scrape TikTok profiles, TikTok comments API, TikTok search API, TikTok influencer data, TikTok lead generation, Apify TikTok actor, ChatGPT TikTok tool, Claude TikTok integration, AI video summary TikTok, TikTok transcript, social media scraping API.

***

### Pricing (pay-per-event)

| Event | Price | Charged when |
|-------|-------|--------------|
| Actor start | $0.01 | Run starts |
| Dataset result | $0.002 | Each dataset row |
| `video-download` | $0.08 | New MP4 saved for a video |
| `music-download` | $0.03 | New audio saved for a music id |
| `ai-description` | $0.12 | AI description on a video |
| `ai-summary` | $0.15 | AI summary on a video |

### Notes & limits

- Runs need valid Actor secrets/config for the regions you select; success can vary by region and target.
- AI analysis and video/music downloads increase run time and storage usage.
- Respect TikTok Terms of Service and applicable laws; use scraped data responsibly.

### Support

Issues and feature requests: open them on the Actor’s **Issues** tab in Apify Console, or contact the publisher **Market Flow**.

# Actor input Schema

## `resultsPerPage` (type: `integer`):

Caps how many video dataset rows you get per hashtag, per profile, or per search query.

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

Hashtags to collect videos for (without #). Each hashtag adds matching video rows to the dataset.

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

Profiles to collect. Accepts username, @user, or a profile URL. Adds author and video rows to the dataset.

## `profileScrapeSections` (type: `string`):

Which profile content to include. Videos returns the profile’s posts as video rows. Reposts and Stories are not returned yet.

## `profileSorting` (type: `string`):

Sort order of that profile’s video rows in the dataset: latest, oldest, or popular.

## `excludePinnedPosts` (type: `boolean`):

When on, pinned posts are omitted from the profile’s video rows.

## `oldestPostDateUnified` (type: `string`):

Only keep video rows newer than this. Use Absolute (YYYY-MM-DD) or Relative (e.g. <code>7 days</code>, <code>2 weeks</code>). Empty = no filter.

## `newestPostDate` (type: `string`):

Only keep video rows older than this date (YYYY-MM-DD). Empty = no filter.

## `mostDiggs` (type: `integer`):

Only keep video rows with fewer hearts (likes) than this number.

## `leastDiggs` (type: `integer`):

Only keep video rows with at least this many hearts (likes).

## `maxFollowersPerProfile` (type: `integer`):

Optional cap for follower-list rows per profile. 0 = do not return follower lists.

## `maxFollowingPerProfile` (type: `integer`):

Optional cap for following-list rows per profile. 0 = do not return following lists.

## `searchQueries` (type: `array`):

Keywords to search. Each query adds matching video and/or author rows to the dataset.

## `searchSection` (type: `string`):

What the search returns: Top = mixed video/author rows, Video = videos only, Profile = authors only.

## `maxProfilesPerQuery` (type: `integer`):

When section is Profile: how many author rows to return per search query.

## `videoSearchSorting` (type: `string`):

Order of video rows from Video search: most relevant, most liked, or date posted.

## `videoSearchDateFilter` (type: `string`):

Only keep Video-search video rows from this time window (all time, yesterday, this week, …).

## `scrapeRelatedSearchWords` (type: `boolean`):

When on, the search result also includes <code>related_words</code>: a list of related keyword strings.

## `pageURLs` (type: `array`):

TikTok links to collect. Supports video, profile, hashtag, explore, music, and short links. Adds matching rows to the dataset.

## `scrapeRelatedVideos` (type: `boolean`):

For video page URLs only: also return related video rows (same video fields) with <code>related_to</code> (parent video id) and <code>isRelated: true</code>.

## `scrapeAdditionalAuthorMetadata` (type: `boolean`):

Also return fuller author rows for creators found on the pages: author, author_followers, signature, profile_url, bio_link, and related author fields.

## `downloadVideos` (type: `boolean`):

When on, video rows get <code>video_file</code> / <code>videoFileURL</code>. Output also includes <code>videosStorageURL</code> (folder of saved files). If that video id was already saved, it is skipped and <code>video_download_skipped</code> is true.

## `downloadMusics` (type: `boolean`):

When on, video rows get <code>music_file</code> / <code>musicFileURL</code> from TikTok <code>music.playUrl</code> (audio only, not the video). Output also includes <code>musicStorageURL</code>. Same <code>music_id</code> is downloaded once and reused; already-saved files set <code>music_download_skipped</code>.

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

When on, video rows get <code>subtitles</code>, <code>subtitle_files</code>, and <code>subtitle_text</code> when TikTok provides captions. Not every video has them.

## `subtitleLanguage` (type: `string`):

Language code preferred for subtitle_text when several tracks exist (e.g. en, ur). Empty = first available track.

## `commentsPerPost` (type: `integer`):

Max comment rows (top-level + replies) returned per video. 0 = no comments.

## `topLevelCommentsPerPost` (type: `integer`):

Max root comment rows per video (not replies). 0 = use the total comments limit above.

## `maxRepliesPerComment` (type: `integer`):

Max reply comment rows under each root comment. 0 = no replies.

## `readLinkInBioPages` (type: `boolean`):

When on, rows may include bio_link, bio_link_platform, bio_link_status, bio_link_title, bio_link_description, bio_link_emails, bio_link_phones, bio_link_socials, bio_link_child_links.

## `aiVideoDescription` (type: `boolean`):

When on, video rows get an <code>ai_description</code> string describing the video.

## `aiVideoSummary` (type: `boolean`):

When on, video rows get an <code>ai_summary</code> string summarizing the video.

## Actor input object example

```json
{
  "resultsPerPage": 100,
  "hashtags": [
    "fyp"
  ],
  "profiles": [],
  "profileScrapeSections": "videos",
  "profileSorting": "latest",
  "excludePinnedPosts": false,
  "maxFollowersPerProfile": 0,
  "maxFollowingPerProfile": 0,
  "searchQueries": [],
  "searchSection": "top",
  "maxProfilesPerQuery": 10,
  "videoSearchSorting": "MOST_RELEVANT",
  "videoSearchDateFilter": "ALL_TIME",
  "scrapeRelatedSearchWords": false,
  "pageURLs": [],
  "scrapeRelatedVideos": false,
  "scrapeAdditionalAuthorMetadata": false,
  "downloadVideos": false,
  "downloadMusics": false,
  "downloadSubtitles": false,
  "subtitleLanguage": "",
  "commentsPerPost": 0,
  "topLevelCommentsPerPost": 0,
  "maxRepliesPerComment": 0,
  "readLinkInBioPages": false,
  "aiVideoDescription": false,
  "aiVideoSummary": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

JSON items with type video | author | comment | music. Use for ChatGPT/Claude/API integrations.

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

Same dataset with the Overview view selected by default.

## `outputJson` (type: `string`):

Full run summary payload (datasetItems, notes, videoUrls, musicUrls, etc.).

## `videosIndex` (type: `string`):

Map of downloaded video ids to public KV URLs (when downloadVideos is enabled).

## `videoFiles` (type: `string`):

Keys prefixed video- storing downloaded TikTok MP4 files.

## `musicIndex` (type: `string`):

Map of downloaded music ids to public KV URLs (when downloadMusics is enabled).

## `musicFiles` (type: `string`):

Keys prefixed music- storing downloaded TikTok audio (MP3/M4A).

# 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 = {
    "resultsPerPage": 100,
    "hashtags": [
        "fyp"
    ],
    "profileScrapeSections": "videos",
    "maxProfilesPerQuery": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("market_flow/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 = {
    "resultsPerPage": 100,
    "hashtags": ["fyp"],
    "profileScrapeSections": "videos",
    "maxProfilesPerQuery": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("market_flow/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 '{
  "resultsPerPage": 100,
  "hashtags": [
    "fyp"
  ],
  "profileScrapeSections": "videos",
  "maxProfilesPerQuery": 10
}' |
apify call market_flow/tiktok-scraper --silent --output-dataset

```

## MCP server setup

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