# Facebook 帖子与评论抓取器｜小组与主页 (`spbotdel/facebook-group-posts-comments-cn`) Actor

无需登录或 Cookie，抓取 Facebook 小组、主页和个人主页的公开帖子、评论与回复。获取作者、时间、互动、媒体、固定链接与覆盖率诊断，支持 API、MCP、定时任务、JSON、CSV、Excel 与 AI 工作流。

- **URL**: https://apify.com/spbotdel/facebook-group-posts-comments-cn.md
- **Developed by:** [Sergei Belostotskii](https://apify.com/spbotdel) (community)
- **Categories:** Social media, Agents, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## Facebook 帖子与评论抓取器｜小组与主页

**无需登录、无需 Cookie、无需浏览器，即可抓取 Facebook 小组、主页和个人主页的公开帖子、评论与回复。**

Actor 会在同一次运行内抓取帖子并补充评论和回复线程，输出一个结构化数据集。可以选择嵌套模式（每条帖子包含评论数组）或分行模式（帖子和评论各占一行），适合导出 JSON、CSV、Excel，或直接接入 API、MCP、定时任务、Webhook 和 AI 工作流。

### 可以抓取哪些数据

- 小组、主页、个人主页的公开帖子。
- 帖子正文、作者、时间、互动、媒体和固定链接。
- 评论和回复原文、作者、时间、互动、回复线程和父评论 ID。
- 每条帖子的覆盖诊断：显示数量、实际抓取数量、覆盖率、是否被登录墙限制。

### 适用场景

- 社群监控、舆情分析、品牌监测。
- 竞品帖子与评论对比。
- 内容运营、线索整理、客服沉淀。
- AI、RAG 和代理工作流的数据采集。

### 支持的 Facebook 页面

- 公开小组。
- 公共主页。
- 公开个人主页。

不访问私密内容，不支持 Marketplace 列表，也不需要 Facebook 登录。

### 输出模式

- `nested`：一条数据集行对应一条帖子，评论嵌套在 `comments` 数组中，适合 AI 和上下文分析。
- `separate`：帖子和评论分行输出，适合 CSV、Excel、BI 和数据表关联。

两种模式的计费相同，按实际返回的帖子和评论数量计算，不按数据集行数重复收费。

### 计费

- BRONZE 及以上：每 1000 条帖子 `$3`，每 1000 条评论 `$1`。
- FREE：事件价格为 BRONZE 的两倍。
- 每次启动 `$0.005`。

计费发生在结果成功写入数据集之后，而不是启动时。

### Agent 与 MCP

Actor 支持通过 Apify MCP Server 调用。Agent 可以发现 Actor、读取输入和输出 schema、启动运行并读取数据集结果。`SUMMARY` 记录会返回抓取数量、覆盖率、预算和停止原因，适合自动判断是否需要续跑。

### 快速开始

```json
{
  "startUrls": [
    { "url": "https://www.facebook.com/groups/2333220550043074/" }
  ],
  "maxPostsPerGroup": 10,
  "commentsMode": "full",
  "maxCommentsPerPost": 50,
  "includeReplies": true
}
```

### 关键字

Facebook 小组抓取器，Facebook 帖子评论，Facebook 公开评论，Facebook 评论监控，Facebook 数据导出，Facebook AI 数据集，无需登录 Facebook 抓取，Facebook API 数据

# Actor input Schema

## `startUrls` (type: `array`):

Public Facebook group, page, or personal profile URLs. Group URLs and /people/ profile URLs are auto-detected; set userData.surfaceType for ambiguous handles. Large URL lists are processed in batches without silent truncation.

## `maxPostsPerGroup` (type: `integer`):

Maximum posts to collect from each group, page, or profile before comment enrichment. A run charge limit can reduce this value to keep collection within maxTotalChargeUsd.

## `sortMode` (type: `string`):

Facebook group feed order. Pages and personal profiles use newest-first feeds; CHRONOLOGICAL is recommended for group monitoring.

## `onlyPostsNewerThan` (type: `string`):

Inclusive lower date boundary. Supports ISO dates and relative values such as 30 days or 2 weeks.

## `onlyPostsOlderThan` (type: `string`):

Exclusive upper date boundary: posts exactly at the boundary are excluded. Combine with onlyPostsNewerThan for a closed date range.

## `knownPostIds` (type: `array`):

Post IDs already stored by your pipeline. In chronological mode the feed can stop at a known post.

## `search` (type: `string`):

Case-insensitive post text filter applied before comment enrichment. Use searchMode=HISTORY_SCAN to scan history up to searchMaxPostsPerSurface instead of only filtering the latest feed snapshot.

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

LOCAL filters the normal latest-post snapshot. HISTORY_SCAN walks backward through the public feed up to searchMaxPostsPerSurface and returns up to maxSearchResults matching posts. Facebook's signed-out search page requires login, so this is the no-cookie historical-search equivalent.

## `searchMaxPostsPerSurface` (type: `integer`):

Maximum public posts walked per group, page, or profile when searchMode=HISTORY_SCAN.

## `maxSearchResults` (type: `integer`):

Maximum matching posts returned when searchMode=HISTORY_SCAN.

## `minComments` (type: `integer`):

Keep posts whose feed metadata reports at least this many comments. Posts with unknown engagement are kept.

## `minReactions` (type: `integer`):

Keep posts whose feed metadata reports at least this many reactions. Posts with unknown engagement are kept.

## `filterAuthor` (type: `string`):

Case-insensitive substring match against the public post author name or profile URL.

## `startCursor` (type: `string`):

Cursor from a previous run's SUMMARY for an older-history backfill. Supported when startUrls contains exactly one group, page, or profile.

## `commentsMode` (type: `string`):

none: posts only. inline: up to 3 comments per post. full: collect full public comment threads with the configured limits.

## `maxCommentsPerPost` (type: `integer`):

Maximum comment and reply rows collected for each post in full mode. Inline mode is capped at 3.

## `includeReplies` (type: `boolean`):

Expand public reply threads during full comment collection.

## `maxReplyThreadsPerPost` (type: `integer`):

Maximum reply-bearing top-level comments to expand per post.

## `maxRepliesPerPost` (type: `integer`):

Maximum reply rows collected per post in full mode.

## `commentsConcurrency` (type: `integer`):

How many posts the comment engine processes in parallel.

## `commentsSortOrder` (type: `string`):

Facebook comment order used by the comment engine.

## `unionSorts` (type: `boolean`):

Walk both relevant and newest comment windows to improve public coverage.

## `onlyCommentsNewerThan` (type: `string`):

Keep comments newer than an absolute date or relative value such as 30 days, 12 hours, or 2 weeks.

## `commentTextSearch` (type: `string`):

Case-insensitive local filter over returned comment and reply text. It filters publicly collected comments and does not bypass signed-out Facebook limits.

## `minCommentReactions` (type: `integer`):

Keep comments and replies with at least this many reactions.

## `includePostTextInCommentRows` (type: `boolean`):

Include post_text in each returned comment row, including separate output mode.

## `commentsOutput` (type: `string`):

nested stores comments inside each post row. separate emits post rows and comment rows separately.

## `proxyTier` (type: `string`):

Proxy behavior forwarded to the underlying group and comment engines.

## `proxyCountry` (type: `string`):

Two-letter country code forwarded to page/profile engines.

## `dedupeStoreName` (type: `string`):

Stable logical Key-Value Store name used to return only new comments across scheduled runs. It is namespaced per Apify user internally, and the effective internal name is reported in SUMMARY.

## `failOnEmpty` (type: `boolean`):

Mark the run failed when no posts are selected, or when no final output rows are produced. An existing post with zero public comments is still a valid output row.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.facebook.com/groups/1564552680458634/"
    }
  ],
  "maxPostsPerGroup": 30,
  "sortMode": "CHRONOLOGICAL",
  "searchMode": "LOCAL",
  "searchMaxPostsPerSurface": 300,
  "maxSearchResults": 100,
  "minComments": 0,
  "minReactions": 0,
  "commentsMode": "full",
  "maxCommentsPerPost": 50,
  "includeReplies": true,
  "maxReplyThreadsPerPost": 20,
  "maxRepliesPerPost": 100,
  "commentsConcurrency": 5,
  "commentsSortOrder": "MOST_RELEVANT",
  "unionSorts": true,
  "minCommentReactions": 0,
  "includePostTextInCommentRows": false,
  "commentsOutput": "nested",
  "proxyTier": "auto",
  "proxyCountry": "US",
  "failOnEmpty": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {
    "startUrls": [
        {
            "url": "https://www.facebook.com/groups/1564552680458634/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("spbotdel/facebook-group-posts-comments-cn").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 = { "startUrls": [{ "url": "https://www.facebook.com/groups/1564552680458634/" }] }

# Run the Actor and wait for it to finish
run = client.actor("spbotdel/facebook-group-posts-comments-cn").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 '{
  "startUrls": [
    {
      "url": "https://www.facebook.com/groups/1564552680458634/"
    }
  ]
}' |
apify call spbotdel/facebook-group-posts-comments-cn --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,spbotdel/facebook-group-posts-comments-cn"
        }
    }
}
```

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/GP6xGEeIpCM24aY6I/builds/ApAO8ofRHZuFmiL0A/openapi.json
