# TikTok Posts Scraper (`harpoon/tiktok-posts-scraper`) Actor

Scrape TikTok posts for any search keyword - captions, authors, stats, music, hashtags, and video URLs.

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

## Pricing

from $1.00 / 1,000 posts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Posts Scraper — TikTok posts for any keyword, as clean structured rows

Enter one or more search keywords and get the matching TikTok posts back as structured data:
caption, author and audience size, play/like/comment/share counts, music, hashtags, and video
URLs. Set how many posts to pull per keyword and download the result as JSON, CSV, Excel, or XML.
No login or API key required.

#### What can TikTok Posts Scraper do?

- Pull TikTok posts for one keyword or hundreds in a single run
- Accept single words (`hulk`) or phrases (`mark ruffalo`, `coffee shop`)
- Return captions, authors, audience size, engagement stats, music, hashtags, and video/cover URLs
- Deduplicate repeated keywords automatically
- Export to JSON, CSV, Excel, or XML; run via the API, schedule runs, and connect through MCP

### What data can I extract?

<table>
<tr><th>What you get</th><th>Features</th></tr>
<tr><td>

- **Post** — post ID, caption, created time, canonical URL, duration, dimensions
- **Author** — username, nickname, avatar, bio, verified/private flags, follower/following/video counts
- **Engagement** — plays, likes, comments, shares, and collects per post
- **Music & tags** — sound id, title, artist, duration, plus every hashtag on the post
- **Media** — cover image and video play/download URLs

</td><td>

- Up to your chosen cap per keyword
- One row per post, keyed by post ID
- Export to JSON, CSV, Excel, XML
- API access, webhooks, scheduling, LLM-ready output for MCP

</td></tr>
</table>

### How to use TikTok Posts Scraper

