# 快手 / Kuaishou / Kwai API - 视频搜索、评论、博主数据 (`socialdatax/socialdatax-kuaishou-data-api`) Actor

社媒数据助手 SocialDataX 提供只读快手 / Kuaishou / Kwai data API，支持 Kuaishou video search / 快手作品搜索、快手视频数据、Kuaishou comments export / 快手评论数据、video details、comment replies、creator profile data 和 creator videos。

- **URL**: https://apify.com/socialdatax/socialdatax-kuaishou-data-api.md
- **Developed by:** [SocialDataX](https://apify.com/socialdatax) (community)
- **Categories:** Social media, Videos, Developer tools
- **Stats:** 16 total users, 2 monthly users, 88.4% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 dataset items

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/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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## 快手 / Kuaishou / Kwai API - 热榜、搜索、详情、评论、博主数据

这是社媒数据助手 SocialDataX 的 Apify Actor 适配层，提供只读快手 / Kuaishou / Kwai data API，覆盖快手热榜、Kuaishou video search / Kwai video search、作品详情、Kuaishou comments / Kwai comments、评论回复和博主数据。

Apify 用户无需配置 SocialDataX API Key；直接通过 Apify Console、Apify API、Dataset export 或自动化工作流运行即可。

支持能力：

- 热榜 / hot list
- 作品搜索 / video search
- 作品详情 / video details
- 评论列表 / comments
- 评论回复 / comment replies
- 博主信息 / creator profiles
- 博主作品列表 / creator videos

This Actor is a read-only, unofficial data API integration. It is not affiliated with Kuaishou or Kwai.

### Support / 联系我们

如果 run 失败、需要更高用量，或想接入批量数据工作流，请通过 SocialDataX support 联系我们：

- Website: <https://socialdatax.com/>

If a run fails, you need higher limits, or you want to discuss a bulk data workflow, contact SocialDataX support:

- Website: <https://socialdatax.com/>

### 选择字段

先选择 `operation`，再填写该 operation 需要的字段。Apify 表单里其它字段可以留空；即使误填了无关字段，Actor 也会忽略。

| Operation | 必填字段 | 可选字段 | 说明 |
| --- | --- | --- | --- |
| `search_hot_list` | 无 | `max_items` | 读取快手短视频热榜，请求一次并按 `max_items` 限制写入 Dataset。 |
| `search_videos` | `keyword` | `page_token`, `max_items`, `auto_paginate` | 按关键词搜索快手作品，默认会自动翻页直到达到 `max_items`。 |
| `get_video_detail` | `photo_id` 或 `url` 至少填一个 | 无 | 获取单个快手作品详情；两者都填时优先使用 `url`。 |
| `get_video_comments` | `photo_id` 或 `url` 至少填一个 | `page_token`, `max_items`, `auto_paginate` | 获取一级评论列表；两者都填时优先使用 `url`。 |
| `get_video_sub_comments` | `photo_id`, `comment_id` | `page_token`, `max_items`, `auto_paginate` | 获取某条一级评论下的回复。先运行 `get_video_comments`，从 Dataset 的 `comment_id` 字段复制 `has_replies = true` 的一级评论 ID。 |
| `get_user_info` | `user_id` 或 `profile_url` 至少填一个 | 无 | 获取博主信息；两者都填时优先使用 `profile_url`。 |
| `list_user_videos` | `user_id` 或 `profile_url` 至少填一个 | `page_token`, `max_items`, `auto_paginate` | 获取博主作品列表；两者都填时优先使用 `profile_url`。 |

### 字段填写建议 / Input tips

- `url`: 推荐直接粘贴快手作品链接、短链接或分享文案，适用于 `get_video_detail` 和 `get_video_comments`。`get_video_sub_comments` 不使用 `url`，请先跑 `get_video_comments` 再复制 Dataset 行里的真实 `photo_id + comment_id`。
- `profile_url`: 推荐直接粘贴打开后能看到博主资料的快手主页链接、短链接或分享文案，适用于 `get_user_info` 和 `list_user_videos`。如果页面能打开但看不到用户资料，请改用搜索、详情或评论 Dataset 返回的 `author_profile_url` / `author_user_id`。
- `photo_id`: 只填真实作品 ID；如果把作品链接或分享文案误填到 `photo_id`，Actor 会尽量自动按 `url` 处理。`get_video_sub_comments` 例外，它必须使用 `get_video_comments` Dataset 行里的真实 `photo_id`。
- `user_id`: 只填真实 `user_id` / `author_user_id`。不要填昵称、主页名称或快手号；如果只有主页链接或分享文案，请填 `profile_url`。
- `comment_id`: 只填 `get_video_comments` Dataset row 里的 `comment_id`。请选择 `has_replies = true` 的一级评论行，不要填评论内容、昵称或其它文本。

如果用户把作品链接填到博主类 operation、把主页链接填到作品类 operation，或在 `get_video_sub_comments` 的 `photo_id` 里粘贴作品链接/分享文案，Actor 会跳过 SocialDataX API 请求并在 `OUTPUT` 写入中英文 warning 和支持链接，避免因为明显可修正的输入问题直接失败。

### 输入示例

热榜：

```json
{
  "operation": "search_hot_list",
  "max_items": 20
}
```

作品搜索：

```json
{
  "operation": "search_videos",
  "keyword": "露营",
  "max_items": 20,
  "auto_paginate": true
}
```

作品详情：

```json
{
  "operation": "get_video_detail",
  "url": "https://www.kuaishou.com/short-video/3x3c333kuw4ppz6"
}
```

评论列表：

```json
{
  "operation": "get_video_comments",
  "url": "https://www.kuaishou.com/short-video/3xga9bnxzfggi29",
  "page_token": "",
  "max_items": 20,
  "auto_paginate": true
}
```

评论回复：

```json
{
  "operation": "get_video_sub_comments",
  "photo_id": "3xiiy5h354fxrky",
  "comment_id": "1110853192412",
  "page_token": "",
  "max_items": 20,
  "auto_paginate": true
}
```

`comment_id` 来自 `get_video_comments` 的 Dataset 结果。选择 `has_replies = true` 的一级评论行，复制该行的 `comment_id`。

博主信息：

```json
{
  "operation": "get_user_info",
  "profile_url": "https://www.kuaishou.com/profile/3x5ijbmydjhrcng"
}
```

博主作品列表：

```json
{
  "operation": "list_user_videos",
  "profile_url": "https://www.kuaishou.com/profile/3xn3uu4z6qqtvz4",
  "page_token": "",
  "max_items": 20,
  "auto_paginate": true
}
```

`max_items` 默认 `50`，最大 `1000`。`auto_paginate=false` 时只请求当前 `page_token`。热榜不使用关键词或分页参数，请求一次并按 `max_items` 限制写入 Dataset 的热榜条目数。

如果用户在 Apify run options 里设置了更低的 paid Dataset item 上限，Actor 会把热榜和列表类 `max_items` 自动裁剪到该上限，避免超预算写入或请求过多页面。
如果该上限为 `0`，Actor 会直接结束并在 `OUTPUT` 写入 warning，不会请求 SocialDataX API。

### Apify 计划要求

持续使用需要 Apify paid plan。Apify free plan 用户有 5 次 SocialDataX API request 试用额度；每次请求一个接口页面计 1 次，`auto_paginate=true` 时每翻一页都会计入一次。试用额度用完后，请升级 Apify 计划继续使用。

Ongoing use requires an Apify paid plan. Free-plan users get a 5-request SocialDataX API trial. Each requested page counts as one request, so `auto_paginate=true` can consume multiple requests in one run.

### 输出

Actor 会把结果写入 Apify Dataset，适合 JSON、CSV、Excel / XLSX、JSONL 等格式导出。

热榜和列表类接口会为 `items[]` 中的每个元素写入一条扁平 dataset row：

```json
{
  "operation": "get_video_comments",
  "item_index": 1,
  "query_photo_id": "3xga9bnxzfggi29",
  "query_page_token": "",
  "query_max_items": 20,
  "query_auto_paginate": true,
  "photo_id": "3xga9bnxzfggi29",
  "comment_id": "1133183536984",
  "content": "为小敏的哥哥，嫂子点赞[赞][赞][赞][赞][祈祷][祈祷][祈祷][祈祷][祈祷]",
  "has_replies": false,
  "author_user_id": "3x58hkbxv2sgpje",
  "author_name": "反应神",
  "page_request_index": 1,
  "page_item_count": 20,
  "page_next_page_token": "next-token",
  "page_has_more": true
}
```

详情类接口会写入一条 dataset row。`author`、`video` 等常见对象会展开为 `author_*`、`video_*` 字段；图片和数组字段保留 JSON 值。

作品搜索、作品详情和博主作品列表会返回 `topic_tags`；无标签时为 `[]`，每项只包含 `name`，例如 `[{"name":"老铁财富密码"}]`。

如果某一页 `items` 为空但仍有分页信息，Actor 会写入一条 `empty_page=true` 的 summary row，避免丢失 `next_page_token`。如果空页已经没有下一页，则不会写入 Dataset row。

如果 run 失败，`OUTPUT` 会保留一条轻量失败摘要，方便在 Apify 控制台里直接看到请求次数、状态码和简要错误信息。

### Apify API 调用

同步运行并直接获取 Dataset items：

```bash
curl -X POST "https://api.apify.com/v2/acts/socialdatax~socialdatax-kuaishou-data-api/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "search_videos",
    "keyword": "露营",
    "max_items": 20,
    "auto_paginate": true
  }'
```

Python client 示例：

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("socialdatax/socialdatax-kuaishou-data-api").call(run_input={
    "operation": "search_videos",
    "keyword": "露营",
    "max_items": 20,
    "auto_paginate": True,
})
items = client.dataset(run["defaultDatasetId"]).list_items().items
```

### 费用

Apify 用户按 Actor 页面展示的 Apify 价格和用量计费，不需要购买或配置 SocialDataX API Key。

# Actor input Schema

## `operation` (type: `string`):

先选择要调用的快手 / Kuaishou / Kwai 数据能力，然后只填写该 operation 需要的字段；无关字段会被忽略。持续使用需要 Apify paid plan；free plan 用户有 5 次 SocialDataX API request 试用额度。Choose the operation first, then fill only the fields used by that operation.

## `keyword` (type: `string`):

仅 operation=search\_videos 时必填；热榜 search\_hot\_list 不需要 keyword，其它 operation 可留空。

## `photo_id` (type: `string`):

operation=get\_video\_detail、get\_video\_comments、get\_video\_sub\_comments 时使用；如果只有作品链接、短链接或分享文案，请直接填 url。详情和评论列表至少提供 photo\_id 或 url 之一，同时提供时优先使用 url。误填到 photo\_id 时，Actor 会尽量自动识别作品链接。评论回复必须使用 get\_video\_comments Dataset 行里的真实 photo\_id + comment\_id，不支持链接或分享文案。

## `url` (type: `string`):

operation=get\_video\_detail、get\_video\_comments 时至少提供 url 或 photo\_id 之一；同时提供时优先使用 url。推荐直接粘贴快手作品链接、短链接或分享文案。评论回复 get\_video\_sub\_comments 不使用 url；请先运行 get\_video\_comments，再复制 Dataset 行里的真实 photo\_id + comment\_id。

## `user_id` (type: `string`):

operation=get\_user\_info、list\_user\_videos 时至少提供 user\_id 或 profile\_url 之一；同时提供时优先使用 profile\_url。只填真实 user\_id，不要填昵称、主页名称或快手号；如果只有主页链接、短链接或分享文案，请直接填 profile\_url。误填到 user\_id 时，Actor 会尽量自动按 profile\_url 处理。

## `profile_url` (type: `string`):

operation=get\_user\_info、list\_user\_videos 时至少提供 profile\_url 或 user\_id 之一；同时提供时优先使用 profile\_url。强烈推荐直接粘贴打开后能看到博主资料的快手主页链接、短链接或分享文案；如果页面能打开但看不到用户资料，请改用搜索、详情或评论 Dataset 返回的 author\_profile\_url / author\_user\_id。

## `comment_id` (type: `string`):

仅 operation=get\_video\_sub\_comments 时必填。先运行 get\_video\_comments，在 Dataset 里找到 has\_replies = true 的一级评论行，复制该行的 comment\_id；不要填评论内容、昵称或其它文本。

## `page_token` (type: `string`):

搜索、评论、评论回复、博主作品列表继续翻页时传入上一页返回的完整 next\_page\_token；第一页留空。auto\_paginate=true 时通常不用手动填写。

## `max_items` (type: `integer`):

最多写入多少条 Dataset item。对搜索、评论、评论回复、博主作品列表用于限制自动翻页结果；对热榜用于限制本次导出的热榜条目数。较大的值可能触发多次 SocialDataX API request。

## `auto_paginate` (type: `boolean`):

开启后 Actor 会按 next\_page\_token 继续请求，直到达到 max\_items 或没有下一页。关闭时只请求当前 page\_token。每翻一页计 1 次 SocialDataX API request。When enabled, each page request counts as one SocialDataX API request.

## Actor input object example

```json
{
  "operation": "search_videos",
  "keyword": "露营",
  "max_items": 50,
  "auto_paginate": true
}
```

# Actor output Schema

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

Open flat result rows written to the default Apify Dataset. Export as JSON, CSV, Excel / XLSX, or JSONL.

## `keyValueStore` (type: `string`):

Open the default key-value store. The OUTPUT record contains operation, item count, request count, page-level response summaries, non-fatal warnings, and lightweight failure details when a run fails.

# 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("socialdatax/socialdatax-kuaishou-data-api").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("socialdatax/socialdatax-kuaishou-data-api").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 '{}' |
apify call socialdatax/socialdatax-kuaishou-data-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=socialdatax/socialdatax-kuaishou-data-api",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/W0cFcwuH7hhObmnwT/builds/JksMKasyUHoxEaCJa/openapi.json
