# Facebook Comments Scraper (`crawlerbros/facebook-comments-scraper`) Actor

Scrape public comments from Facebook posts, Watch videos, and photo stories. Extract comment text, author info, reactions, timestamps, and nested replies via GraphQL pagination.

- **URL**: https://apify.com/crawlerbros/facebook-comments-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Social media, Developer tools, Other
- **Stats:** 238 total users, 19 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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?

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

## Facebook Comments Scraper

Extract public comments from Facebook posts, Reels, Watch videos, and photo stories. Get comment text, author info, reactions, timestamps, and nested reply threads — no login or cookies required.

### Features

- Scrape comments from any public Facebook post, Watch video, or page video
- Support for group posts, shared posts, and page video URLs
- Three comment sorting modes: All, Newest, or Most Relevant
- Nested reply extraction with full parent/reply threading metadata
- Author details: name, profile picture, profile URL, ID
- Reaction counts and reply counts per comment
- ISO 8601 timestamps
- Anti-blocking: headless Chromium browser, residential proxy support, request delays
- Export to JSON, CSV, Excel, or XML

### Input

| Field                   | Type     | Required | Default     | Description                                                                                                       |
| ----------------------- | -------- | -------- | ----------- | ----------------------------------------------------------------------------------------------------------------- |
| Start URLs              | string\[] | Yes      | —           | Facebook post, Reel, Watch, or photo URLs to scrape comments from                                                 |
| Max items per URL       | integer  | No       | 100         | Maximum number of comments to collect per URL                                                                     |
| Comments mode           | string   | No       | ALL         | Sort order: `ALL` (Facebook's unfiltered "All comments" view, ranked ordering), `NEWEST` (newest first), or `MOST_RELEVANT` (Facebook's ranked "Most relevant" view) |
| Include nested comments | boolean  | No       | true        | Also scrape reply threads under top-level comments                                                                |
| Max reply nesting depth  | integer  | No       | 1           | How many levels of nested replies to follow (1 = direct replies only) |
| Only comments newer than | string   | No       | —           | Date filter: `YYYY-MM-DD`, full ISO 8601, or relative (`1 day`, `2 months`, `1 year`) |
| Proxy Configuration     | object   | No       | Residential | Proxy settings. Residential IPs strongly recommended                                                              |

#### Supported URL Formats

- **Posts**: `https://www.facebook.com/PageName/posts/1234567890`
- **Posts (pfbid)**: `https://www.facebook.com/PageName/posts/pfbid0...`
- **Reels**: `https://www.facebook.com/reel/1234567890` *(requires login — not supported)*
- **Watch videos**: `https://www.facebook.com/watch?v=1234567890`
- **Photos**: `https://www.facebook.com/photo?fbid=1234567890`
- **Photo (legacy)**: `https://www.facebook.com/photo.php?fbid=1234567890`
- **Group posts**: `https://www.facebook.com/groups/groupname/permalink/1234567890/`
- **Page videos**: `https://www.facebook.com/PageName/videos/1234567890`
- **Shared posts**: `https://www.facebook.com/share/p/abc123/`

#### Example Input

