# Facebook Comments Scraper - Deep, No Login (`haketa/facebook-comments-scraper`) Actor

Scrape comments from public Facebook posts with deep pagination. By post URL, get each comment's author name, profile link, text, like count, timestamp and replies — far beyond the preview comments. No login, no API key, no browser. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/haketa/facebook-comments-scraper.md
- **Developed by:** [Haketa](https://apify.com/haketa) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.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 Comments Scraper — Deep, No Login

Scrape **comments from public Facebook posts** with real pagination. For each post you get every collected comment's **author name, profile link, comment text, like count, timestamp and reply depth**. Just paste the post URLs.

No login, no API key, no browser extension, no access token. The actor replays Facebook's own comment API over fast HTTP and pages through the thread — so you get **far more than the handful of preview comments**, not just the top one or two.

Download results as **JSON, CSV, Excel, HTML or XML** or pull them from the API.

***

### What you get

For each public Facebook post URL:

- **Comment text** (emoji preserved)
- **Author name** + **profile link** + author id
- **Likes / reactions** on each comment
- **Replies** (depth) — top-level comments and replies
- **Timestamp** when available
- **Post context** — the post's total comment count

### Use cases

- **Audience & sentiment research** — pull the public conversation under a brand, news or creator post.
- **Lead generation** — collect the people engaging with posts in your niche (name + profile link).
- **Social listening & moderation** — monitor comments on your own or competitors' posts.
- **Content & market research** — see what resonates by reading comments across many posts at scale.

***

### Input

| Field | Type | Description |
|-------|------|-------------|
| `postUrls` | array | Public Facebook post URLs (`facebook.com/{page}/posts/{id}`, permalink or story URLs). Each is scraped separately. |
| `maxComments` | integer | Max comments to collect per post. The actor pages until it hits this number or runs out. Default 100. |
| `includeReplies` | boolean | Include replies (depth > 0), not just top-level comments. Default `true`. |
| `commentsSort` | string | Comment order: `RANKED_UNFILTERED` (all), `RANKED_FILTERED` (most relevant), `RECENT` (newest), `CHRONOLOGICAL` (top-level only). |
| `loginCookie` | string | **Optional.** Your own Facebook `Cookie` header, to fetch with your session. Leave empty to run logged out. |
| `proxyConfiguration` | object | **Residential proxy required** (Facebook blocks datacenter IPs for this data). Defaults to Apify Residential (US). |

#### Example input

```json
{
  "postUrls": [
    "https://www.facebook.com/cnn/posts/pfbid0V91q399yAUSE5EAUQapwc9CHzPRKZ2wsjnh8a48xbfUobU16RK3BNoo8jK2yaRK2l"
  ],
  "maxComments": 100,
  "includeReplies": true,
  "commentsSort": "RANKED_UNFILTERED",
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"], "apifyProxyCountry": "US" }
}
```

***

### Output

One row per comment.

#### Example record

```json
{
  "postUrl": "https://www.facebook.com/cnn/posts/pfbid0V91q399…",
  "postId": "pfbid0V91q399…",
  "postTotalComments": 958,
  "commentId": "1452822786730885",
  "authorName": "Sunday Marie",
  "authorId": "1290554626",
  "authorUrl": "https://www.facebook.com/1290554626",
  "text": "This administration's turnover is something else…",
  "likeCount": 12,
  "depth": 0,
  "isReply": false,
  "createdTime": "2026-10-12T18:04:00.000Z",
  "scrapedAt": "2026-10-13T15:30:00.000Z"
}
```

#### Fields

| Field | Description |
|-------|-------------|
| `postUrl` / `postId` | The post you scraped. |
| `postTotalComments` | Total comments Facebook reports on the post. |
| `commentId` | Comment id. |
| `authorName` / `authorId` / `authorUrl` | The commenter and a link to their profile. |
| `text` | The comment text (emoji preserved). |
| `likeCount` | Reactions/likes on the comment. |
| `depth` / `isReply` | 0 = top-level comment; > 0 = a reply. |
| `createdTime` | Comment timestamp when available. |
| `scrapedAt` | ISO timestamp. |

***

### How it works

A public Facebook post page — viewed logged out — embeds the first comments plus a guest session and a comments cursor. The actor reads those, then replays Facebook's own comment pagination request page after page, collecting every comment node until it reaches your `maxComments` or the thread ends. It's pure HTTP (no browser), so it's quick and lightweight.

> **Residential proxy is required.** Facebook serves this data only to residential IPs; datacenter IPs are blocked. The input defaults to Apify Residential (US).

> **Coverage.** Logged out, Facebook exposes a large slice of a post's comments (the amount can vary by post and session). For very large threads, request a higher `maxComments`; to go beyond the logged-out limit on huge posts, supply your own `loginCookie`.

***

### FAQ

**Do I need a Facebook account, app or access token?** No. It runs logged out. A `loginCookie` is optional, only to push past the logged-out limit on very large threads.

**Which URLs work?** Public post URLs: `facebook.com/{page}/posts/{id}`, `permalink.php`/`story.php` links, and public video post URLs.

**Why is residential proxy required?** Facebook blocks datacenter IPs for comment data. Residential IPs work; the actor defaults to Apify Residential (US).

**Does it get replies?** Yes — keep `includeReplies` on; each row carries `depth` and `isReply`.

**Private posts / groups?** No — only public posts are accessible without login.

**How many comments will I get?** As many as you set in `maxComments`, subject to how many Facebook exposes for that post logged out. Popular posts routinely return dozens to hundreds.

***

### Related actors

Check out scrapers for Facebook Pages/Posts, Instagram, Reddit, YouTube comments and TikTok on the Apify Store.

***

### Legal & ethical use

This actor collects **publicly available** comment data from public Facebook posts. Comments can contain personal data — use the output responsibly and in compliance with Facebook's Terms, the GDPR/CCPA and applicable laws (including a lawful basis for processing personal data and anti‑spam rules). You are responsible for how you use it.

# Actor input Schema

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

Public Facebook post URLs, e.g. <b>https://www.facebook.com/{page}/posts/{id}</b> or a <b>permalink/story</b> URL. Each post is scraped separately. Leave empty to run a demo on a public CNN post.

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

Maximum comments to collect per post. The actor pages through the comments until it reaches this number or Facebook runs out of logged-out comments for the post.

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

Include replies to comments (depth > 0), not just top-level comments.

## `commentsSort` (type: `string`):

How Facebook ranks the comments it returns. <b>Most relevant</b> (default), <b>All comments</b> (unfiltered), <b>Newest</b> or <b>Top-level only</b>.

## `loginCookie` (type: `string`):

Optional. Paste your own Facebook <b>Cookie</b> header (DevTools → Network → any facebook.com request → Cookie) to fetch posts with your session. Leave empty to run logged out. Treat it like a password.

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

<b>Residential proxy is required</b> — Facebook blocks datacenter IPs for this data. Defaults to Apify Residential (US).

## Actor input object example

```json
{
  "postUrls": [
    "https://www.facebook.com/cnn/posts/pfbid0V91q399yAUSE5EAUQapwc9CHzPRKZ2wsjnh8a48xbfUobU16RK3BNoo8jK2yaRK2l"
  ],
  "maxComments": 50,
  "includeReplies": true,
  "commentsSort": "RANKED_UNFILTERED",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

## `datasetItems` (type: `string`):

All extracted comments for this run.

## `overviewTable` (type: `string`):

A clean table view of the 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 = {
    "postUrls": [
        "https://www.facebook.com/cnn/posts/pfbid0V91q399yAUSE5EAUQapwc9CHzPRKZ2wsjnh8a48xbfUobU16RK3BNoo8jK2yaRK2l"
    ],
    "maxComments": 50,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("haketa/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 = {
    "postUrls": ["https://www.facebook.com/cnn/posts/pfbid0V91q399yAUSE5EAUQapwc9CHzPRKZ2wsjnh8a48xbfUobU16RK3BNoo8jK2yaRK2l"],
    "maxComments": 50,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("haketa/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 '{
  "postUrls": [
    "https://www.facebook.com/cnn/posts/pfbid0V91q399yAUSE5EAUQapwc9CHzPRKZ2wsjnh8a48xbfUobU16RK3BNoo8jK2yaRK2l"
  ],
  "maxComments": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call haketa/facebook-comments-scraper --silent --output-dataset

```

## MCP server setup

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