# 微信公众号 API | WeChat Articles, Comments & Profiles (`socialdatax/socialdatax-wechat-mp-data-api`) Actor

SocialDataX 微信公众号文章搜索、正文、账号资料与历史文章、阅读点赞统计、评论与回复。WeChat Official Account API: article search, full text, metrics, profiles and comments. 无需配置 API Key。

- **URL**: https://apify.com/socialdatax/socialdatax-wechat-mp-data-api.md
- **Developed by:** [SocialDataX](https://apify.com/socialdatax) (community)
- **Categories:** Social media
- **Stats:** 3 total users, 2 monthly users, 20.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 1,000 article or comments

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

## 微信公众号 API | WeChat Official Account Data

Search WeChat Official Account (微信公众号 / WeChat MP) articles, read article content, explore account profiles and article lists, and retrieve engagement statistics, comments and replies. No API key is required on Apify.

This Actor covers Official Accounts. For WeChat Channels / 视频号 videos, use the separate [WeChat Channels Actor](https://apify.com/socialdatax/socialdatax-wechat-data-api).

### Operations and pricing

Each exported Dataset row is one result. Article search, account article lists and top-level comments cost **$4.99 per 1,000 results**; article detail, statistics, account profiles and comment replies cost **$19.99 per 1,000 results**. Each run has a **$0.00005 startup fee**. There are no plan-based discounts.

| Operation | Required input | Result | Price per 1,000 results |
| --- | --- | --- | ---: |
| `search_articles` | `keyword` | Article search results | $4.99 |
| `list_account_articles` | `account_id` | Account articles | $4.99 |
| `get_article_comments` | `url` | Top-level comments | $4.99 |
| `get_article_detail` | `url` | One article detail record | $19.99 |
| `get_article_stats` | `url` | One statistics record | $19.99 |
| `get_account_info` | `account_id` | One account profile | $19.99 |
| `get_comment_replies` | `url`, `comment_id` | Individual replies | $19.99 |

For example, 20 article search rows cost $0.0998 plus the startup fee. One article detail record costs $0.01999 plus the startup fee. Failed requests and empty lists do not generate result charges; the startup fee still applies. If a later page returns an upstream error, the run fails before exporting its collected results. If the free trial quota is exhausted during pagination, the Actor stops with a warning and exports the results from earlier successful pages; those exported rows count as result events.

Free Apify accounts have a limited trial under the existing SocialDataX trial quota. Apify credits and that trial quota are separate limits. Upgrade to a paid Apify plan when the trial is exhausted.

### Quick start

```json
{
  "operation": "search_articles",
  "keyword": "量子位",
  "max_items": 20,
  "auto_paginate": true
}
```

Copy an `article_url` from the search results into `url` for article detail, statistics or comments. Copy the article detail's `account_account_id` into `account_id` for account information or article lists. For replies, copy `comment_id` from a top-level comment and keep the same article URL. IDs should be strings. The Actor requires an explicit comment ID and does not choose a comment automatically.

Search supports `sort_type` (`general`, `time_descending`, `hot`) and `publish_time_range` (`all`, `day`, `week`, `half_year`). Availability and ordering depend on the source.

### Pagination and output

`max_items` limits exported rows (default 20, maximum 1,000). `auto_paginate` follows continuation tokens for search, account articles, comments and replies. Set it to `false` for one page. Pass the returned `page_next_page_token` as `page_token` with the same operation and query to continue.

If `max_items` or the run's spending limit cuts a page short, its continuation token starts after that entire page. Increase the limit to retain the remaining entries; it cannot resume within a page. The Actor stops at repeated cursors or 100 page requests.

Results are available as JSON, CSV and Excel. Account and author fields are flattened for tables. The `OUTPUT` record includes request and item counts, pagination summaries and warnings. Empty results are possible; deleted articles, unavailable comments and upstream failures can prevent a result. A successful sample is not a guarantee that every article or account is available.

### Support

[Contact SocialDataX / 社媒数据助手](https://socialdatax.com/ai?from=apify) with the Actor run URL and operation.

### Examples for all operations

These inputs use publicly accessible articles and accounts from validation. Availability can change. List examples export at most 3 rows and do not auto-paginate. Replace the article URL or account ID for your own query.

#### 微信公众号文章搜索 | WeChat Article search

```json
{
  "operation": "search_articles",
  "keyword": "量子位",
  "max_items": 3,
  "auto_paginate": false
}
```

#### 微信公众号文章正文 | WeChat Article content

```json
{
  "operation": "get_article_detail",
  "url": "http://mp.weixin.qq.com/s?__biz=MzIzNjc1NzUzMw==&mid=2247934549&idx=1&sn=a4f6350aaa5fe1caf0410edcbcf48c44&chksm=e90b98c7b69d3142d2a0ea4dbb33ebb364054f57e2b49c809be823ec09bd9389ad877c4a6c91#rd"
}
```

#### 微信公众号账号资料 | WeChat Account profile

```json
{
  "operation": "get_account_info",
  "account_id": "gh_114e76fd6e5d"
}
```

#### 微信公众号账号文章 | WeChat Account articles

```json
{
  "operation": "list_account_articles",
  "account_id": "gh_114e76fd6e5d",
  "max_items": 3,
  "auto_paginate": false
}
```

#### 微信公众号阅读点赞统计 | WeChat Article statistics

```json
{
  "operation": "get_article_stats",
  "url": "http://mp.weixin.qq.com/s?__biz=MzIzNjc1NzUzMw==&mid=2247934549&idx=1&sn=a4f6350aaa5fe1caf0410edcbcf48c44&chksm=e90b98c7b69d3142d2a0ea4dbb33ebb364054f57e2b49c809be823ec09bd9389ad877c4a6c91#rd"
}
```

#### 微信公众号一级评论 | WeChat Article comments

```json
{
  "operation": "get_article_comments",
  "url": "http://mp.weixin.qq.com/s?__biz=MzIzNjc1NzUzMw==&mid=2247934549&idx=1&sn=a4f6350aaa5fe1caf0410edcbcf48c44&chksm=e90b98c7b69d3142d2a0ea4dbb33ebb364054f57e2b49c809be823ec09bd9389ad877c4a6c91#rd",
  "max_items": 3,
  "auto_paginate": false
}
```

#### 微信公众号评论回复 | WeChat Comment replies

```json
{
  "operation": "get_comment_replies",
  "url": "https://mp.weixin.qq.com/s?__biz=MzIzNjc1NzUzMw==&mid=2247934549&idx=1&sn=a4f6350aaa5fe1caf0410edcbcf48c44&chksm=e90b98c7b69d3142d2a0ea4dbb33ebb364054f57e2b49c809be823ec09bd9389ad877c4a6c91#rd",
  "comment_id": "5215698530668124113",
  "max_items": 3,
  "auto_paginate": false
}
```

# Actor input Schema

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

选择公众号文章、账号、统计或评论操作；所需参数与价格见 README。

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

公众号文章搜索词或关键词短语；例如量子位、人工智能。不要传文章链接或公众号账号 ID。

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

分页令牌，首次留空；手动续页使用 Dataset 的 page_next_page_token，并保持操作、查询词、筛选项、账号或文章及评论 ID 不变。

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

排序方式：general（综合/相关性，默认）、time_descending（最新发布）、hot（最热，顺序以平台结果为准）。

## `publish_time_range` (type: `string`):

发布时间范围：all（不限，默认）、day（最近一天）、week（最近七天）、half_year（最近半年）。

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

文章详情、统计、评论和回复所用的微信公众号文章链接。

## `account_id` (type: `string`):

账号资料、账号文章操作必填；复制文章详情 Dataset 中的 account_account_id。

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

评论回复操作必填：复制一级评论结果中的 comment_id，并与原文章链接一起使用。

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

列表总导出上限；详情与资料最多1条。仅成功写入 Dataset 的结果按条计费，另有启动费。

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

有分页能力时自动续页，直到达到上限或令牌为空；空页有令牌仍会继续。无分页能力的操作只请求一次。

## Actor input object example

```json
{
  "operation": "search_articles",
  "keyword": "量子位",
  "max_items": 20,
  "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 = {
    "keyword": "量子位"
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialdatax/socialdatax-wechat-mp-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 = { "keyword": "量子位" }

# Run the Actor and wait for it to finish
run = client.actor("socialdatax/socialdatax-wechat-mp-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 '{
  "keyword": "量子位"
}' |
apify call socialdatax/socialdatax-wechat-mp-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-mp-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/ifSzlmFTHgVlc1vwt/builds/uG3eAykRWdcX3gnX5/openapi.json
