# Facebook Page Posts & Comments Scraper (`devil_port369-owner/facebook-page-posts-comments-scraper`) Actor

Scrape public Facebook Page, profile, and Group posts with comments and replies. Bulk URLs, date filters, no login. Structured JSON for brand monitoring, sentiment, and research.

- **URL**: https://apify.com/devil_port369-owner/facebook-page-posts-comments-scraper.md
- **Developed by:** [DataFusionX](https://apify.com/devil_port369-owner) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Facebook Page Posts & Comments Scraper

> **Scrape public Facebook posts, comments, and replies without login.**\
> Pages, public profiles, Groups, and single post URLs — bulk targets, date filters, structured JSON/CSV for brand monitoring, sentiment, and research.

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-orange.svg)](https://apify.com)

***

### Overview

The **Facebook Page Posts & Comments Scraper** extracts public timeline posts and their comment threads from Facebook. Paste a Page handle (`ronaldo`), a public profile or Group URL, or a single post/reel/permalink — the Actor resolves the target, paginates posts, and streams **post** and **comment** rows to the dataset.

No Facebook account or cookies are required. Only **public** content visible while logged out is reachable.

**Primary keywords:** facebook posts scraper, facebook comments scraper, facebook page scraper, scrape facebook comments, facebook group posts scraper, facebook post comments export.

***

### Key features

| Feature | Detail |
|--------|--------|
| **No login** | Anonymous GraphQL access to public Pages / Groups / posts |
| **Bulk targets** | Multiple handles and URLs in one run |
| **Posts + comments** | Engagement counts, reaction breakdown, nested replies |
| **Date window** | `afterDate` / `beforeDate` with timezone |
| **Linear or nested output** | One row per post/comment (CRM/CSV-friendly) or nested bundles |
| **Posts-only mode** | Feed inventory without comment cost |
| **Streaming** | Dataset updates as each post finishes |
| **Residential proxy** | Recommended; switch country if a public feed returns empty |

***

### Supported targets

| Target | Example input |
|--------|----------------|
| **Page** | `ronaldo`, `https://www.facebook.com/ronaldo` |
| **Profile** | `profile.php?id=…`, `/people/Name/id/` (if public logged-out) |
| **Group** | `https://www.facebook.com/groups/123…` (public only) |
| **Post** | `/posts/…`, `/permalink/…`, `/reel/…`, `?story_fbid=…`, `pfbid…` |

Private groups, login-gated profiles, and age/geo-restricted posts cannot be scraped anonymously.

***

### Input

#### Example — bulk page feed

```json
{
  "startUrls": ["ronaldo", "https://www.facebook.com/Meta"],
  "maxPosts": 3,
  "maxComments": 100,
  "profile": "tops_only",
  "linearOutput": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

#### Example — date window (maxPosts ignored)

```json
{
  "startUrls": ["yourbrand"],
  "afterDate": "2026-07-31",
  "beforeDate": "2026-08-01",
  "dateTimezone": "+3",
  "profile": "tops_only",
  "maxComments": 500
}
```

#### Example — single post thread

```json
{
  "startUrls": ["https://www.facebook.com/ronaldo/posts/pfbid0…"],
  "maxComments": 200,
  "profile": "default"
}
```

#### Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `startUrls` | string\[] | — | Handles or full Facebook URLs (bulk) |
| `pageOrUrl` | string | — | Optional single target merged into the list |
| `maxPosts` | integer | 3 | Recent posts per feed (ignored for post URLs / date filter) |
| `maxComments` | integer | — | Cap top-level comments per post |
| `profile` | enum | `tops_only` | `tops_only` · `default` · `full_replies` |
| `postsOnly` | boolean | false | Skip comment scraping |
| `linearOutput` | boolean | true | Flat post/comment rows vs nested bundle |
| `includeRepliesInLinear` | boolean | true | Emit replies as comment rows |
| `afterDate` / `beforeDate` | string | — | `YYYY-MM-DD` window |
| `dateTimezone` | string | `UTC` | Timezone for calendar bounds |
| `proxyConfiguration` | object | residential | Apify proxy settings |
| `engine` | enum | `async` | `async` or `threads` |

***

### Output

#### Post row (`type: "post"`)

```json
{
  "type": "post",
  "sourceUrl": "ronaldo",
  "postId": "1234567890",
  "pageName": "Cristiano Ronaldo",
  "text": "Training day…",
  "permalink": "https://www.facebook.com/…",
  "commentCount": 740,
  "reactionCount": 12000,
  "shareCount": 800,
  "reactions": [{ "type": "like", "count": 9000 }, { "type": "love", "count": 2000 }],
  "createdAt": "2026-07-28T12:00:00+00:00",
  "topsScraped": 100,
  "totalScraped": 100,
  "coverage": 0.14,
  "scrapedAt": "2026-11-06T07:00:00+00:00"
}
```

#### Comment row (`type: "comment"`)

```json
{
  "type": "comment",
  "sourceUrl": "ronaldo",
  "postId": "1234567890",
  "commentId": "…",
  "parentCommentId": null,
  "isReply": false,
  "author": "Jane Doe",
  "text": "Legend!",
  "reactionCount": 4,
  "createdAt": "2026-07-28T13:10:00+00:00",
  "scrapedAt": "2026-11-06T07:00:01+00:00"
}
```

Export from the Dataset tab as **JSON**, **CSV**, or **Excel**, or pull via the Apify API / MCP.

***

### How to use

1. Open the Actor on Apify and click **Try for free**.
2. Add one or more Page handles or Facebook URLs under **startUrls**.
3. Set `maxPosts` / `maxComments` (start small on a quiet page to estimate cost).
4. Keep **residential proxy** on; change country if results are empty.
5. Run → open **Dataset** → filter **Posts** / **Comments** views.

#### Runtime notes

- Comment pagination has **no artificial page cap** unless `maxComments` is set. Viral posts take longer and use more proxy bandwidth.
- Measure one post on **your** target before scaling `maxPosts`.
- Empty public feeds are often **proxy country** issues, not Actor bugs.

***

### Use cases

- Brand and competitor Facebook comment monitoring
- Sentiment / VoC pipelines on public threads
- Market research on viral posts
- Group discussion export (public Groups)
- LLM / RAG corpora from public comments

***

### Limitations

- Public content only (no private Groups or login-gated profiles)
- Nested replies are one level deep when enabled
- Facebook may rate-limit or geo-filter; use residential proxies
- GraphQL `doc_id` values can drift; the engine treats them as configurable

***

### FAQ

#### Does this Facebook comments scraper need a login?

No. It uses anonymous access suitable for **public** Pages, Groups, and posts.

#### Can I scrape a Facebook Group?

Yes — **public** Groups only. Private Groups require authentication and are out of scope for this Actor.

#### Why did I get 0 posts?

Common causes: wrong proxy country, private/login-gated target, or a handle that does not resolve logged-out. Try a numeric id, a direct post URL, or another residential country.

#### How is this different from browser scrapers?

It talks to Facebook’s public GraphQL endpoints (same family of queries used by the site), which is typically faster and more stable for comment pagination than pure HTML scraping.

#### Can AI agents run this Actor?

Yes. Use the Apify API, Python/JS SDK, or MCP connector. See **AGENTS.md** for machine-oriented input/output contracts.

***

### Legal

You are responsible for complying with Facebook’s Terms of Service and applicable privacy laws (comment author names are personal data). Use scraped data only with a lawful basis.

# Actor input Schema

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

Facebook handles or full URLs. Accepts Pages (ronaldo), profile links, public Groups, or single post/reel/permalink URLs. Deduplicated automatically.

## `pageOrUrl` (type: `string`):

Optional single handle or URL (merged with startUrls).

## `maxPosts` (type: `integer`):

Recent posts to scrape per Page/profile/Group. Ignored for single post URLs and when afterDate is set.

## `maxComments` (type: `integer`):

Stop comment pagination after N top-level comments per post. Empty = no limit (can be slow on viral posts).

## `profile` (type: `string`):

tops_only = comments without nested replies (faster). default = replies when FB count is under ~1500. full_replies = always fetch replies.

## `postsOnly` (type: `boolean`):

Discover posts with timestamps and engagement counts; do not scrape comment threads.

## `linearOutput` (type: `boolean`):

If enabled, push one dataset row per post and per comment (best for CSV/Excel and CRM). If disabled, push nested post bundles.

## `includeRepliesInLinear` (type: `boolean`):

When linear output is on, also emit nested replies as type=comment with isReply=true.

## `afterDate` (type: `string`):

YYYY-MM-DD. Keep posts from this day onward (inclusive) in dateTimezone. Requires this field when filtering by date.

## `beforeDate` (type: `string`):

YYYY-MM-DD exclusive upper bound in dateTimezone.

## `dateTimezone` (type: `string`):

UTC, +3, +03:00, or IANA name (e.g. Asia/Kathmandu).

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

Residential proxy recommended. If a public target returns 0 posts, change proxy country and retry.

## `engine` (type: `string`):

async (recommended on Apify) or threads.

## `workers` (type: `integer`):

Override concurrent workers from the profile (1–8).

## `replyFbCap` (type: `integer`):

Fetch replies only when Facebook comment_count is below this. 0 = tops only.

## `minIntervalSec` (type: `number`):

Pause between comment page requests per worker.

## `megaThreshold` (type: `integer`):

Pin the heaviest post to a dedicated worker when set.

## Actor input object example

```json
{
  "startUrls": [
    "ronaldo"
  ],
  "pageOrUrl": "",
  "maxPosts": 3,
  "maxComments": 100,
  "profile": "tops_only",
  "postsOnly": false,
  "linearOutput": true,
  "includeRepliesInLinear": true,
  "dateTimezone": "UTC",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "engine": "async",
  "minIntervalSec": 1
}
```

# Actor output Schema

## `results` (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": [
        "ronaldo"
    ],
    "pageOrUrl": "",
    "maxPosts": 3,
    "maxComments": 100,
    "profile": "tops_only",
    "dateTimezone": "UTC"
};

// Run the Actor and wait for it to finish
const run = await client.actor("devil_port369-owner/facebook-page-posts-comments-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 = {
    "startUrls": ["ronaldo"],
    "pageOrUrl": "",
    "maxPosts": 3,
    "maxComments": 100,
    "profile": "tops_only",
    "dateTimezone": "UTC",
}

# Run the Actor and wait for it to finish
run = client.actor("devil_port369-owner/facebook-page-posts-comments-scraper").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": [
    "ronaldo"
  ],
  "pageOrUrl": "",
  "maxPosts": 3,
  "maxComments": 100,
  "profile": "tops_only",
  "dateTimezone": "UTC"
}' |
apify call devil_port369-owner/facebook-page-posts-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devil_port369-owner/facebook-page-posts-comments-scraper"
        }
    }
}
```

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/PmadrhruAET7SqDqz/builds/UBNlkQmPH5o1cc7Ii/openapi.json
