# Facebook Comments Scraper (`harpoon/fb-comments-scraper`) Actor

Scrape comments (and nested replies) from Facebook posts, photos and reels. Pushes one dataset item per fetched comments batch.

- **URL**: https://apify.com/harpoon/fb-comments-scraper.md
- **Developed by:** [Harpoon](https://apify.com/harpoon) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.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.
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 every comment (and nested reply) from Facebook posts, photos, reels, and public-group posts — author, text, timestamp, reaction and reply counts, and a direct link — as clean, ready-to-use rows.

- **Whole threads, not just the top.** Follow replies as deep as you need and rebuild the conversation from a flat dataset.
- **Public groups included.** Drop in a group post link and pull its comments the same way as a profile post.
- **Public data only.** No login, cookies, or account required.
- **Built to finish.** Large threads are capped predictably, and every result carries the IDs you need to join it back to the post.
- **One row per comment.** Export to JSON, CSV, Excel, or XML straight from the dataset.

> Built for brand monitoring, sentiment and UGC research, community moderation, and enriching AI/LLM datasets.

### What can Facebook Comments Scraper do?

| Input mode | What it does |
|------------|--------------|
| `targets` (post / photo / reel URLs) | Pull every comment on the given posts. |
| Public-group post URLs | Pull every comment on a post inside a public group. |
| Feedback IDs | Target a post by its Facebook feedback ID instead of a URL. |

You control **how many** comments come back (`max_comments`) and **how deep** replies are followed (`max_depth`), and you can choose the comment order (most relevant or newest).

Every run also gives you export to JSON / CSV / Excel / XML, API and webhook access, scheduled runs, and MCP access for AI agents.

### What data can you get?

One row per comment (or reply), with these fields:

| 📦 Group | 🔎 Fields |
|----------|-----------|
| **Comment** | `id`, `legacy_fbid`, `text`, `created_time` (unix), `url` |
| **Thread** | `depth` (0 = top level), `parent_id` (the comment this replies to), `reply_count` |
| **Engagement** | `reaction_count` |
| **Author** | `author.id`, `author.name`, `author.url`, `author.profile_picture` |
| **Status / meta** | `feedback_id`, `is_hidden_by_viewer`, `is_disabled`, `expansion_token` |

### How to use Facebook Comments Scraper

1. [Create](https://console.apify.com/sign-up) a free Apify account.
2. Open **Facebook Comments Scraper** in Apify Console.
3. Paste one or more post, photo, reel, or public-group post URLs into **Posts / Photos / Reels / Group posts**.
4. Optionally set **Max comments per target** and **Max reply depth**.
5. Click **Start** and wait for the run to finish.
6. Download from **Storage ▸ Dataset** as JSON, CSV, Excel, or XML.

### Input

There are two ways to identify a post — use either (they can be mixed in the same list):

- **URL** — paste the post, photo, reel, or public-group post URL, e.g.
  `https://www.facebook.com/DwayneJohnson/posts/pfbid02...` or
  `https://www.facebook.com/groups/dataminers/permalink/1282751752133803/`.
- **Feedback ID** — a base64 ID, a numeric object ID, or `feedback:<id>`. This is useful when you already store Facebook object IDs.

#### Comments

- `max_comments` — hard cap on total comments per target, **including replies** (default `100`). The final page is trimmed so the total never exceeds it.
- `max_depth` — `0` = top-level comments only (default); `1` = include replies; `2` = replies of replies, and so on.
- `intent` — comment order: **Most relevant** or **Newest**.

#### Request options

- `language` — locale used when requesting the comments.

**Example input**

```json
{
  "targets": [
    "https://www.facebook.com/DwayneJohnson/posts/pfbid02YXFDKmNP56NTXHr2ubG4sxZH69A4L9t3z7EtToNFkEBjHcqs4TJxwAKepcSWBhjvl",
    "https://www.facebook.com/groups/dataminers/permalink/1282751752133803/"
  ],
  "max_comments": 100,
  "max_depth": 1,
  "intent": "RANKED_UNFILTERED_CHRONOLOGICAL_REPLIES_INTENT_V1",
  "language": "en"
}
```

See the **Input** tab above for every field and its default.

### Output

Results land in the default dataset under **Storage ▸ Dataset**. A built-in **Overview** view (author, comment, depth, created, reactions, replies, URL) makes the data readable immediately. Download as JSON, CSV, Excel, or XML.

**Sample comment**

```json
{
  "id": "Y29tbWVudDoxNjQ0NzMxMjAwMzQ0Njg0XzE2MDM1NDc2NjEzNjUyODI=",
  "legacy_fbid": "1603547661365282",
  "depth": 0,
  "parent_id": "",
  "text": "I sincerely can't wait to see how you show this disease...",
  "author": { "id": "1519015377", "name": "Paul Jurado", "profile_picture": "https://..." },
  "created_time": 1788952909,
  "feedback_id": "ZmVlZGJhY2s6MTY0NDczMTIwMDM0NDY4NF8xNjAzNTQ3NjYxMzY1Mjgy",
  "reaction_count": 1,
  "reply_count": 0,
  "url": "https://www.facebook.com/DwayneJohnson/posts/...?comment_id=1603547661365282"
}
```

Replies look the same, with `depth >= 1` and `parent_id` set to the parent comment's `id`. Because `parent_id` and `depth` are on every row, you can rebuild the full thread from the flat dataset, or filter to top-level comments only with `depth = 0`.

### Use cases

1. **Brand and campaign monitoring** — collect comments on your posts, filter to `depth = 0`, and track `reaction_count` over time.
2. **Sentiment and topic analysis** — export comment `text` for keyword, sentiment, or topic modeling.
3. **Community moderation** — pull replies (`max_depth: 1`+) and surface the most-reacted comments for review.
4. **Competitor research** — compare comment volume and engagement across pages.
5. **AI / LLM datasets** — use the structured fields (author, text, timestamps, reactions) to build conversation datasets.

### How much does it cost?

Facebook Comments Scraper is priced **per result** (pay-per-result) at **$1.00 per 1,000 comments** ($0.001 each), plus a small Apify platform fee. Starting a run is free.

- 1,000 comments ≈ **$1.00** in actor cost.
- 5,000 comments ≈ **$5.00**.
- Filtered-out or failed items are not charged.

See the **Pricing** tab for plan discounts.

### FAQ

**Do I need a Facebook account, login, or cookies?**
No. The actor reads publicly available comments — no login, cookies, or account required.

**Can it scrape comments on public group posts?**
Yes. Paste the group post link (for example `https://www.facebook.com/groups/<group>/permalink/<id>/`) or its numeric id as a target.

**Can it get private or restricted comments?**
No. It only returns comments that are visible publicly. Content behind a login wall or a private group isn't accessible.

**How many comments can I get?**
`max_comments` (default `100`) caps the total per target, including replies. You can raise it, but very large threads take longer.

**Can it get replies, or only top-level comments?**
Both. Set `max_depth` to `1` to include replies, `2` for replies of replies, and so on. `0` returns top-level comments only.

**Why do the numbers differ from what I see when logged in?**
Public views can show fewer comments or different reaction counts than a logged-in session. The dataset reflects what is publicly available at run time.

**Is it legal to extract this data?**
Results may contain personal data, which is protected by GDPR and similar laws. Only scrape personal data when you have a legitimate reason, and follow the terms of the data source and your local laws.

**Can I use it from the API, SDKs, or an AI agent?**
Yes — use the **API** tab for JavaScript, Python, REST, and CLI examples, or connect the Apify MCP server to call it from Claude, ChatGPT, or another MCP client.

**Something isn't working.**
Check that each target is a valid post/photo/reel URL or feedback ID. If it still fails, open an issue in the **Issues** tab with your input JSON.

### Notes and limitations

- **Public content only** — private posts, private/restricted groups, and login-walled comments are not available. Public-group posts must be reachable without logging in.
- **`max_comments` is a hard cap** that includes replies; the final page is trimmed so the total is never exceeded.
- **Deep threads can be large** — raising `max_depth` increases runtime and cost quickly.
- **Personal data** — comments contain names and, sometimes, other personal data. Handle the results accordingly.
- **Counts can differ from the logged-in view** — hidden, deleted, or viewer-specific comments won't appear.

### Integrations

Call the actor from your own code or an AI agent — see the **API** tab for JavaScript, Python, REST, and CLI. MCP clients can add the actor via the Apify MCP server. Schedule runs or trigger them with webhooks from Apify Console.

### Support

Found a bug or have feedback? Open an issue in the **Issues** tab, or email **islam.tazerout@outlook.com**.

# Actor input Schema

## `targets` (type: `array`):

Post, photo, reel, or public-group post URLs, or feedback IDs (base64, numeric object id, or <code>feedback:\<id></code>). Group post links look like <code>https://www.facebook.com/groups/\<group>/permalink/\<id>/</code>. Add one per line, or paste a list with <b>Bulk edit</b>. Duplicates are removed automatically.

## `max_comments` (type: `integer`):

Hard cap on the total number of comments (including replies) returned per target. The final page is trimmed so the total never exceeds this number.

## `max_depth` (type: `integer`):

How deep to follow replies: <code>0</code> = top-level comments only, <code>1</code> = include replies, <code>2</code> = replies of replies, and so on. Replies count toward the cap above.

## `intent` (type: `string`):

Order in which comments are returned.

## `language` (type: `string`):

Locale used when requesting the comments. Comments are returned in the language Facebook provides for that locale.

## Actor input object example

```json
{
  "targets": [
    "https://www.facebook.com/DwayneJohnson/posts/pfbid02YXFDKmNP56NTXHr2ubG4sxZH69A4L9t3z7EtToNFkEBjHcqs4TJxwAKepcSWBhjvl",
    "https://www.facebook.com/groups/dataminers/permalink/1282751752133803/",
    "feedback:ZmVlZGJhY2s6MTY0NDczMTIwMDM0NDY4NF8xNjAzNTQ3NjYxMzY1Mjgy"
  ],
  "max_comments": 100,
  "max_depth": 0,
  "intent": "RANKED_UNFILTERED_CHRONOLOGICAL_REPLIES_INTENT_V1",
  "language": "en"
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per scraped comment or reply. Export as JSON, CSV, Excel, or XML.

# 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 = {
    "targets": [
        "https://www.facebook.com/DwayneJohnson/posts/pfbid02YXFDKmNP56NTXHr2ubG4sxZH69A4L9t3z7EtToNFkEBjHcqs4TJxwAKepcSWBhjvl"
    ],
    "max_comments": 100,
    "max_depth": 0,
    "intent": "RANKED_UNFILTERED_CHRONOLOGICAL_REPLIES_INTENT_V1",
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("harpoon/fb-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 = {
    "targets": ["https://www.facebook.com/DwayneJohnson/posts/pfbid02YXFDKmNP56NTXHr2ubG4sxZH69A4L9t3z7EtToNFkEBjHcqs4TJxwAKepcSWBhjvl"],
    "max_comments": 100,
    "max_depth": 0,
    "intent": "RANKED_UNFILTERED_CHRONOLOGICAL_REPLIES_INTENT_V1",
    "language": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("harpoon/fb-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 '{
  "targets": [
    "https://www.facebook.com/DwayneJohnson/posts/pfbid02YXFDKmNP56NTXHr2ubG4sxZH69A4L9t3z7EtToNFkEBjHcqs4TJxwAKepcSWBhjvl"
  ],
  "max_comments": 100,
  "max_depth": 0,
  "intent": "RANKED_UNFILTERED_CHRONOLOGICAL_REPLIES_INTENT_V1",
  "language": "en"
}' |
apify call harpoon/fb-comments-scraper --silent --output-dataset

```

## MCP server setup

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