# Facebook Comments & Replies Scraper (`dataji/facebook-comments-replies-scraper`) Actor

Scrapes comments, reaction counts and replies from public Facebook posts.

- **URL**: https://apify.com/dataji/facebook-comments-replies-scraper.md
- **Developed by:** [Dataji.io](https://apify.com/dataji) (community)
- **Stats:** 4 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 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.

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 Post Comments Scraper

Scrape **all comments and replies** from public Facebook posts, with no login and no Facebook API key needed. Paste one or more post URLs and get every comment with its author, date, reaction count, reply count, attachment, and a direct link to the comment. Replies, including replies to replies, come out as their own rows so the data is easy to use in Excel, Google Sheets or a database.

### What can this Facebook comments scraper do?

- 💬 Scrape **every top-level comment** on a public Facebook post
- ↩️ Scrape **all replies and replies to replies**, linked to their parent comment
- 👤 Get the **commenter's name, profile ID, profile URL and profile picture**
- 📅 Get the **exact date and time** of each comment (ISO 8601, UTC)
- 👍 Get **reaction counts as numbers** (`1.2K` becomes `1200`)
- 🖼️ Get **images, GIFs and stickers** attached to comments
- 📝 Get **post details** on every row: post text, author, date, total comments, reactions and shares
- 🔗 Works with `/posts/` links, share links (`facebook.com/share/p/...`), `permalink.php`, photo, video and reel links
- 📦 Export to **JSON, CSV, Excel, XML or HTML**, or pull the data through the Apify API

### What data can I extract?

| Field | Description |
|---|---|
| `type` | `comment` or `reply` |
| `text` | Comment text |
| `authorName`, `authorId`, `authorUrl`, `authorProfilePicture` | Who wrote the comment |
| `date` | When the comment was posted (UTC) |
| `reactionCount` | Number of reactions on the comment |
| `replyCount` | Number of replies Facebook reports for the comment |
| `commentId`, `commentUrl` | Comment ID and a direct link to it |
| `parentCommentId` | For replies: the top-level comment this reply belongs to |
| `replyToCommentId` | For replies: the comment or reply it directly answers |
| `depth` | `0` = comment, `1` = reply, `2` = reply to a reply |
| `attachment` | Image / GIF / sticker attached to the comment (`type`, `url`) |
| `postUrl`, `postId`, `postAuthor`, `postText`, `postDate` | The post the comment belongs to |
| `postCommentCount`, `postReactionCount`, `postShareCount` | Post totals as shown by Facebook |

### How to scrape Facebook comments

1. Click **Try for free**.
2. Paste one or more **Facebook post URLs**.
3. Optionally set **Max comments per post** and whether to **include replies**.
4. Click **Start** and download your data when the run finishes.

### Input

| Field | Description |
|---|---|
| **Facebook post URLs** | Public post URLs. Page or profile URLs (e.g. `facebook.com/NASA`) are skipped. |
| **Max comments per post** | Limit top-level comments per post. `0` = all comments. |
| **Include replies** | Also scrape replies and replies to replies. On by default. |
| **Max replies per comment** | Limit replies per comment. `0` = all replies. |
| **Proxy configuration** | Apify Proxy is used by default. If runs get blocked, switch to the **RESIDENTIAL** group. |
| **Facebook cookies** (advanced) | Only for posts you cannot see without logging in. Not needed for public posts. |

Example input:

```json
{
    "postUrls": [
        { "url": "https://www.facebook.com/NASA/posts/pfbid0dPToN66CzcAHGMoaNe3jszH4FfBKvqkE5gogCNJkTxXDPsSGYrGvcVwsLgByyMQQl" }
    ],
    "maxComments": 100,
    "includeReplies": true
}
```

### Output example

Each comment and each reply is one row:

```json
{
    "postUrl": "https://www.facebook.com/Cristiano/posts/pfbid02wwWW6zEYdHpCmYbVWEwJMX8QH5ve4izADrhZpPeHxFScJkwEbdLsq9VpoboHpJFLl",
    "postId": "1766904111462788",
    "postAuthor": "Cristiano Ronaldo",
    "postText": "Job done. On to the next one! 💪🏽",
    "postDate": "2026-10-09T20:32:02+00:00",
    "postCommentCount": 26352,
    "postReactionCount": 733019,
    "postShareCount": 9846,
    "type": "comment",
    "commentId": "2623070158154088",
    "commentUrl": "https://www.facebook.com/Cristiano/posts/pfbid02wwWW6zEYdHpCmYbVWEwJMX8QH5ve4izADrhZpPeHxFScJkwEbdLsq9VpoboHpJFLl?comment_id=2623070158154088",
    "parentCommentId": null,
    "replyToCommentId": null,
    "depth": 0,
    "text": "France has Mbappé, Norway has Haaland, Argentina has Messi, but Football has Cristiano Ronaldo. 🐐🇵🇹",
    "date": "2026-10-09T20:32:37+00:00",
    "reactionCount": 2500,
    "replyCount": 127,
    "authorName": "Idriss Leadou",
    "authorId": "61577775745961",
    "authorUrl": "https://www.facebook.com/lebienfaiteur1",
    "authorProfilePicture": "https://scontent.xx.fbcdn.net/...",
    "attachment": null
}
```

To rebuild threads, group replies by `parentCommentId`.

### Use cases

- **Social listening and brand monitoring**: see what people say about your brand, campaign or competitors
- **Sentiment analysis**: feed comments into an AI or NLP pipeline
- **Giveaways and contests**: collect every entry from a post's comments
- **Market and academic research**: study public discussion on news, sports and politics
- **Influencer and campaign reports**: measure engagement on specific posts

### FAQ

#### Do I need a Facebook account?

No. The scraper works with public posts without logging in. The optional cookies field is only for posts that are not visible when logged out. Using your own account's cookies can get that account restricted, so we recommend a secondary account if you need it.

#### Why does `replyCount` not always match the number of scraped replies?

Facebook's reply count includes replies that are hidden, deleted or filtered as low quality, which Facebook does not show to anyone. The scraper returns every reply Facebook actually displays.

#### Why did my run return no data?

Usually because the URL is not a public post (for example a private group post, or a profile URL), or Facebook blocked the request. The run log and status message say which post failed and why. If Facebook is blocking, switch the proxy to the **RESIDENTIAL** group.

#### Can I scrape comments from Facebook groups?

Yes, for posts in **public** groups. Posts in private groups need cookies from an account that is a member.

#### Can I use it through the API?

Yes. You can start runs and download results with the [Apify API](https://docs.apify.com/api/v2), the Apify JavaScript and Python clients, or integrations like Make, Zapier and Google Sheets.

### Is it legal to scrape Facebook comments?

This scraper only collects data that is publicly visible on Facebook. Comments can still contain personal data, which is protected by laws such as the GDPR in the EU. Do not scrape personal data unless you have a legitimate reason, and check with a lawyer if you are unsure. You can read more in Apify's blog post on [the legality of web scraping](https://blog.apify.com/is-web-scraping-legal/).

### Support

Found a bug or need a field that is missing? Open an issue in the **Issues** tab and we'll take a look.

# Actor input Schema

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

Public Facebook post URLs to scrape comments from. Supported: /posts/ links, share links (https://www.facebook.com/share/p/...), permalink.php, photo, video and reel links. Page or profile URLs are skipped.

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

Maximum number of top-level comments to scrape per post. 0 means all comments.

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

Also scrape replies (and replies to replies). Each reply is saved as its own row, linked to its comment by parentCommentId.

## `maxRepliesPerComment` (type: `integer`):

Maximum number of replies to scrape for each comment. 0 means all replies.

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

Proxy used for the requests. If runs get blocked, switch to the RESIDENTIAL proxy group.

## `cookies` (type: `string`):

Cookie string such as 'c_user=...; xs=...', or a JSON cookie export. Only for posts that are not visible without logging in.

## `fbDtsg` (type: `string`):

fb_dtsg token matching the cookies above.

## Actor input object example

```json
{
  "postUrls": [
    {
      "url": "https://www.facebook.com/NASA/posts/pfbid0dPToN66CzcAHGMoaNe3jszH4FfBKvqkE5gogCNJkTxXDPsSGYrGvcVwsLgByyMQQl"
    }
  ],
  "maxComments": 50,
  "includeReplies": true,
  "maxRepliesPerComment": 0,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "postUrls": [
        {
            "url": "https://www.facebook.com/NASA/posts/pfbid0dPToN66CzcAHGMoaNe3jszH4FfBKvqkE5gogCNJkTxXDPsSGYrGvcVwsLgByyMQQl"
        }
    ],
    "maxComments": 50,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("dataji/facebook-comments-replies-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": [{ "url": "https://www.facebook.com/NASA/posts/pfbid0dPToN66CzcAHGMoaNe3jszH4FfBKvqkE5gogCNJkTxXDPsSGYrGvcVwsLgByyMQQl" }],
    "maxComments": 50,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("dataji/facebook-comments-replies-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": [
    {
      "url": "https://www.facebook.com/NASA/posts/pfbid0dPToN66CzcAHGMoaNe3jszH4FfBKvqkE5gogCNJkTxXDPsSGYrGvcVwsLgByyMQQl"
    }
  ],
  "maxComments": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call dataji/facebook-comments-replies-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dataji/facebook-comments-replies-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/QVgIA0xifLIYqyQ1B/builds/1pYDj5DCL8XbWfczW/openapi.json