```json
{
  "startUrls": [
    { "url": "https://www.facebook.com/NASA/posts/1234567890" },
    { "url": "https://www.facebook.com/reel/9876543210" }
  ],
  "maxItems": 200,
  "commentsMode": "MOST_RELEVANT",
  "includeNestedComments": true,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

### Output

Each comment record contains the following fields:

| Field              | Type    | Description                                                      |
| ------------------ | ------- | ---------------------------------------------------------------- |
| `facebookUrl`      | string  | Canonical URL of the post                                        |
| `commentUrl`       | string  | Direct permalink to the comment                                  |
| `commentId`        | string  | Legacy numeric comment ID                                        |
| `id`               | string  | Internal relay ID                                                |
| `feedbackId`       | string  | Feedback ID for the comment                                      |
| `date`             | string  | Comment timestamp (ISO 8601)                                     |
| `text`             | string  | Full comment text                                                |
| `profilePicture`   | string  | Author's profile picture URL                                     |
| `profileId`        | string  | Author's numeric profile ID                                      |
| `profileName`      | string  | Author's display name                                            |
| `profileUrl`       | string  | Author's profile URL                                             |
| `likesCount`       | integer | Number of reactions on the comment                               |
| `threadingDepth`   | integer | 0 = top-level comment, 1+ = reply depth                         |
| `commentsCount`    | integer | Number of replies (0 for replies themselves)                     |
| `facebookId`       | string  | Post/story ID                                                    |
| `inputUrl`         | string  | Original URL provided in input                                   |
| `replyToCommentId` | string  | Parent comment legacy ID (empty string for top-level comments)   |
| `postTitle`        | string  | Post title extracted from page metadata (empty if not available) |
| gender             | string  | Author's gender if Facebook exposes it (empty if not available) |
| spamDisplayMode    | string  | Facebook's own spam classification for the comment (e.g. "none") |
| isDisabled         | boolean | Whether the comment has been hidden/removed by moderation        |
| isHiddenByViewer   | boolean | Whether the comment is hidden specifically from the current viewer |
| reactionBreakdown  | object  | Per-reaction-type counts (like/love/care/haha/wow/sad/angry/other), omitted for comments with zero reactions |
| groupCommentInfo   | object  | Group post metadata (groupId, isAuthorAnonymous, isAuthorNickname, isAuthorWithMemberProfile) — present only on group-post comments |

#### Example Output

**Top-level comment:**

```json
{
  "facebookUrl": "https://www.facebook.com/NASA/posts/pfbid025kwyoB...",
  "commentUrl": "https://www.facebook.com/NASA/posts/pfbid025kwyoB...?comment_id=809453025548580",
  "commentId": "809453025548580",
  "id": "Y29tbWVudDoxNDg3...",
  "feedbackId": "ZmVlZGJhY2s6MTQ4...",
  "date": "2026-03-26T23:31:17.000Z",
  "text": "Ah I remember the moon landing of 1969 on the eve of my 9th birthday!",
  "profilePicture": "https://scontent.xx.fbcdn.net/v/...",
  "profileId": "pfbid0248UufsteCx...",
  "profileName": "Gwen Weidell",
  "profileUrl": "https://www.facebook.com/gwen.weidell.9",
  "likesCount": 26,
  "threadingDepth": 0,
  "commentsCount": 2,
  "replyToCommentId": "",
  "facebookId": "1487017912793580",
  "inputUrl": "https://www.facebook.com/NASA/posts/pfbid025kwyoB...",
  "postTitle": "Our Artemis II crew will be the first to fly around the Moon in more than 50 years...",
  "gender": "FEMALE",
  "spamDisplayMode": "none",
  "isDisabled": false,
  "isHiddenByViewer": false,
  "reactionBreakdown": {
    "like": 18,
    "love": 6,
    "care": 1,
    "haha": 1
  }
}
```

**Reply to a comment (threadingDepth 1):**

```json
{
  "facebookUrl": "https://www.facebook.com/NASA/posts/pfbid025kwyoB...",
  "commentUrl": "https://www.facebook.com/NASA/posts/pfbid025kwyoB...?comment_id=810234567890123",
  "commentId": "810234567890123",
  "id": "Y29tbWVudDo4MDk0...",
  "feedbackId": "ZmVlZGJhY2s6ODA5...",
  "date": "2026-03-26T15:10:22.000Z",
  "text": "Totally agree with you!",
  "profilePicture": "https://scontent.xx.fbcdn.net/v/...",
  "profileId": "100012345678901",
  "profileName": "John Doe",
  "profileUrl": "https://www.facebook.com/john.doe",
  "likesCount": 2,
  "threadingDepth": 1,
  "commentsCount": 0,
  "replyToCommentId": "809453025548580",
  "facebookId": "1487017912793580",
  "inputUrl": "https://www.facebook.com/NASA/posts/pfbid025kwyoB...",
  "postTitle": "Our Artemis II crew will be the first to fly around the Moon in more than 50 years...",
  "gender": "MALE",
  "spamDisplayMode": "none",
  "isDisabled": false,
  "isHiddenByViewer": false,
  "reactionBreakdown": {
    "like": 2
  }
}
```

### Use Cases

- **Brand monitoring** — Track what people say about your brand on Facebook posts
- **Market research** — Analyze audience sentiment and topics in post comments
- **Content analysis** — Study engagement patterns across different types of posts
- **Community insights** — Understand audience reactions to news, announcements, or campaigns
- **Competitor analysis** — Monitor comments on competitor pages and posts
- **Lead generation** — Identify engaged users from comment activity

### Tips for Best Results

1. **Use residential proxies for higher-volume runs** — recommended for reliability at scale; occasional/low-volume runs against posts or videos work fine without one
2. **Start with fewer URLs** — Test with 1-2 URLs first, then scale up
3. **Public posts only** — The scraper can only access comments on public posts accessible without login
4. **Comment limits** — Set `maxItems` per URL to control costs and runtime. Each URL fetches up to the specified limit

### Limitations

- Only public posts are supported. Private, friends-only, or restricted posts cannot be accessed
- **Reels require Facebook login** — Reels (`/reel/` URLs) are not accessible without a Facebook session. Use post or video URLs instead
- Facebook may occasionally block requests at higher volume — use residential proxies and keep request rate low if you hit blocks
- Comment ordering depends on Facebook's API. The `MOST_RELEVANT` mode uses Facebook's own ranking algorithm
- Some older posts may have limited data availability
- Nested reply depth is limited to what Facebook's API returns (typically 1-2 levels)

### FAQ

**Q: Do I need a Facebook account or cookies to use this scraper?**
A: No. The scraper works with public posts and videos without any login or authentication. The only exception is Reels, which Facebook requires login to access.

**Q: Can I scrape comments from Facebook Reels?**
A: No. Facebook Reels require login to view, which this scraper does not support. Use the post URL or video URL format instead.

**Q: Why are some comments missing?**
A: Facebook may restrict access to certain comments based on privacy settings, regional blocking, or content moderation. Only publicly visible comments can be scraped.

**Q: What happens if Facebook blocks my requests?**
A: The scraper includes automatic retry logic and uses a headless Chromium browser to bypass anti-bot protections. Using residential proxies significantly reduces blocking. If you still experience issues, try spacing out your runs.

**Q: Can I scrape comments from private groups?**
A: No. Only public group posts where comments are visible without login can be scraped.

**Q: How does the comment sorting work?**
A: `ALL` returns Facebook's unfiltered "All comments" view — every visible comment, in Facebook's own ranked ordering (not strictly chronological). `NEWEST` returns comments newest first. `MOST_RELEVANT` uses Facebook's ranked "Most relevant" view, which prioritizes popular and engaging comments.

**Q: What is `threadingDepth`?**
A: It indicates the nesting level. `0` means it's a top-level comment directly on the post. `1` means it's a reply to a top-level comment. Higher values indicate deeper nesting.

**Q: How many comments can I scrape per run?**
A: You can set `maxItems` up to 10,000 per URL. The actual number depends on how many public comments exist on the post.

# Actor input Schema

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

Facebook post, Reel, Watch, or photo URLs to scrape comments from. Supports /posts/, /reel/, /watch?v=, /photo?fbid=, /groups/.../permalink/, and /share/p/ URLs.

## `maxItems` (type: `integer`):

Maximum number of comment rows to collect per start URL (not global across all URLs).

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

Limit results to comments posted after this date. Accepts YYYY-MM-DD, a full ISO 8601 timestamp (e.g. 2024-06-15T12:00:00Z), or a relative value like '1 day', '2 weeks', '3 months', '1 year'. When set, comments are always fetched newest-first so the filter can stop as soon as an older comment is reached. Leave blank to disable date filtering.

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

Which comment view to scrape: ALL (Facebook's unfiltered "All comments" view, in Facebook's own ranked ordering), NEWEST (newest first), or MOST\_RELEVANT (Facebook's ranked "Most relevant" view).

## `includeNestedComments` (type: `boolean`):

If true, also scrape reply rows under top-level comments (with parentComment/parentReply metadata). If false, only top-level comments are collected (faster).

## `maxReplyDepth` (type: `integer`):

How many levels of nested replies to follow when 'Include nested comments' is enabled. 1 = only direct replies to top-level comments (Facebook's most reliably available level). Higher values are attempted but may return no additional data if Facebook's reply API doesn't support deeper nesting for a given post.

## `proxy` (type: `object`):

Residential proxy recommended for reliable results, especially at higher volume or concurrency. Not required for occasional/low-volume runs against posts or videos.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.facebook.com/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol"
    }
  ],
  "maxItems": 5,
  "commentsMode": "MOST_RELEVANT",
  "includeNestedComments": true,
  "maxReplyDepth": 1,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `comments` (type: `string`):

Dataset containing all scraped Facebook comments

# 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/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol"
        }
    ],
    "maxItems": 5,
    "commentsMode": "MOST_RELEVANT",
    "includeNestedComments": true,
    "maxReplyDepth": 1,
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/facebook-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": [{ "url": "https://www.facebook.com/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol" }],
    "maxItems": 5,
    "commentsMode": "MOST_RELEVANT",
    "includeNestedComments": True,
    "maxReplyDepth": 1,
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/facebook-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": [
    {
      "url": "https://www.facebook.com/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol"
    }
  ],
  "maxItems": 5,
  "commentsMode": "MOST_RELEVANT",
  "includeNestedComments": true,
  "maxReplyDepth": 1,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call crawlerbros/facebook-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/facebook-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/QSWFgOzYKmVxgRcYf/builds/2jtdTgHBRmTtQEk6R/openapi.json
