# TikTok Posts Search Scraper (`outspoken_strategy/tiktok-post-search-scraper`) Actor

Search TikTok posts by keyword/hashtag. Multiple keywords, date-range filter, auto-pagination. Returns caption, author, likes, comments, shares, views and video URLs. No login needed — uses a real browser so TikTok signs its own API requests.

- **URL**: https://apify.com/outspoken\_strategy/tiktok-post-search-scraper.md
- **Developed by:** [code craker](https://apify.com/outspoken_strategy) (community)
- **Categories:** Social media, News, Videos
- **Stats:** 7 total users, 6 monthly users, 73.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## TikTok Posts Search Scraper

Apify actor that searches TikTok posts by keyword/hashtag and exports them as
structured data — **no login, no cookies, no session to maintain.**

TikTok content is viewable logged-out; the only barrier is its anti-bot request
*signing*. This actor drives a real Chrome (Playwright) so TikTok's own JavaScript
signs its API requests, then intercepts the `/api/challenge/item_list/` (and
`/api/search/`) responses — the same browser-interception pattern as the Reddit and
YouTube actors. There is nothing to reverse-engineer and no cookie that expires.

### Features

- One keyword (`query`) or many (`queries`) — each searched separately, combined and
  de-duplicated by video.
- Hashtag feed (`/tag/<keyword>`, default, open to logged-out visitors) or full-text
  `search` mode. Whitespace collapses into a single hashtag (`artificial intelligence`
  → the `#artificialintelligence` feed).
- Auto-pagination by scrolling until `numberOfPosts` per keyword is reached.
- Actor-side `timeSince`/`timeUntil` date filtering (TikTok has no date operators).
- Anti-detection built in: stealth browser fingerprint, residential-proxy preflight,
  and automatic relaunch on a fresh IP when TikTok serves a captcha / empty responses.
- Results pushed per keyword, so an abort keeps everything collected so far.

### Input

```json
{
    "queries": ["econet", "#zimbabwe"],
    "numberOfPosts": 100,
    "searchMode": "hashtag",
    "region": "US",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US"
    }
}
````

`numberOfPosts` applies **per keyword**. Keep the RESIDENTIAL proxy — TikTok blocks
datacenter IPs and serves empty/captcha responses to flagged exits.

### Output

One dataset item per video. Fields are emitted in both clean and snake\_case/camelCase
forms so the item is a drop-in for the `powerai/tiktok-hashtag-posts-scraper` output
that scraping-tool's `normalizeSocialPost` already understands.

```json
{
    "id": "7401234567890123456",
    "url": "https://www.tiktok.com/@zimtech/video/7401234567890123456",
    "webVideoUrl": "https://www.tiktok.com/@zimtech/video/7401234567890123456",
    "text": "AI is changing Zim business #econet",
    "author": {
        "uniqueId": "zimtech", "unique_id": "zimtech",
        "nickname": "Zim Tech", "id": "99",
        "profileUrl": "https://www.tiktok.com/@zimtech", "verified": true
    },
    "create_time": 1782898212,
    "created_at": "2026-07-01T09:30:12.000Z",
    "likesCount": 4200,  "diggCount": 4200,   "digg_count": 4200,
    "commentsCount": 88, "commentCount": 88,  "comment_count": 88,
    "sharesCount": 12,   "shareCount": 12,    "share_count": 12,
    "viewsCount": 150000,"playCount": 150000, "play_count": 150000,
    "duration": 42,
    "hashtags": ["econet", "ai"],
    "searchQuery": "econet",
    "hashtag": "econet"
}
```

`created_at` is exact (TikTok exposes real upload timestamps, unlike YouTube search).

### Integration (scraping-tool)

Drop-in for the existing TikTok keyword path — this is our own actor with the same
output shape as `powerai/tiktok-hashtag-posts-scraper`, so set it as primary with the
vendor as fallback (mirroring Facebook), and `normalizeSocialPost` needs no change:

```js
// ACTOR_FALLBACKS in scrapingService.js
'outspoken_strategy/tiktok-post-search-scraper': 'powerai/tiktok-hashtag-posts-scraper',
```

```js
// socialProjectMonitoringService.scrapeSocialPostsByKeyword (tiktok branch)
const res = await this.scrapingService.scrape({
    url: `https://www.tiktok.com/tag/${encodeURIComponent(keyword)}`,
    resultsLimit: requestCount,
    actor: 'outspoken_strategy/tiktok-post-search-scraper',
    timeout,
    additionalInput: {
        query: keyword, numberOfPosts: requestCount, region: 'ZW',
        proxyConfiguration: { useApifyProxy: true, apifyProxyGroups: ['RESIDENTIAL'], apifyProxyCountry: 'ZW' }
    },
    scrapeType: 'tiktok-keyword-search'
});
```

The existing `normalizeSocialPost` already reads `author.unique_id`, `video_id`/`id`,
`create_time`, `digg_count`, `comment_count`, `share_count`, `play_count` — all present.

### Local development

```bash
npm install
echo '{ "query": "artificial intelligence", "numberOfPosts": 30, "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"], "apifyProxyCountry": "US" } }' > storage/key_value_stores/default/INPUT.json
npm start
```

Note: TikTok flags IPs that make many requests, so local runs from a home IP may be
served empty responses — the actor is designed to run on Apify residential proxies.
Deploy with `apify push`.

# Actor input Schema

## `query` (type: `string`):

One keyword/hashtag to search for, e.g. "econet" or "#zimbabwe". Whitespace is collapsed into a single hashtag ("artificial intelligence" -> the #artificialintelligence feed). You can also paste several keywords, one per line. For a clean list use the "queries" field below instead. Leave empty if you use "queries".

## `queries` (type: `array`):

Multiple keywords/hashtags to search — each is searched separately and results are combined and de-duplicated by video. Takes precedence over/adds to "query". numberOfPosts applies PER keyword.

## `numberOfPosts` (type: `integer`):

Maximum number of videos to fetch per keyword.

## `searchMode` (type: `string`):

"hashtag" scrapes the /tag/<keyword> feed (open to logged-out visitors, recommended). "search" uses TikTok full-text search /search?q= which is richer but increasingly nudges toward login.

## `scrapeAll` (type: `boolean`):

Keep scrolling until numberOfPosts is reached or the feed runs dry. When unchecked only the first page of results is returned.

## `timeSince` (type: `string`):

Only return videos published on or after this date (format: yyyy-mm-dd).

## `timeUntil` (type: `string`):

Only return videos published before this date (format: yyyy-mm-dd).

## `region` (type: `string`):

Two-letter country code for the proxy exit region (e.g. US, GB, ZW). TikTok tailors results by region; keep it stable.

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

Proxy to route traffic through. Residential proxies with a country set are strongly required — TikTok blocks datacenter IPs and serves empty API responses / captcha to flagged exits, so the actor preflights IPs and retries on fresh ones.

## `headless` (type: `boolean`):

Uncheck to run a headed browser (useful only for local debugging).

## Actor input object example

```json
{
  "query": "artificial intelligence",
  "queries": [],
  "numberOfPosts": 100,
  "searchMode": "hashtag",
  "scrapeAll": true,
  "region": "US",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  },
  "headless": true
}
```

# 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 = {
    "query": "artificial intelligence",
    "queries": [],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("outspoken_strategy/tiktok-post-search-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 = {
    "query": "artificial intelligence",
    "queries": [],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("outspoken_strategy/tiktok-post-search-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "artificial intelligence",
  "queries": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call outspoken_strategy/tiktok-post-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=outspoken_strategy/tiktok-post-search-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "TikTok Posts Search Scraper",
        "description": "Search TikTok posts by keyword/hashtag. Multiple keywords, date-range filter, auto-pagination. Returns caption, author, likes, comments, shares, views and video URLs. No login needed — uses a real browser so TikTok signs its own API requests.",
        "version": "0.0",
        "x-build-id": "llhsOGqQ3khJsfgPy"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/outspoken_strategy~tiktok-post-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-outspoken_strategy-tiktok-post-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/outspoken_strategy~tiktok-post-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-outspoken_strategy-tiktok-post-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/outspoken_strategy~tiktok-post-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-outspoken_strategy-tiktok-post-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "query": {
                        "title": "Search Query (single keyword/hashtag)",
                        "type": "string",
                        "description": "One keyword/hashtag to search for, e.g. \"econet\" or \"#zimbabwe\". Whitespace is collapsed into a single hashtag (\"artificial intelligence\" -> the #artificialintelligence feed). You can also paste several keywords, one per line. For a clean list use the \"queries\" field below instead. Leave empty if you use \"queries\"."
                    },
                    "queries": {
                        "title": "Search Queries (multiple keywords/hashtags)",
                        "type": "array",
                        "description": "Multiple keywords/hashtags to search — each is searched separately and results are combined and de-duplicated by video. Takes precedence over/adds to \"query\". numberOfPosts applies PER keyword.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "numberOfPosts": {
                        "title": "Number of posts",
                        "minimum": 1,
                        "maximum": 2000,
                        "type": "integer",
                        "description": "Maximum number of videos to fetch per keyword.",
                        "default": 100
                    },
                    "searchMode": {
                        "title": "Search mode",
                        "enum": [
                            "hashtag",
                            "search"
                        ],
                        "type": "string",
                        "description": "\"hashtag\" scrapes the /tag/<keyword> feed (open to logged-out visitors, recommended). \"search\" uses TikTok full-text search /search?q= which is richer but increasingly nudges toward login.",
                        "default": "hashtag"
                    },
                    "scrapeAll": {
                        "title": "Scrape all (auto-paginate)",
                        "type": "boolean",
                        "description": "Keep scrolling until numberOfPosts is reached or the feed runs dry. When unchecked only the first page of results is returned.",
                        "default": true
                    },
                    "timeSince": {
                        "title": "Since date",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Only return videos published on or after this date (format: yyyy-mm-dd)."
                    },
                    "timeUntil": {
                        "title": "Until date",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                        "type": "string",
                        "description": "Only return videos published before this date (format: yyyy-mm-dd)."
                    },
                    "region": {
                        "title": "Region",
                        "type": "string",
                        "description": "Two-letter country code for the proxy exit region (e.g. US, GB, ZW). TikTok tailors results by region; keep it stable.",
                        "default": "US"
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Proxy to route traffic through. Residential proxies with a country set are strongly required — TikTok blocks datacenter IPs and serves empty API responses / captcha to flagged exits, so the actor preflights IPs and retries on fresh ones.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ],
                            "apifyProxyCountry": "US"
                        }
                    },
                    "headless": {
                        "title": "Run browser headless",
                        "type": "boolean",
                        "description": "Uncheck to run a headed browser (useful only for local debugging).",
                        "default": true
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
