# TikTok Scraper – Videos, Profiles & Comments (`mscraper/tiktok-scraper`) Actor

Collect TikTok videos, profiles and comments with predictable limits. Keyword search available with experimental pagination.

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

## Pricing

from $0.25 / 1,000 tiktok 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

Collect TikTok **videos, profiles, comments and keyword search results** in a consistent dataset. Export JSON, CSV, Excel or integrate through the Apify API. Provider access and platform usage are included; no provider key is required in input.

### Supported modes

| Mode     | Input                                     | Output                                                                       |
| -------- | ----------------------------------------- | ---------------------------------------------------------------------------- |
| Videos   | Usernames/profile URLs or full video URLs | Video text, IDs, dates, author, engagement, hashtags, duration and cover URL |
| Profiles | Usernames/profile URLs                    | Profile ID, username, bio and available counters                             |
| Comments | Full video URLs                           | Comment text, author, likes, timestamp and reply count                       |
| Search   | Keywords                                  | Matching videos; deeper pagination is experimental                           |

Search is experimental: unmatched terms can return unrelated recommendations, so it does not guarantee keyword matches. The first search page was validated. During testing, the provider returned an application error for page two; this Actor reports that failure and keeps earlier saved results. It does not silently treat provider failures as an empty result or promise complete history. Profile-video and comment pagination passed two-page tests. Availability varies by source.

Short links, private content, follower lists, media downloads and reply-thread expansion are not supported in this version. Media links may expire. Missing fields are null. IDs are strings to preserve precision.

### Quick start

```json
{ "mode": "videos", "profiles": ["khaby.lame"], "maxItems": 10, "maxItemsPerSource": 10, "maxRequests": 3 }
```

Choose a mode, supply matching sources, and set total/per-source result caps. With no input, Videos mode uses `khaby.lame` and saves at most 20 records. See `examples/` for search, profile and comment inputs.

### Pricing

- **$0.25 per 1,000 unique records saved** (video, profile or comment).
- **$0.10 per 1,000 confirmed empty-check units** ($0.0001 per unit).
- No start event. Platform usage included.

A confirmed empty check is a successful provider response containing a validated empty list. Its fee follows provider billing units; every currently supported endpoint costs one unit per attempt. A nonempty response is not also billed as an empty check. Provider errors, ambiguous `data not found` errors, malformed responses, duplicates and filtered records are not empty checks. Partial results already saved remain chargeable when a later request fails. Profile lookups and retries consume the request allowance.

The Actor checks the run budget before making requests and saving records. It needs enough budget for either one result or one empty check before requesting data. Set the maximum charge in Apify to control total spending.

### Usage safeguards

Requests are bounded per run and coordinated across concurrent runs. Free accounts receive a shared trial allowance of 3 provider units per 30-day window; all free trials share a developer-managed pool. Paid accounts default to 1,000 units per 24-hour window. Shared provider caps can stop any run earlier. Windows begin on first use; these are safety allowances, not provider subscription reset dates. Contact the developer for larger allowances.

The shared request rate is capped at 90 requests per minute across all runs. Each run can select a lower rate. Paid provider access is managed by the developer; the global usage guard can stop runs when the shared allowance is exhausted.

### Output

The default dataset contains records matching `schemas/tiktok-record.schema.json`. `OUTPUT` contains status, record count, confirmed empty checks, requests, retries and warnings. `item-limit`, `request-budget`, `charge-limit` and `usage-limit` are explicit stop reasons. Exceptions mark the run failed rather than hiding missing data.

### Local development

Node.js 22 or newer:

```sh
npm ci
npm run check
npm run build
## Set RAPIDMINE_API_KEY in the environment (never in input or source).
apify run
```

Cloud execution requires managed provider credentials, Redis/Upstash credentials, billing events and identity verification. Local execution uses bounded requests without shared cloud allowances. Tests use synthetic responses and an isolated Redis instance; they do not consume provider quota. `redis-server` is required.

### Related scrapers for social media and website research

Add context to TikTok video and creator research with public posts, community discussions and website traffic estimates.

- [X (Twitter) Scraper](https://apify.com/mscraper/x-scraper) — Collect public profiles, timeline posts and follower lists to compare a brand’s activity on X.
- [Reddit Scraper](https://apify.com/mscraper/reddit-scraper) — Find Reddit posts by keyword and collect discussion comments for qualitative audience research.
- [Similarweb Quick Scraper](https://apify.com/mscraper/similarweb-quick-scraper) — Retrieve estimated website visits, traffic sources and top countries for domains associated with creators or brands.

Run each Actor separately and combine its exported data in your own workflow. Each Actor has its own input, output and pricing.

# Actor input Schema

## `mode` (type: `string`):

One mode per run. Search pagination may fail at the provider; partial results remain saved.

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

For Videos or Profiles. Videos mode defaults to khaby.lame only when no sources are supplied.

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

Full https://www.tiktok.com/@username/video/id URLs. For Videos or Comments.

## `searches` (type: `array`):

Experimental discovery: the provider may return unrelated recommendations for unmatched terms. Deeper pagination may fail.

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

Total saved records across all sources.

## `maxItemsPerSource` (type: `integer`):

Maximum list results per profile, video or search.

## `maxRequests` (type: `integer`):

Includes profile lookups and retries. Developer-managed shared allowances can stop the run sooner.

## `maxRetries` (type: `integer`):

Retries transient HTTP and network failures. Application errors stop the run.

## `requestsPerMinute` (type: `integer`):

Upper bound for this run; the shared provider limit also applies.

## Actor input object example

```json
{
  "mode": "videos",
  "profiles": [],
  "videoUrls": [],
  "searches": [],
  "maxItems": 20,
  "maxItemsPerSource": 20,
  "maxRequests": 10,
  "maxRetries": 1,
  "requestsPerMinute": 90
}
```

# Actor output Schema

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

No description

## `summary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("mscraper/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 = {}

# Run the Actor and wait for it to finish
run = client.actor("mscraper/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 '{}' |
apify call mscraper/tiktok-scraper --silent --output-dataset

```

## MCP server setup

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