# Facebook Post Comments Scraper (`easyapi/facebook-post-comments-scraper`) Actor

Effortlessly extract comments from public Facebook posts. This actor automates comment collection, providing detailed information such as author details, comment text, and timestamps. Ideal for social media analysis, sentiment analysis, and market research.

- **URL**: https://apify.com/easyapi/facebook-post-comments-scraper.md
- **Developed by:** [EasyApi](https://apify.com/easyapi) (community)
- **Categories:** Social media
- **Stats:** 1,202 total users, 21 monthly users, 100.0% runs succeeded, 22 bookmarks
- **User rating**: 3.46 out of 5 stars

## Pricing

from $2.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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 Post Comments Scraper

Effortlessly extract comments from any public Facebook post.

### Features

- 🔍 Scrape comments from any public Facebook post URL
- 📊 Extract detailed information about each comment and commenter
- 🔢 Set a custom limit for the number of comments to scrape
- 🚀 Uses browser automation to handle dynamic content
- 🛡️ Incorporates anti-detection measures for reliable scraping

### Description

The Facebook Comments Scraper is a powerful tool designed to automate the process of extracting comments from public Facebook posts. It navigates through the comments section, scrolling and loading more content as needed, to collect comprehensive information about each comment and its author.

### Input Parameters

| Field | Type | Description |
| --- | --- | --- |
| `postUrls` | Array | List of Facebook post URLs to scrape comments from |
| `maxComments` | Integer | Maximum number of comments to scrape for each post (default: 100, max: 5000) |

### Output

The actor provides detailed information for each comment, including:

- `postUrl`: The Post URL
- `id`: Unique identifier for the comment
- `feedbackId`: Feedback identifier associated with the comment
- `userName`: Name of the comment author
- `userGender`: Gender of the comment author
- `userProfileImageUrl`: URL of the author's profile picture
- `userUrl`: URL to the author's Facebook profile
- `userId`: Unique identifier for the comment author
- `userIsVerified`: Boolean indicating if the user is verified
- `userSubscribeStatus`: Subscription status of the user
- `commentText`: The actual text content of the comment
- `commentDate`: Timestamp of when the comment was posted (formatted as yyyy-MM-dd HH:mm:ss)
- `facebookUrl`: URL of the Facebook post where the comment appears

This comprehensive data allows for in-depth analysis of comments and user interactions on Facebook posts.

### Use Cases

- Social media analysis: Gather insights from user comments on popular posts
- Sentiment analysis: Collect data for analyzing public opinion on specific topics
- Market research: Understand customer feedback and reactions to products or announcements
- Trend spotting: Identify emerging topics and discussions within comment threads
- Community engagement: Monitor and analyze user interactions on your own posts

#### Input Example

A full explanation of an input example in JSON.

```
{
  "postUrls": [
      "https://www.facebook.com/humansofnewyork/posts/pfbid023TQobFe3VzSt9xUUF8RuLgSHXLar7W1yuf8SVKbi7mizhydEmj3av6mVda3QHKWnl?rdid=4g9xxnMySOyqm6iM",
      "https://www.facebook.com/747039650800537/posts/825976249573543"
  ],
  "maxComments": 100
}
```

#### Output sample

The results will be wrapped into a dataset which you can always find in the **Storage** tab. Here's an excerpt from the data you'd get if you apply the input parameters above:

And here is the same data but in JSON. You can choose in which format to download your data: JSON, JSONL, Excel spreadsheet, HTML table, CSV, or XML.

```
[
  {
    postUrl: "https://www.facebook.com/humansofnewyork/posts/pfbid023TQobFe3VzSt9xUUF8RuLgSHXLar7W1yuf8SVKbi7mizhydEmj3av6mVda3QHKWnl?rdid=4g9xxnMySOyqm6iM",
    "id": "Y29tbWVudDoxMDE1NzcyNzQ2NzgwMzgxXzEyMTM5NDA4ODk2NTYwNTk=",
    "feedbackId": "ZmVlZGJhY2s6MTAxNTc3Mjc0Njc4MDM4MV8xMjEzOTQwODg5NjU2MDU5",
    "userName": "Eyad Yousif",
    "userGender": "MALE",
    "userProfileImageUrl": "https://scontent-ams4-1.xx.fbcdn.net/v/t39.30808-1/346882490_3448567935415083_8378378714079836093_n.jpg?stp=dst-jpg_s100x100&_nc_cat=105&ccb=1-7&_nc_sid=0ecb9b&_nc_ohc=KIZA1GzPKG0Q7kNvgGX9z9n&_nc_ht=scontent-ams4-1.xx&_nc_gid=AA1C_l38FdAypiXxa7dJR3H&oh=00_AYAkaN8a_W4c0rpp5WnMhAUC8nfPL8wqhU1Zbz_CxrOjuw&oe=6709927E",
    "userUrl": "https://www.facebook.com/eiad.yousif",
    "userId": "100000294039465",
    "userIsVerified": false,
    "userSubscribeStatus": "CAN_SUBSCRIBE",
    "commentText": "🌟 Hey everyone! 🌟\nIf you're into health, fitness, and living your best life, come check out my YouTube channel! 🎥 I share easy tips, fun workouts, and healthy recipes that can transform your routine. Join our community, subscribe, and let’s grow together on this journey to a fitter, happier lifestyle! 💪💚\nHere’s the link to my channel: [https://www.youtube.com/@FitLifeJourney-y6n/shorts]\n\nDon't forget to like, comment, and subscribe to support the channel. Every bit of love helps, and I appreciate you all! 😊🙏",
    "commentDate": "2024-10-05 11:57:18",
    "facebookUrl": "https://www.facebook.com/humansofnewyork/posts/pfbid023TQobFe3VzSt9xUUF8RuLgSHXLar7W1yuf8SVKbi7mizhydEmj3av6mVda3QHKWnl"
  },
  {
    "postUrl": "https://www.facebook.com/humansofnewyork/posts/pfbid023TQobFe3VzSt9xUUF8RuLgSHXLar7W1yuf8SVKbi7mizhydEmj3av6mVda3QHKWnl?rdid=4g9xxnMySOyqm6iM",
    "id": "Y29tbWVudDoxMDE1NzcyNzQ2NzgwMzgxXzQ3OTU4MDMyMTExNTE1OQ==",
    "feedbackId": "ZmVlZGJhY2s6MTAxNTc3Mjc0Njc4MDM4MV80Nzk1ODAzMjExMTUxNTk=",
    "userName": "Marissa Brake",
    "userGender": "FEMALE",
    "userProfileImageUrl": "https://scontent-ams2-1.xx.fbcdn.net/v/t1.6435-1/36268638_10216302734987149_541928021242675200_n.jpg?stp=dst-jpg_s100x100&_nc_cat=108&ccb=1-7&_nc_sid=e4545e&_nc_ohc=rLD6bdK__p8Q7kNvgH_AQWE&_nc_ht=scontent-ams2-1.xx&_nc_gid=AA1C_l38FdAypiXxa7dJR3H&oh=00_AYA0LVVlKtEWKQTGOJq1ipyILKryFeqL7gtA3tCiwogA6A&oe=672B5C30",
    "userUrl": "https://www.facebook.com/marissa.gonzalesperez",
    "userId": "1417122595",
    "userIsVerified": false,
    "userSubscribeStatus": "CANNOT_SUBSCRIBE",
    "commentText": "The excitement when I saw HONY pop up- I have truly missed your posts! \nBoth of them are beautiful! \nHoping this is the beginning of more to come!!! 🩷",
    "commentDate": "2024-06-11 00:36:33",
    "facebookUrl": "https://www.facebook.com/humansofnewyork/posts/pfbid023TQobFe3VzSt9xUUF8RuLgSHXLar7W1yuf8SVKbi7mizhydEmj3av6mVda3QHKWnl"
  },
  ...
]
```

# Actor input Schema

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

List of Facebook post URLs to scrape comments from

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

Maximum number of comments to scrape for each post

## Actor input object example

```json
{
  "postUrls": [
    "https://www.facebook.com/747039650800537/posts/825976249573543",
    "https://facebook.com/humansofnewyork/posts/pfbid0BYUSZHXEfzKEd5DCVNzSNmTZgH1ukiMjKX2rF21jVXrMBqc2PZzsNLWRdbjoKaVSl?rdid=iZqujYXViSYkU5WP"
  ],
  "maxComments": 100
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("easyapi/facebook-post-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("easyapi/facebook-post-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 '{}' |
apify call easyapi/facebook-post-comments-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/0MWDTb4rHcMY5RIw8/builds/YbvIPqbg5lNcfbvFr/openapi.json