1. [Create](https://console.apify.com/sign-up) a free Apify account.
2. Open **TikTok Posts Scraper** in Apify Console.
3. Type one or more keywords into **Search keywords**, one per line.
4. Set **Max posts per keyword** (default 100).
5. Click **Save & Start**.
6. Download the results in JSON, CSV, Excel, or XML from the **Storage** tab.

### Input

Give it a list of keywords; each one contributes its own posts to the dataset. For each keyword the
Actor reads the posts and stops at your cap.

- `keywords` — one keyword or phrase per line.
- `max_posts` — how many posts to return per keyword (default 100).

**Example input**

```json
{
  "keywords": ["mark ruffalo", "coffee shop"],
  "max_posts": 100
}
```

See the **Input** tab above for every parameter.

### Output

Results land in a dataset under the **Storage** tab. Three built-in views are included:
**Overview**, **Authors**, and **Engagement**. Download in JSON, CSV, Excel, or XML, or pull them
via the API.

```json
{
  "id": "7686420838932958496",
  "keyword": "mark ruffalo",
  "description": "#hulk #markruffalo #marveledit #avengersdoomsday #trend",
  "created_at": 1789634320,
  "url": "https://www.tiktok.com/@themntlst/video/7686420838932958496",
  "author": {
    "username": "themntlst",
    "nickname": "themntlst",
    "id": "7668723627462853654",
    "sec_uid": "MS4wLjABAAAAjlPa777QWN3WrCyMUfg4bgFcFP0nQDAE5xKxycll93uC97m4Fp9J2DD-_uh4TirL",
    "verified": false,
    "private": false,
    "signature": "",
    "avatar_url": "https://p16-common-sign.tiktokcdn.com/tos-useast2a-avt-0068-euttp/65ccd7b0d9169e627d2a48_n.jpeg",
    "follower_count": 12400,
    "following_count": 10,
    "video_count": 69,
    "heart_count": 5900000
  },
  "stats": {
    "play_count": 53000,
    "like_count": 4039,
    "comment_count": 32,
    "share_count": 117,
    "collect_count": 338
  },
  "music": {
    "id": "7686420865760250657",
    "title": "оригинальный звук",
    "author_name": "themntlst",
    "duration": 15,
    "original": true,
    "play_url": "https://v16-webapp-prime.tiktok.com/video/tos/useast2a/tos-useast2a-v-2370-euttp/oMpKhiL_n.mp3"
  },
  "hashtags": ["hulk", "markruffalo", "marveledit", "avengersdoomsday", "trend"],
  "video": {
    "duration": 15,
    "ratio": "540p",
    "width": 1036,
    "height": 576,
    "definition": "540p",
    "cover_url": "https://p16-common-sign.tiktokcdn.com/tos-useast2a-p-0037-euttp/osfLyD2In0F0GlefIg7rKMVx_n.jpeg",
    "dynamic_cover_url": "https://p16-common-sign.tiktokcdn.com/tos-useast2a-p-0037-euttp/okDAApfVGFKALI0BIVED7xfn_n.jpeg",
    "play_url": "https://v16-webapp-prime.tiktok.com/video/tos/useast2a/tos-useast2a-ve-0068c001-euttp/oc_n.mp4",
    "download_url": "https://v16-webapp-prime.tiktok.com/video/tos/useast2a/tos-useast2a-ve-0068-euttp/oEIrEQ_n.mp4"
  },
  "scraped_at": "2026-09-17T15:31:34Z"
}
```

Field names are lowercase snake\_case, and the input keys match them. Long URLs and text are
abbreviated for readability — the dataset contains the full values.

### What can you do with the data?

#### 1. Track a topic or brand

1. Run the Actor over your brand, product, or campaign keywords.
2. Open the **Overview** view and sort by `stats.play_count`.
3. Schedule a recurring run to follow how the topic trends.

#### 2. Find creators to work with

1. Run the Actor over niche keywords.
2. Use the **Authors** view to shortlist by `author.follower_count` and `author.verified`.
3. Open `author.username` to review the creator before reaching out.

#### 3. Build a content / caption dataset

1. Run the Actor over hashtags or topics.
2. Export the dataset to CSV or JSON.
3. Feed `description` and `hashtags` into content, trend, or language analysis.

### How much does TikTok Posts Scraper cost?

This Actor is billed **per post returned** (pay-per-event) on top of standard Apify platform
usage. A run over 10 keywords at 100 posts each is billed as up to 1,000 results; keywords with
fewer posts than the cap are billed for what they return.

See the **Pricing** tab for current rates and your plan's discounts.

### FAQ

**Do I need a TikTok account, cookies, or an API key?**
No. The Actor reads publicly available search results, so no login or credentials are required.

**Can it scrape private accounts or restricted content?**
No. Only posts that are publicly visible are returned; private or restricted content is skipped.

**How many posts can I get per keyword?**
Up to `max_posts` (default 100). Raise it for more; large pulls take longer and are billed per post
returned.

**Which keywords work best?**
Short, popular terms work best — brand names, creators, products, and topics.

**Why do the numbers differ from what I see when logged in?**
Public views can show different play or like counts than a logged-in session. The dataset reflects
what is publicly available at run time.

**Is it legal to scrape TikTok?**
Public data only. Captions, usernames, and profile details may be personal data — only collect it
when you have a legitimate reason, and follow Apify's legal guidance and the applicable terms.

**Can I use it with the API, SDKs, or MCP?**
Yes — see the **API** tab above, or connect through the Apify MCP server.

**A keyword is missing from the results.**
That keyword is logged with the reason (for example, a temporary failure or a rate limit). The
rest of the run continues; re-run just that keyword if needed.

### Notes and limitations

- **Public posts only** — private accounts and region-restricted content are not available.
- `created_at` is a Unix timestamp in UTC.
- `video.play_url` and `video.download_url` are time-limited media links; download them soon after
  the run if you need to keep the files. `download_url` is empty for some posts.
- Play and like counts are rounded by TikTok (e.g. `19200000` for "19.2M"), matching what the
  public page shows.

### Run locally

```
go run ./cmd/actor
```

Input is read from the Apify key-value store; see `INPUT_SCHEMA.json`.

### Support

Found a bug or have feedback? Open an issue in the **Issues** tab.

# Actor input Schema

## `keywords` (type: `array`):

<b>One keyword or phrase per line</b>, e.g. <code>mark ruffalo</code> or <code>coffee shop</code>. Duplicates are removed automatically, and every keyword returns its own set of posts.

## `max_posts` (type: `integer`):

How many posts to return per keyword. Higher values take longer and increase cost.

## Actor input object example

```json
{
  "keywords": [
    "mark ruffalo",
    "coffee shop"
  ],
  "max_posts": 100
}
```

# Actor output Schema

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

One row per scraped post. Export as JSON, CSV, Excel, or XML.

# 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 = {
    "keywords": [
        "mark ruffalo"
    ],
    "max_posts": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("harpoon/tiktok-posts-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 = {
    "keywords": ["mark ruffalo"],
    "max_posts": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("harpoon/tiktok-posts-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 '{
  "keywords": [
    "mark ruffalo"
  ],
  "max_posts": 100
}' |
apify call harpoon/tiktok-posts-scraper --silent --output-dataset

```

## MCP server setup

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