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

Scrape comments and replies from public Facebook posts and reels without login, with a per-post coverage report. $1.50 per 1,000 comments.

- **URL**: https://apify.com/lordfloofington/facebook-comments-scraper.md
- **Developed by:** [Daniel G](https://apify.com/lordfloofington) (community)
- **Categories:** Social media
- **Stats:** 4 total users, 3 monthly users, 99.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 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

## Facebook Comments Scraper

Scrape comments and replies from public Facebook posts, reels and videos without login. Each post gets a coverage report describing whether comment pages and reply threads were read to the end. Each returned comment costs $0.0015 ($1.50 per 1,000 comments), including replies; a $0.00005 start fee applies per run.

### What it returns

Each dataset item is one comment or reply. Replies are separate rows; `threadingDepth` is `0` for top-level comments and higher for replies, while `replyToCommentId` identifies the direct parent. Nested arrays such as `comments` and `replies` are empty. A comment made only of a sticker, GIF or photo is still returned: `text` may be null and `attachments` contains available media details.

| Name | Type | Meaning |
| --- | --- | --- |
| `facebookUrl` | string or null | Facebook URL of the post. |
| `inputUrl` | string or null | URL supplied in `startUrls`. |
| `postId` | string or null | Numeric post ID. |
| `postUrl` | string or null | Resolved post URL. |
| `postTitle` | string or null | Post title, when available. |
| `postDescription` | string or null | Post text, when available. |
| `commentUrl` | string or null | Direct comment URL. |
| `commentId` | string or null | Numeric comment ID. |
| `facebookCommentId`, `facebookId` | string or null | Numeric comment ID aliases. |
| `id` | string or null | Base64 Facebook comment ID. |
| `feedbackId` | string or null | Facebook feedback ID. |
| `name`, `authorName`, `profileName` | string or null | Commenter's display name. |
| `author` | object or null | Author ID, name and profile URL. |
| `profileId` | string or null | Commenter's Facebook ID. |
| `profileUrl` | string or null | Commenter's profile URL. |
| `profilePicture` | string or null | Profile picture URL, when available. |
| `text`, `message` | string or null | Comment text; may be null for media-only comments. |
| `attachments` | array or null | Available comment media attachments. |
| `date`, `createdAt`, `publishedAt` | string or null | Comment time in ISO 8601 format. |
| `timestamp`, `time` | number or null | Comment time as Unix seconds. |
| `likesCount` | string or null | Reaction count as a string. |
| `likes`, `likeCount` | number or null | Reaction count as a number. |
| `commentsCount` | number or null | Reported replies to this comment. |
| `threadingDepth` | number or null | Nesting depth; top-level comments are 0. |
| `replyToCommentId`, `parentCommentId`, `parentFacebookCommentId`, `parentId` | string or null | Direct parent comment ID for replies. |
| `rootCommentId` | string or null | Root comment ID when available. |
| `comments`, `replies` | array or null | Empty; replies are separate dataset rows. |
| `parentComment`, `parentReply` | object or null | Parent objects; currently null. |

Example rows (shortened text and placeholder author details):

```json
[
  {"facebookUrl":"https://www.facebook.com/example/posts/POST_ID","inputUrl":"https://www.facebook.com/example/posts/POST_ID","postId":"POST_ID","postUrl":"https://www.facebook.com/example/posts/POST_ID","commentUrl":"https://www.facebook.com/example/posts/POST_ID?comment_id=COMMENT_ID","commentId":"COMMENT_ID","facebookCommentId":"COMMENT_ID","facebookId":"COMMENT_ID","id":"BASE64_COMMENT_ID","feedbackId":"BASE64_FEEDBACK_ID","name":"Example Author","authorName":"Example Author","profileName":"Example Author","author":{"id":"AUTHOR_ID","name":"Example Author","url":"https://www.facebook.com/AUTHOR_ID"},"profileId":"AUTHOR_ID","profileUrl":"https://www.facebook.com/AUTHOR_ID","profilePicture":null,"date":"2026-10-04T09:58:43.000Z","createdAt":"2026-10-04T09:58:43.000Z","publishedAt":"2026-10-04T09:58:43.000Z","timestamp":1791112723,"time":1791112723,"text":"Example comment text…","message":"Example comment text…","attachments":[],"likesCount":"24","likes":24,"likeCount":24,"commentsCount":0,"threadingDepth":0,"replyToCommentId":null,"parentCommentId":null,"parentFacebookCommentId":null,"parentId":null,"rootCommentId":null,"comments":[],"replies":[],"parentComment":null,"parentReply":null},
  {"facebookUrl":"https://www.facebook.com/example/posts/POST_ID","inputUrl":"https://www.facebook.com/example/posts/POST_ID","postId":"POST_ID","postUrl":"https://www.facebook.com/example/posts/POST_ID","commentUrl":"https://www.facebook.com/example/posts/POST_ID?comment_id=PARENT_COMMENT_ID&reply_comment_id=REPLY_ID","commentId":"REPLY_ID","facebookCommentId":"REPLY_ID","facebookId":"REPLY_ID","id":"BASE64_REPLY_ID","feedbackId":"BASE64_REPLY_FEEDBACK_ID","name":"Another Author","authorName":"Another Author","profileName":"Another Author","author":{"id":"AUTHOR_ID_2","name":"Another Author","url":"https://www.facebook.com/AUTHOR_ID_2"},"profileId":"AUTHOR_ID_2","profileUrl":"https://www.facebook.com/AUTHOR_ID_2","profilePicture":null,"date":"2026-10-04T10:42:05.000Z","createdAt":"2026-10-04T10:42:05.000Z","publishedAt":"2026-10-04T10:42:05.000Z","timestamp":1791115325,"time":1791115325,"text":"Example reply text…","message":"Example reply text…","attachments":[],"likesCount":"5","likes":5,"likeCount":5,"commentsCount":0,"threadingDepth":1,"replyToCommentId":"PARENT_COMMENT_ID","parentCommentId":"PARENT_COMMENT_ID","parentFacebookCommentId":"PARENT_COMMENT_ID","parentId":"PARENT_COMMENT_ID","rootCommentId":null,"comments":[],"replies":[],"parentComment":null,"parentReply":null}
]
```

### Input

| Field | Default | Meaning |
| --- | --- | --- |
| `startUrls` | Required | Array of Facebook post URLs; each object has a `url`. |
| `resultsLimit` | No limit | Maximum rows per post, replies included. Omit it to collect all visible comments. |
| `includeNestedComments` | `false` | Fetch replies and nested replies as separate rows. |
| `viewOption` | `RANKED_UNFILTERED` | Ordering: `RANKED_UNFILTERED` (All comments), `RECENT_ACTIVITY` (Newest), or `RANKED_THREADED` (Most relevant). Facebook may offer different orderings on different posts; the Actor falls back to an available ordering if needed. |
| `onlyCommentsNewerThan` | No lower bound | Inclusive date or datetime, or relative value such as `7 days`. |

One post, all visible comments and replies:

```json
{"startUrls":[{"url":"https://www.facebook.com/example/posts/123456789"}],"includeNestedComments":true}
```

Newest 50 comments from each of several posts:

```json
{"startUrls":[{"url":"https://www.facebook.com/example/posts/123456789"},{"url":"https://www.facebook.com/example/posts/987654321"}],"resultsLimit":50,"viewOption":"RECENT_ACTIVITY"}
```

`resultsLimit` applies separately to each URL and counts replies when they are enabled.

### Supported URLs

URLs may use `www.facebook.com`, `m.facebook.com` or `web.facebook.com`.

| URL form | Example path |
| --- | --- |
| Post with numeric ID or `pfbid` | `/Page/posts/123456789`, `/Page/posts/pfbidCODE` |
| Permalink | `/permalink.php?story_fbid=123&id=456` |
| Group post (public groups) | `/groups/GROUP/posts/123`, `/groups/GROUP/permalink/123` |
| Photo | `/photo/?fbid=123` |
| Reel | `/reel/123` |
| Watch | `/watch/?v=123` |
| Video | `/Page/videos/123` |
| Share | `/share/r/CODE`, `/share/v/CODE`, `/share/p/CODE` |

### Coverage report

The default key-value store's `OUTPUT` record contains `schemaVersion`, `actorBuild` and a `targets` array with one report per input URL. Each `COVERAGE` log line contains that URL's report. Reports include `postId`, `status`, `stopReason`, requested and used ordering, Facebook's reported totals, emitted row counts, truncated thread count, failed requests, retries, logged-out visibility and errors.

| Status | Meaning |
| --- | --- |
| `complete` | Every comment page and enabled reply thread was read to the end. |
| `partial` | Collection stopped at the result limit, charge limit, paging shortfall or after an error with some rows emitted. |
| `unavailable` | The post was not found or is age-gated. |
| `failed` | The Actor could not collect rows or establish coverage. |

`reportedTotal` is Facebook's own total count, and `topLevelReported` is its top-level count. The reported total can be a few higher than the rows logged-out visitors can see because Facebook hides some comments from logged-out visitors. `end_of_comments` means paging ended normally. `results_limit` and `charge_cap` identify those limits; `not_found` and `age_gated` identify unavailable posts. `paging_cut_short` means Facebook ended paging while reporting more than 30 top-level comments and fewer than half that count were traversed. This is reported as partial coverage.

### Pricing

Runs by users on Apify's free plan are limited to 3 URLs and 20 results per run.

- `comment`: $0.0015 per returned row ($1.50 per 1,000), with replies charged the same as top-level comments.
- Start fee: $0.00005 per run.
- Unavailable posts: free.

For 100 returned rows across available posts, event charges are $0.15; with one run's start fee, the total is $0.15005. When the configured charge limit is reached, the Actor stops emitting rows and stops crawling; the affected report has `status: "partial"` and `stopReason: "charge_cap"`.

### Limits

Only public posts visible without login can be collected, including posts in public groups. Some comments are hidden from logged-out visitors and cannot be returned. A URL that is not a single post (for example a Page or group home page) is reported as `failed` with `stopReason: "unsupported_url"`; the other URLs in the run are still processed.

### Use via API

Send JSON to the synchronous dataset-items endpoint:

```sh
curl -X POST 'https://api.apify.com/v2/acts/LordFloofington~facebook-comments-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{"startUrls":[{"url":"https://www.facebook.com/example/posts/123456789"}],"includeNestedComments":true}'
```

### Compliance

Users are responsible for complying with Facebook's terms and applicable law when using this Actor.

# Changelog

This Actor's version history is a separate document: https://apify.com/lordfloofington/facebook-comments-scraper/changelog.md

# Actor input Schema

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

Public Facebook post, photo, video, or reel URLs to scrape. Runs by users on Apify's free plan are limited to 3 URLs and 20 results per run.

## `resultsLimit` (type: `integer`):

Maximum comments per post URL, including replies. Omit to collect all visible comments.

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

Include replies and nested replies as separate dataset rows.

## `viewOption` (type: `string`):

Choose All comments, Newest, or Most relevant ordering.

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

Inclusive ISO date or datetime, or a relative time such as 7 days.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.facebook.com/examplepage/posts/123456789"
    }
  ],
  "viewOption": "RANKED_UNFILTERED"
}
```

# Actor output Schema

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

No description

## `coverage` (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/examplepage/posts/123456789"
        }
    ],
    "includeNestedComments": false,
    "viewOption": "RANKED_UNFILTERED"
};

// Run the Actor and wait for it to finish
const run = await client.actor("lordfloofington/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/examplepage/posts/123456789" }],
    "includeNestedComments": False,
    "viewOption": "RANKED_UNFILTERED",
}

# Run the Actor and wait for it to finish
run = client.actor("lordfloofington/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/examplepage/posts/123456789"
    }
  ],
  "includeNestedComments": false,
  "viewOption": "RANKED_UNFILTERED"
}' |
apify call lordfloofington/facebook-comments-scraper --silent --output-dataset

```

## MCP server setup

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