# Facebook Comments Scraper (Public Posts, Replies, Reactions) (`locaihost/facebook-comments`) Actor

Comments on public Facebook posts with no login: text, time, reactions and reply count for each comment, the author's public name and profile link, and replies when Facebook attaches them. Covers the comments Facebook shows a logged-out visitor, plus each post's totals. $2.00 per 1,000 comments.

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

## Pricing

from $1.10 / 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.
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 Comments Scraper (Public Posts, Replies, Reactions)

Give it links to public Facebook posts. You get one row per comment: the text, when it was written, its reaction count, how many replies sit under it, and the author's public name and profile link. Replies come as their own rows, marked with the comment they answer. No Facebook account, no cookies, no login.

### What does it return?

Three kinds of row in one dataset, told apart by the `type` field:

- **comment** rows: one per comment or reply on the post
- **status** rows (free): one for each input that could not be read, saying why
- a **summary** row (free): totals, comments per post and the comments with the most reactions

Every comment row carries the post it belongs to, the Page that posted it, and a link that opens the comment right on the post.

### How do I use it?

1. Paste links to public posts under **Facebook posts**, one per line.
2. Set how many comments you want per post (30 by default) and whether replies are included (yes by default).
3. Start the run. Rows appear in the dataset as each post is read.

Example input:

```json
{
  "postUrls": ["https://www.facebook.com/NASA/posts/pfbid02wE2bnKacnW5rQtZJwEjZZyVqXxoZ5NWakfbiznAPBtYxHDrAT8D8uJzt1GB928onl"],
  "maxCommentsPerPost": 100,
  "includeReplies": true,
  "onlyNew": true
}
```

You can also paste whole Page links (under **Pages instead of single posts**) and the run reads the newest posts of each Page and collects their comments. Both inputs can be used in one run.

### Which links work?

Links to posts on public Pages in any of the usual forms: `facebook.com/PageName/posts/...`, `permalink.php?story_fbid=...`, photos, videos, reels, `watch/?v=...`, `fb.watch/...` and `share/...` links. Plain `m.facebook.com` and `mbasic.facebook.com` forms work too.

Personal profiles, groups, events and Marketplace are not supported. They get a free status row that says so, and nothing is charged for them. A link to a whole Page pasted under posts is read as that Page's newest posts, not refused.

### How many comments do I get per post?

Here is the honest limit of reading Facebook logged out: a post page hands a visitor one ranked window of about ten comments per request, and Facebook decides which comments are in it. The Actor asks for the post's comment dialog directly and returns as much of that window as it can, up to your limit. The post's full comment count, as Facebook states it, always comes on every row and in the summary, and the summary names the posts where Facebook's window held fewer comments than the post has.

So a post with 2,000 comments usually returns its top-ranked window, not all 2,000, and the run says so plainly rather than pretending otherwise. Reading a whole post's history needs a tool that logs in, which this one deliberately is not.

### Can I choose newest first instead of most relevant?

No. Facebook's logged-out comment window comes in Facebook's own ranked order, and the order cannot be switched from outside an account. Every row keeps the position it came at, and the summary shows the oldest and newest comment returned, so you can sort by time yourself once the rows are out.

### Can I get only comments I have not seen before?

Yes. Turn on **Only comments not returned before**. The run remembers which comments it returned for the same list of posts and Pages and leaves them out next time, so a daily schedule brings only what is new. The memory is kept in your own account and is separate for each list of posts. Comments skipped this way are never charged.

### Does it need my Facebook login or cookies?

No. It reads what Facebook shows any logged-out visitor. You never enter an account, a password or cookies, and it never creates accounts.

### What does each row contain?

| Field | What it is |
|---|---|
| `type` | `comment` for these rows; `status` and `summary` rows have their own fields |
| `postUrl` | The post link this comment sits on |
| `postId` | Facebook's id for the post |
| `pageName` | Name of the Page that posted it |
| `commentId` | Facebook's numeric comment id, the one its own comment links use |
| `commentUrl` | Link that opens this comment on the post |
| `text` | The comment text, empty when the author deleted it |
| `createdAt` | When the comment was written, in ISO format (UTC) |
| `authorName` | The author's public display name |
| `authorUrl` | The author's public profile link |
| `reactionCount` | Reactions on the comment, when Facebook shows them |
| `replyCount` | Replies under the comment, Facebook's own count |
| `isReply` | `true` when this row is a reply to another comment |
| `parentId` | The parent comment's id, for replies |
| `scrapedAt` | When this row was read |

Status rows carry `type`, `input`, `url`, `status`, `message` and `scrapedAt`. The summary row carries `type`, `postsRead`, `postsNotRead`, `comments`, `replies`, `commentsByPost`, `topCommentsByReactions`, `oldestCommentAt`, `newestCommentAt`, `postsAtWindowLimit`, `skippedSeenBefore` and `scrapedAt`.

### Which rows are free?

Status rows and the summary row are never charged. Only comment rows (replies included) are paid, one each. A post that returns nothing costs nothing.

### How much does it cost?

