# 微信视频号 / WeChat Channels API - 视频搜索、评论 / comments、用户数据 (`socialdatax/socialdatax-wechat-data-api`) Actor

社媒数据助手 SocialDataX 提供的只读微信视频号 / WeChat Channels data API，支持热搜 / hot list、视频搜索 / video search、视频详情 / video details、评论 / comments、评论回复 / comment replies、用户资料 / creator profiles 和用户视频列表 / creator videos。

- **URL**: https://apify.com/socialdatax/socialdatax-wechat-data-api.md
- **Developed by:** [SocialDataX](https://apify.com/socialdatax) (community)
- **Categories:** Social media, Videos, Developer tools
- **Features:** Limited permissions
- **Stats:** 121 total users, 14 monthly users, 99.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 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/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

## 微信视频号 / WeChat Channels API - 视频搜索、评论 / comments、用户数据

这是社媒数据助手 SocialDataX 的 Apify Actor 适配层，提供只读微信视频号 / WeChat Channels data API，面向 WeChat Channels video search / 视频号搜索、WeChat Channels comments / 视频号评论、作品详情、用户资料、用户作品列表和 Dataset export 场景。

用户在 Apify 上运行时不需要配置 SocialDataX API Key。API Key 由 SocialDataX 在 Actor 环境中配置。

用户作品列表的 `is_pinned` 表示该作品是否在此用户主页置顶（`true` / `false`），可在 Overview 和作品列表视图查看；字段缺失时表示接口未提供，不能据此确认作品未置顶。Actor 保留接口返回的顺序和分页。

### Support / 联系我们

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

- Website: <https://socialdatax.com/ai?from=apify>

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

- Website: <https://socialdatax.com/ai?from=apify>

### 支持能力 / Operations

- 视频号用户搜索 / Channels user search

- 热搜 / hot list

- 视频搜索 / video search

- 作品详情（视频或图文） / work details

- 评论列表 / comments

- 评论回复 / comment replies

- 用户资料 / creator profile

- 用户作品列表（含视频和图文） / creator works

默认 operation 是 `search_videos`，默认关键词是 `露营`。

### 输入字段 / Input

| Operation | 必填字段 | 可选字段 | 说明 |
| --- | --- | --- | --- |
| `search_users` | `keyword` | `page_token`, `max_items`, `auto_paginate` | 按昵称、关键词或视频号 ID 搜索用户；返回 `user_id`, `name`, `avatar_url`, `bio`，可用 `user_id` 查询资料或作品。 |
| `search_hot_list` | 无 | `max_items` | 获取微信视频号热榜数据，请求一次并按 `max_items` 限制写入 Dataset。 |
| `search_videos` | `keyword` | `sort_type`, `duration_range`, `page_token`, `max_items`, `auto_paginate` | 按关键词搜索视频号内容，默认自动翻页直到达到 `max_items`。 |
| `get_video_detail` | `url` 或 `encrypted_object_id` | 无 | 获取单条作品详情（视频或图文）；只能二选一，不要两个都填。 |
| `get_video_comments` | `url` 或 `object_id + object_nonce_id` | `page_token`, `max_items`, `auto_paginate` | 获取一级评论列表；只能二选一，不要同时填视频链接和 ID 组合。 |
| `get_video_comment_replies` | `object_id`, `object_nonce_id`, `comment_id` | `page_token`, `max_items`, `auto_paginate` | 获取一级评论下的回复。先运行评论列表，从 Dataset 行里复制真实 ID。 |
| `get_user_info` | `user_id` | 无 | 获取微信视频号用户资料。`user_id` 应以 `@finder` 结尾。 |
| `list_user_videos` | `user_id` 或 `url` | `page_token`, `max_items`, `auto_paginate` | 获取用户发布作品列表（含视频和图文）。 |

#### 字段提示

- `keyword`: 用于 `search_videos` 和 `search_users`，默认示例是 `露营`。
- `url`: 作品链接或分享文案可用于作品详情和用户作品列表；评论列表使用视频链接或对应分享文案。
- `encrypted_object_id`: 从 `search_videos` 的 Dataset 行复制，用于 `get_video_detail`。
- `object_id` / `object_nonce_id`: 从 `get_video_detail` 或评论 Dataset 行复制，用于评论和评论回复。
- `comment_id`: 从 `get_video_comments` Dataset 行复制一级评论 ID。建议选择 `reply_count > 0` 的评论。
- `user_id`: 只填以 `@finder` 结尾的视频号用户 ID；不要填昵称、主页名称或 `@stranger` ID。
- `sort_type`: `all`、`time_descending`、`collect_count_descending`。
- `duration_range`: `all`、`under_5_min`、`between_5_and_20_min`、`over_20_min`。
- `max_items`: 默认 `50`，最大 `1000`。
- `auto_paginate`: 默认 `true`。每请求一页会计为 1 次 SocialDataX API request。

### 示例 / Examples

视频号用户搜索 / Channels user search:

```json
{
  "operation": "search_users",
  "keyword": "露营",
  "max_items": 10
}
```

视频搜索：

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

热榜：

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

作品详情：

```json
{
  "operation": "get_video_detail",
  "url": "https://weixin.qq.com/sph/ANxgB9MB8i"
}
```

评论列表：

```json
{
  "operation": "get_video_comments",
  "url": "https://weixin.qq.com/sph/ANxgB9MB8i",
  "page_token": "",
  "max_items": 20,
  "auto_paginate": true
}
```

评论回复：

```json
{
  "operation": "get_video_comment_replies",
  "object_id": "14469096051103173201",
  "object_nonce_id": "4041472331870621547_0_39_0_0",
  "comment_id": "14608046980043114941",
  "page_token": "",
  "max_items": 20,
  "auto_paginate": true
}
```

用户资料：

```json
{
  "operation": "get_user_info",
  "user_id": "v2_060000231003b20faec8c5e58110c0dcc90cee33b0777dd2f17b0e35693b274a9dd455cde24f@finder"
}
```

用户作品列表：

```json
{
  "operation": "list_user_videos",
  "url": "https://weixin.qq.com/sph/ANxgB9MB8i",
  "page_token": "",
  "max_items": 20,
  "auto_paginate": true
}
```

### 输出 / Dataset

主要消费面是 Apify Dataset。列表类 operation 会把每个 item 写成一行，适合 JSON、CSV、Excel / XLSX、JSONL 导出。

行结构是扁平字段：

- `operation`, `item_index`
- `query_*`: 本次请求参数
- `page_*`: 页级分页和统计信息
- item 顶层字段，例如 `object_id`, `description`, `comment_id`, `like_count`
- `author_*`, `video_*`: 常见对象字段展开
- `topic_tags`, `images`: 数组字段保留 JSON 值

示例 Dataset row：

```json
{
  "operation": "get_video_comments",
  "item_index": 1,
  "query_object_id": "14469096051103173201",
  "query_object_nonce_id": "4041472331870621547_0_39_0_0",
  "comment_id": "14608046980043114941",
  "content": "这个路线不错",
  "author_user_id": "v2_...@finder",
  "author_name": "示例用户",
  "reply_count": 2,
  "page_next_page_token": ""
}
```

`OUTPUT` 只保留 run summary、请求页摘要、warning 或轻量错误信息，方便调试；完整结果请从 Dataset 读取。

### Apify API 调用

同步运行并直接取 Dataset items：

```bash
curl -X POST "https://api.apify.com/v2/acts/socialdatax~socialdatax-wechat-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("YOUR_APIFY_TOKEN")
run = client.actor("socialdatax/socialdatax-wechat-data-api").call(run_input={
    "operation": "search_videos",
    "keyword": "露营",
    "max_items": 20,
    "auto_paginate": True,
})

items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(items[:3])
```

### 计费 / Pricing

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

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

# Actor input Schema

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

先选择要调用的微信视频号 / WeChat Channels 数据能力，然后只填写该 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_users 时必填；用户搜索支持昵称、关键词或视频号 ID。Search videos or Channels users by keyword; user search also accepts a Channels ID.

## `sort_type` (type: `string`):

仅 operation=search_videos 时使用。all=综合，time_descending=最新优先，collect_count_descending=收藏数优先。

## `duration_range` (type: `string`):

仅 operation=search_videos 时使用。all=全部，under_5_min=5 分钟以下，between_5_and_20_min=5-20 分钟，over_20_min=20 分钟以上。

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

operation=get_video_detail、list_user_videos 时可粘贴微信视频号视频或图文链接或分享文案；get_video_comments 只支持视频链接。详情接口不要同时传 url 和 encrypted_object_id；评论接口不要同时传 url 和 object_id + object_nonce_id。

## `encrypted_object_id` (type: `string`):

operation=get_video_detail 时可使用；从 search_videos Dataset 行里的 encrypted_object_id 复制。不要和 url 同时填写。

## `object_id` (type: `string`):

operation=get_video_comments、get_video_comment_replies 时使用；与同一条视频的 object_nonce_id 一起从 get_video_detail 或评论 Dataset 行中复制。评论回复不支持 url 或 encrypted_object_id。

## `object_nonce_id` (type: `string`):

operation=get_video_comments、get_video_comment_replies 时使用；必须和同一条视频的 object_id 配对原样传入。

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

仅 operation=get_video_comment_replies 时必填。先运行 get_video_comments，在 Dataset 里找到 reply_count > 0 的一级评论行，复制该行的 comment_id；不要填评论内容、昵称或回复项 ID。

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

operation=get_user_info、list_user_videos 时使用。只支持以 @finder 结尾的微信视频号用户 ID；可从作品详情、评论、评论回复或用户作品列表 Dataset 行里的 author_user_id / user_id 复制。不要填昵称、主页名称或 @stranger 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": "露营",
  "sort_type": "all",
  "duration_range": "all",
  "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-wechat-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-wechat-data-api").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 socialdatax/socialdatax-wechat-data-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,socialdatax/socialdatax-wechat-data-api"
        }
    }
}
```

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/9unGLordk5LcQ9Wd9/builds/VWPqYWT4b2ubcGrSg/openapi.json
