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

Fast and Cheap Tiktok Scraper

- **URL**: https://apify.com/cocoa_kit/tiktok-scraper.md
- **Developed by:** [Cocoa Kit](https://apify.com/cocoa_kit) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 87.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.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

Extract public TikTok videos, profile statistics, hashtag results, and keyword discovery results. Use the data to review content performance, find creators, and track topics. Export results as JSON, CSV, or Excel, or connect the Actor to your application through the Apify API.

### What you can collect

- **Video and photo posts:** Captions, publication dates, engagement counts, media links, and available post details.
- **Public profiles:** Account details, follower counts, and posted videos.
- **Hashtags:** Videos associated with a hashtag.
- **Keyword discovery:** Videos from TikTok discovery pages.
- **Optional media files:** Videos, covers, avatars, music covers, slideshow images, and available subtitles.

Duplicate records are removed within each run. You can set result limits and filter videos by publication date.

### Quick start

1. Enter video URLs, profile usernames, hashtags, or discovery keywords in the input form.
2. Set the maximum number of results. Leave media downloads off if you only need data.
3. Start the Actor and wait for the run to finish.
4. Open the dataset to view results or export them as JSON, CSV, or Excel.

You can also use the JSON input editor. This example collects up to 50 videos from two discovery topics, with a limit of 30 results per topic:

```json
{
    "searchQueries": ["cats", "cooking"],
    "resultsPerPage": 30,
    "maxItems": 50
}
```

To collect a public profile and its videos:

```json
{
    "profiles": ["tiktok"],
    "profileScrapeSections": ["profile", "videos"],
    "resultsPerPage": 30,
    "maxItems": 31
}
```

### Supported inputs

| Input           | What to enter                                                                                                                   |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `postURLs`      | Public TikTok video or photo URLs. Full URLs and share links are accepted.                                                      |
| `profiles`      | TikTok usernames or profile URLs. Use `profileScrapeSections` to select account details (`profile`), posts (`videos`), or both. |
| `hashtags`      | Hashtag names or TikTok tag URLs.                                                                                               |
| `searchQueries` | Keywords for TikTok discovery pages. These results differ from in-app search, and some keywords have no discovery page.         |

You can combine these inputs in one run. See the Input tab for all settings and their defaults.

### Output

The default dataset contains one record per unique video or profile. Export it as JSON, CSV, or Excel from Apify Console.

Video records include these fields:

- `type`, `id`, `webVideoUrl`, `text`, `textLanguage`, `createTime`, and `createTimeISO` identify the post and its publication time.
- `authorMeta` contains the public account ID, username, nickname, profile URL, verification and privacy flags, bio, avatar, bio link, and available account statistics.
- `diggCount`, `shareCount`, `playCount`, `commentCount`, and `collectCount` contain engagement counts. Missing values are `null`, not zero.
- `videoMeta` contains width, height, duration, format, definition, cover URL, play URL, download URL, and subtitle links.
- `musicMeta` contains the music ID, title, author, original-music flag, play URL, and cover URL.
- `hashtags`, `mentions`, `isAd`, `isPinned`, `isSponsored`, `isSlideshow`, `slideshowImageLinks`, and `locationCreated` contain available post details. Flags that TikTok does not supply are `null`.
- `input` and `scrapedAt` identify the source and the extraction time.
- `media` lists downloaded file keys, storage URLs, and file types. It is empty when downloads are off.

Profile records contain `type: "profile"`, `id`, `authorMeta`, `input`, `scrapedAt`, and `media`. `shouldDownloadAvatars` also applies to profile records. Profile details count toward the item limit. The dataset schema documents all record fields.

### Result limits and filters

`resultsPerPage` sets the maximum saved records per input source. `maxItems` sets the maximum for the entire run. Profile records count toward these limits. Limits apply after duplicate removal and date filters.

Use `oldestPostDate` and `newestPostDate` to select a publication date range. An ISO date and time gives an exact boundary. A date without a time means midnight UTC. Set `excludePinnedPosts` to omit pinned videos.

The Actor can return fewer records than requested when TikTok supplies fewer posts or filters remove results. `maxPagesPerSource` and `maxRunSeconds` let you limit the size and duration of a run.

### Media downloads

Enable the flags for the files you need:

- `shouldDownloadVideos`
- `shouldDownloadCovers`
- `shouldDownloadAvatars`
- `shouldDownloadMusicCovers`
- `shouldDownloadSlideshowImages`
- `shouldDownloadSubtitles`

The `media` field in each record contains links to the saved files. Files are stored in the run's key-value store. `maxDownloadBytes` limits each file to 30 MB by default.

Media availability depends on the post. TikTok media links can expire. Saved files remain available according to your Apify storage retention settings. A requested download that fails is reported as a source error.

### Run settings

Use the default automatic mode and 2 GB memory for general use. The `browserMode` setting is available for users who need to select a retrieval mode.

Proxies are optional and off by default. Configure them through `proxyConfiguration` when needed. Results can differ by country, and a proxy does not guarantee access.

Check the price shown in Apify Console before you start a run. Media downloads, proxy use, and larger runs can increase usage. Keep downloads off when you only need post data and statistics.

### Results and troubleshooting

The run's `RUN-SUMMARY` record shows the saved item count and the status of each input source. Check it when a source returns fewer records than expected or reports an error.

By default, `failOnPartial` is `true`: a failed source or a time limit makes the run fail, but records already saved remain available. A valid empty list or a filter with no matches can return zero records successfully.

Interrupted runs can resume from saved progress. Start a new run when you change the input.

### Coverage and limits

This Actor collects public content. It does not collect private or login-only content, follower or following lists, comments, related-video lists, or liked and reposted sections. Profile sorting is not supported.

Keyword discovery uses TikTok discovery pages. It does not reproduce TikTok's in-app search results or ranking. Availability can vary by keyword and region.

Only settings listed in the Input tab are supported. Unknown input fields cause an error. TikTok can restrict access or change the data it supplies. Missing statistics are returned as `null`.

Use the Actor for data you are authorized to collect and follow the applicable site terms.

# Actor input Schema

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

Public video, photo, or share URLs.

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

TikTok usernames or profile URLs.

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

Hashtag names or TikTok tag URLs.

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

Keywords for TikTok discovery pages. Discovery ranking differs from in-app search.

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

Maximum saved records per input source.

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

Maximum saved records for the run.

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

Maximum concurrent HTTP sources. Browser sources use a separate limit.

## `maxRequestRetries` (type: `integer`):

Retries after temporary request failures.

## `requestTimeoutSecs` (type: `integer`):

Timeout in seconds for each request.

## `requestDelayMillis` (type: `integer`):

Minimum delay in milliseconds between HTTP requests.

## `maxRunSeconds` (type: `integer`):

Stop after this many seconds. Keep records already saved.

## `maxPagesPerSource` (type: `integer`):

Maximum list pages per source.

## `browserMode` (type: `string`):

Use direct requests first in auto mode. Browser access is used when required.

## `browserWaitSecs` (type: `integer`):

Maximum wait in seconds for each browser list page.

## `profileScrapeSections` (type: `array`):

Return public videos, profile details, or both.

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

Exclude pinned profile videos.

## `oldestPostDate` (type: `string`):

Include posts on or after this ISO date. Empty means no lower limit.

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

Include posts on or before this ISO date and time. Empty means no upper limit.

## `shouldDownloadVideos` (type: `boolean`):

Download videos to the key-value store. This adds traffic and storage cost.

## `shouldDownloadCovers` (type: `boolean`):

Download covers to the key-value store. This adds traffic and storage cost.

## `shouldDownloadAvatars` (type: `boolean`):

Download avatars to the key-value store. This adds traffic and storage cost.

## `shouldDownloadMusicCovers` (type: `boolean`):

Download musiccovers to the key-value store. This adds traffic and storage cost.

## `shouldDownloadSlideshowImages` (type: `boolean`):

Download slideshowimages to the key-value store. This adds traffic and storage cost.

## `shouldDownloadSubtitles` (type: `boolean`):

Download subtitles to the key-value store. This adds traffic and storage cost.

## `maxDownloadBytes` (type: `integer`):

Maximum bytes per downloaded file.

## `failOnPartial` (type: `boolean`):

Fail the run if any source fails or the run time limit is reached. Saved data remains available.

## `browserWarmupSecs` (type: `integer`):

Minimum session preparation time before a hashtag page. If the session is still loading, wait up to browserWaitSecs. Zero disables preparation.

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

Optional Apify or custom proxy. Off by default. A proxy adds cost and can select a different country.

## `browserGeoIp` (type: `boolean`):

Match Camoufox locale and time zone to the connection IP. Uses a bundled GeoIP database and a public IP check.

## Actor input object example

```json
{
  "postURLs": [
    "https://www.tiktok.com/@scout2015/video/6718335390845095173"
  ],
  "profiles": [],
  "hashtags": [],
  "searchQueries": [],
  "resultsPerPage": 30,
  "maxItems": 100,
  "maxConcurrency": 10,
  "maxRequestRetries": 2,
  "requestTimeoutSecs": 30,
  "requestDelayMillis": 300,
  "maxRunSeconds": 300,
  "maxPagesPerSource": 20,
  "browserMode": "auto",
  "browserWaitSecs": 15,
  "profileScrapeSections": [
    "videos"
  ],
  "excludePinnedPosts": false,
  "oldestPostDate": "",
  "newestPostDate": "",
  "shouldDownloadVideos": false,
  "shouldDownloadCovers": false,
  "shouldDownloadAvatars": false,
  "shouldDownloadMusicCovers": false,
  "shouldDownloadSlideshowImages": false,
  "shouldDownloadSubtitles": false,
  "maxDownloadBytes": 30000000,
  "failOnPartial": true,
  "browserWarmupSecs": 5,
  "proxyConfiguration": {
    "useApifyProxy": false
  },
  "browserGeoIp": true
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `files` (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/@scout2015/video/6718335390845095173"
    ],
    "profiles": [],
    "hashtags": [],
    "searchQueries": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("cocoa_kit/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 = {
    "postURLs": ["https://www.tiktok.com/@scout2015/video/6718335390845095173"],
    "profiles": [],
    "hashtags": [],
    "searchQueries": [],
}

# Run the Actor and wait for it to finish
run = client.actor("cocoa_kit/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 '{
  "postURLs": [
    "https://www.tiktok.com/@scout2015/video/6718335390845095173"
  ],
  "profiles": [],
  "hashtags": [],
  "searchQueries": []
}' |
apify call cocoa_kit/tiktok-scraper --silent --output-dataset

```

## MCP server setup

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