$2.00 per 1,000 comment rows ($1.50 on Scale, $1.10 on Business), charged as one paid event per row, plus the usual start charge when a run begins. The run stops cleanly at 90 percent of your maximum charge and keeps everything read so far, and a run that returns nothing is never charged for rows.

**Free Apify plan:** up to 200 rows per run. Any paid Apify plan removes the limit.

### What happens when Facebook blocks a request?

Facebook sometimes answers a logged-out visitor with a login wall or an empty answer. The Actor then starts a fresh session and tries again, up to three times per post. If a post still will not load, you get a free status row for it, the other posts carry on, and you can re-run just that post later.

### What do the status rows mean?

| status | meaning |
| --- | --- |
| `not-found` | The post does not exist or is not public |
| `unsupported` | A group, event, Marketplace or personal-profile link, which is not supported |
| `blocked` | Facebook kept asking for a login for this post; try it again later |
| `no-comments` | The post was read but showed no comments to a logged-out visitor |

### Will input saved for another comment tool work?

Fields named `startUrls`, `resultsLimit` or `includeNestedComments` are accepted where you would paste `postUrls`, `maxCommentsPerPost` or `includeReplies`, so old task input can be pasted in without edits.

### Is it legal to collect Facebook comments?

The Actor reads public posts the same way a logged-out browser does, and only what is public on them: comment text, counts, and each author's public name and profile link. It never logs in, never collects passwords or private messages, and never returns anyone's email, phone number or address. Comments are personal data in most jurisdictions: you are responsible for having a lawful reason to collect and keep them, and for following the rules that apply to you, including Europe's General Data Protection Regulation where it applies, and Facebook's own terms.

### Can I use it from my own code or an agent?

Yes. Run it through the Apify API or any Apify client, or connect it as a tool through the Apify MCP server. The input is plain JSON and every row has a `type` field, so you can filter rows easily. The dataset has a Comments view and a Summary view.

### Something is missing or broken. What should I do?

Open an issue on the Issues tab with the post link and what you expected. Facebook changes its pages often; reports help get fixes out fast.

# Changelog

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

# Actor input Schema

## `postUrls` (type: `array`):

Links to public posts: facebook.com/PageName/posts/..., permalink.php?story_fbid=..., photo, video, reel and watch links. The post's Page must be public. Personal profiles, groups and Marketplace are not supported and come back as a free status row.

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

How many comments to return per post. Logged out, Facebook hands out its ranked comment window (about 10) per request; the post's full comment count still comes on every row's post and in the summary.

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

Return reply rows under the comments Facebook attaches them to, marked isReply with their parentId. Logged out, Facebook attaches replies only sometimes; each comment's reply count is always returned either way.

## `pageUrls` (type: `array`):

Paste Page links here to read the newest posts of each Page and collect the comments on them, instead of pasting single post links. Both inputs can be used in one run.

## `maxPostsPerPage` (type: `integer`):

When Page links are given: how many of each Page's newest posts to read comments from. Reading a post costs about two requests, so keep this small for many Pages.

## `onlyNew` (type: `boolean`):

Remembers which comments this exact list of posts returned in earlier runs and leaves them out, so a daily schedule only brings new comments. Repeats are never charged.

## `summaryRow` (type: `boolean`):

A free last row with posts read, comments per post, each post's full comment count, the top comments by reactions and what was left out. Never charged.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.facebook.com/NASA/posts/pfbid02wE2bnKacnW5rQtZJwEjZZyVqXxoZ5NWakfbiznAPBtYxHDrAT8D8uJzt1GB928onl"
  ],
  "maxCommentsPerPost": 30,
  "includeReplies": true,
  "pageUrls": [],
  "maxPostsPerPage": 5,
  "onlyNew": false,
  "summaryRow": true
}
```

# Actor output Schema

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

Comment and reply rows

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

The free summary row

# 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 = {
    "postUrls": [
        "https://www.facebook.com/NASA/posts/pfbid02wE2bnKacnW5rQtZJwEjZZyVqXxoZ5NWakfbiznAPBtYxHDrAT8D8uJzt1GB928onl"
    ],
    "pageUrls": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("locaihost/facebook-comments").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 = {
    "postUrls": ["https://www.facebook.com/NASA/posts/pfbid02wE2bnKacnW5rQtZJwEjZZyVqXxoZ5NWakfbiznAPBtYxHDrAT8D8uJzt1GB928onl"],
    "pageUrls": [],
}

# Run the Actor and wait for it to finish
run = client.actor("locaihost/facebook-comments").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 '{
  "postUrls": [
    "https://www.facebook.com/NASA/posts/pfbid02wE2bnKacnW5rQtZJwEjZZyVqXxoZ5NWakfbiznAPBtYxHDrAT8D8uJzt1GB928onl"
  ],
  "pageUrls": []
}' |
apify call locaihost/facebook-comments --silent --output-dataset

```

## MCP server setup

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

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/LGHEReRs3EcOKOUCa/builds/QHeg5dvf3bIM9ZAM1/openapi.json
