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

🔥$0.40/1000 comments🔥. Scrape comments from any public Facebook post, reel, or video. Get comment text, author name, likes, timestamps, and reply counts. Supports bulk scraping across multiple posts. No login required from users. MCP, API integration optimised.

- **URL**: https://apify.com/scrapesmith/facebook-comments-scraper.md
- **Developed by:** [Scrape Smith](https://apify.com/scrapesmith) (community)
- **Categories:** Social media, Automation, Developer tools
- **Stats:** 4 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 comments from any public Facebook post, reel, or video at scale. Collect comment text, author details, timestamps, like counts, and reply metadata — ready for export as JSON, CSV, or Excel.

### 🔍 What does Facebook Comments Scraper do?

This scraper collects all publicly visible comments from Facebook posts. Just paste one or more post URLs and the scraper returns structured data for every comment, including replies.

Use it for 📊 **brand monitoring**, 🧠 **sentiment analysis**, 🕵️ **competitor research**, 👂 **social listening**, 📝 **content analysis**, 📸 **UGC collection**, and 📈 **market research**.

### 📦 What data can you extract?

For every comment, the scraper returns:

| Field | Description |
|-------|-------------|
| `text` | 💬 Full comment text |
| `authorName` | 👤 Commenter's display name |
| `authorId` | 🆔 Commenter's Facebook user ID |
| `commentId` | 🔖 Unique comment ID |
| `likesCount` | 👍 Number of likes/reactions on the comment |
| `timestamp` | 🕐 Unix timestamp (milliseconds) when the comment was posted |
| `isReply` | ↩️ Whether this is a reply to another comment |
| `postUrl` | 🔗 URL of the parent post |

### 🚀 How to scrape Facebook comments

1. 🔗 **Go to the Facebook post** you want to scrape comments from
2. 📋 **Copy the post URL** from your browser's address bar
3. 📝 **Paste the URL(s)** into the scraper input
4. 🔢 **Set the limit** — how many comments per post (default: 500)
5. ▶️ **Run the scraper** and download your data

#### 🌐 Supported URL formats

- 📄 Page posts: `https://www.facebook.com/PageName/posts/123456789`
- 🎬 Video posts: `https://www.facebook.com/PageName/videos/123456789`
- 🎞️ Reel posts: `https://www.facebook.com/reel/123456789`
- 🔗 Permalink format: `https://www.facebook.com/permalink.php?story_fbid=...`
- 🔗 Short links: `https://fb.watch/...`

### ⚙️ Input parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `postUrls` | Array of strings | 🔗 List of Facebook post URLs to scrape comments from |
| `maxCommentsPerPost` | Integer | 🔢 Maximum comments to collect per post (default: 500, max: 50,000) |
| `viewOption` | String | 🔀 Comment sort order: `RANKED_UNFILTERED` (All), `RANKED_THREADED` (Most relevant), `RECENT_ACTIVITY` (Newest first) |
| `includeReplies` | Boolean | 💬 Include reply comments nested under top-level comments (default: true) |

### 📥 Example input

```json
{
    "postUrls": [
        "https://www.facebook.com/Meta/posts/1075637535125456",
        "https://www.facebook.com/cnn/posts/1194948395660316"
    ],
    "maxCommentsPerPost": 1000
}
````

### 📤 Example output

```json
{
    "postUrl": "https://www.facebook.com/Meta/posts/1075637535125456",
    "text": "This is amazing! Love the community spirit 🎳",
    "authorName": "John Smith",
    "authorId": "100012345678",
    "likesCount": 42,
    "timestamp": 1783701511000
}
```

### 💰 How much does it cost to scrape Facebook comments?

The scraper uses Apify's pay-per-result pricing. You only pay for the comments you actually get.

- 🆓 **Free tier**: 10 comments per run — test before you buy, no credit card needed
- ⚡ **Performance**: ~600 comments per minute
- 🪶 **Memory**: Runs on just 128 MB — minimal compute cost

Check the **Pricing** tab above for current per-result rates.

### 💡 Use cases

#### 📊 Brand monitoring & reputation management

Track what customers say about your brand, products, or services across Facebook. Collect comments from your brand's posts or competitor pages to measure sentiment and spot issues early.

#### 🧠 Sentiment analysis & NLP

Feed structured comment data into your sentiment analysis pipeline. Each comment includes text, timestamp, and engagement metrics — perfect for time-series sentiment tracking.

#### 🕵️ Competitor research

Analyze how audiences respond to competitor content. Compare engagement patterns, identify common complaints, and discover what resonates with their audience.

#### 📸 Content research & UGC

Find user-generated content, testimonials, and authentic customer feedback. Identify brand advocates and understand what drives engagement.

#### 👂 Social listening at scale

Monitor comments across dozens of posts simultaneously. Set up recurring runs to track conversations over time.

#### 🎓 Academic & market research

Collect public Facebook comment data for research purposes. Export as CSV or JSON for analysis in Python, R, SPSS, or Excel.

### 🔌 Integrations

Connect Facebook Comments Scraper to your workflow:

- 📊 **Google Sheets** — auto-export comments to a spreadsheet
- 💬 **Slack / Discord** — get notified when scraping completes
- ⚡ **Zapier / Make** — trigger downstream workflows
- 🪝 **Webhooks** — POST results to your own API
- ☁️ **Amazon S3 / Google Cloud** — store datasets in cloud storage

Use the [Apify API](https://docs.apify.com/api) or any of the official [Apify client libraries](https://docs.apify.com/api/client/js) (JavaScript, Python) to integrate programmatically.

### 🤖 MCP server integration (AI agents & LLMs)

This actor works as a **tool for AI agents** via the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp). Connect it to **Claude**, **ChatGPT**, **Cursor**, **Windsurf**, or any MCP-compatible AI assistant to let your agent scrape Facebook comments on demand.

#### 🟣 Use with Claude Desktop / Claude Code

Add the Apify MCP server to your Claude config:

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": ["-y", "@anthropic-ai/apify-mcp-server"],
            "env": {
                "APIFY_API_TOKEN": "YOUR_APIFY_TOKEN"
            }
        }
    }
}
```

Then ask Claude: *"Scrape comments from this Facebook post: https://www.facebook.com/Meta/posts/1075637535125456"*

#### 🟢 Use with OpenAI / GPT agents

Apify actors are available as OpenAI tools via the Apify platform. See [Apify + OpenAI integration docs](https://docs.apify.com/platform/integrations/openai).

#### 🦜 Use with LangChain / LlamaIndex

```python
from langchain_community.utilities import ApifyWrapper

apify = ApifyWrapper()
loader = apify.call_actor(
    actor_id="YOUR_ACTOR_ID",
    run_input={"postUrls": ["https://www.facebook.com/Meta/posts/1075637535125456"]},
    dataset_mapping_function=lambda item: item["text"],
)
```

#### 🧩 Why use this with AI agents?

- 🔬 **Research automation**: Let your agent collect and analyze Facebook discussions autonomously
- 📚 **RAG pipelines**: Feed real-time Facebook comment data into retrieval-augmented generation
- 📊 **Sentiment workflows**: Agent scrapes comments → analyzes sentiment → generates report
- 🕵️ **Competitive intel**: Agent monitors competitor Facebook pages and summarizes audience reactions

### 🔧 API access

Call the scraper from your code using the Apify API:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("YOUR_ACTOR_ID").call(run_input={
    "postUrls": ["https://www.facebook.com/Meta/posts/1075637535125456"],
    "maxCommentsPerPost": 500,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["authorName"], item["text"][:80])
```

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('YOUR_ACTOR_ID').call({
    postUrls: ['https://www.facebook.com/Meta/posts/1075637535125456'],
    maxCommentsPerPost: 500,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach(item => console.log(item.authorName, item.text));
```

### ❓ FAQ

#### 🔐 Does this scraper need my Facebook login?

No. The scraper works without your Facebook credentials.

#### 🔢 How many comments can I scrape?

Up to 50,000 comments per post. Most posts have fewer than 10,000 comments.

#### 🔒 Can I scrape comments from private posts or groups?

No. Only publicly visible comments are accessible.

#### ⚡ How fast is it?

\~600 comments per minute on average. A post with 1,000 comments takes about 2 minutes.

#### 💬 Does it include replies to comments?

Yes. The "All comments" mode captures top-level comments and all replies.

#### 📱 What Facebook post types are supported?

Regular posts, photos, videos, reels, live videos, and shared posts from public pages and profiles.

#### 🔍 Can I filter comments by date or keyword?

The scraper collects all comments with timestamps. Use the exported data to filter by date, keyword, or any other field in your analysis tool.

#### ⚖️ Is scraping Facebook comments legal?

This scraper only accesses publicly visible data. Always review Facebook's Terms of Service and applicable data protection regulations (GDPR, CCPA) before using scraped data.

# Actor input Schema

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

List of Facebook post URLs to scrape comments from.

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

Maximum number of comments to scrape per post.

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

Choose how comments are sorted.

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

Include reply comments (nested under top-level comments). Disable to get only top-level comments.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.facebook.com/Meta/posts/1075637535125456"
  ],
  "maxCommentsPerPost": 500,
  "viewOption": "RANKED_UNFILTERED",
  "includeReplies": true
}
```

# 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/Meta/posts/1075637535125456"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapesmith/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/Meta/posts/1075637535125456"] }

# Run the Actor and wait for it to finish
run = client.actor("scrapesmith/facebook-comments-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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/Meta/posts/1075637535125456"
  ]
}' |
apify call scrapesmith/facebook-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapesmith/facebook-comments-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Comments Scraper",
        "description": "🔥$0.40/1000 comments🔥. Scrape comments from any public Facebook post, reel, or video. Get comment text, author name, likes, timestamps, and reply counts. Supports bulk scraping across multiple posts. No login required from users. MCP, API integration optimised.",
        "version": "0.0",
        "x-build-id": "35Rkyeg6hh25XzKVJ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapesmith~facebook-comments-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapesmith-facebook-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/scrapesmith~facebook-comments-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapesmith-facebook-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/scrapesmith~facebook-comments-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapesmith-facebook-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "postUrls"
                ],
                "properties": {
                    "postUrls": {
                        "title": "Post URLs",
                        "type": "array",
                        "description": "List of Facebook post URLs to scrape comments from.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxCommentsPerPost": {
                        "title": "Max Comments Per Post",
                        "minimum": 1,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Maximum number of comments to scrape per post.",
                        "default": 500
                    },
                    "viewOption": {
                        "title": "Comments Sort Order",
                        "enum": [
                            "RANKED_UNFILTERED",
                            "RANKED_THREADED",
                            "RECENT_ACTIVITY"
                        ],
                        "type": "string",
                        "description": "Choose how comments are sorted.",
                        "default": "RANKED_UNFILTERED"
                    },
                    "includeReplies": {
                        "title": "Include Replies",
                        "type": "boolean",
                        "description": "Include reply comments (nested under top-level comments). Disable to get only top-level comments.",
                        "default": true
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
