# Facebook comment scraper (`curious_coder/facebook-comment-scraper`) Actor

Scrape comments from facebook posts from a user, page, group member etc.

- **URL**: https://apify.com/curious\_coder/facebook-comment-scraper.md
- **Developed by:** [Curious Coder](https://apify.com/curious_coder) (community)
- **Categories:** Social media
- **Stats:** 1,033 total users, 3 monthly users, 98.4% runs succeeded, 22 bookmarks
- **User rating**: 4.18 out of 5 stars

## Pricing

$25.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#rental-actors

## 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

Scrape comments from any facebook post including posts from a person, page, group member, videos, etc

Extract information such as comment text, author details, time, likes count, replies count, etc

### Features:

- Can access any post that you have access to
- Low error rate
- Can resume from point of failure
- Proxy support
- Customizable random delay ranges

Check out other similar scrapers:

- [Youtube comment scraper](https://apify.com/supreme_coder/youtube-comment-scraper/)
- [Linkedin comment scraper](https://apify.com/curious_coder/linkedin-comment-scraper/)
- [Twitter comment scraper](https://apify.com/curious_coder/twitter-replies-scraper)

### Sample output data

```json
{
	"created_time": 1692626437,
	"is_author_original_poster": false,
	"attachments": [],
	"text": "I have 10k month free credit plan I am getting this lead with hexofy",
	"entities": [],
	"url": "https://www.facebook.com/groups/coldemailmasterclass/permalink/686178806860776/?comment_id=686628886815768",
	"comment_count": 0,
	"reaction_count": 0,
	"author_id": "100007103078485",
	"author_name": "Nutan Patel",
	"author_gender": "MALE",
	"author_url": "https://www.facebook.com/shiyaniyanutan2",
	"author_picture": "https://scontent.fixe4-1.fna.fbcdn.net/v/t39.30808-1/274787192_3151568625089876_619413426434793732_n.jpg?stp=cp0_dst-jpg_p32x32&_nc_cat=110&ccb=1-7&_nc_sid=7206a8&_nc_ohc=6I5Wg71jA54AX8lR1rl&_nc_oc=AQlJ_VS8CWlDwwgTAOGEOPNQNdD76N_O5acisOALIAVKKAnASxE1STDbnE6SWpn-Sb-MLQWaz5IQunxhzdzGrP53&_nc_ht=scontent.fixe4-1.fna&oh=00_AfCLbJJLluiHD-xxfTCBgXvbfX4kdaJI-9rg39px-UrPFg&oe=64E7F408",
	"author_is_verified": false,
	"author_short_name": "Nutan",
	"author_work_info": null
}
```

# Actor input Schema

## `cookies` (type: `array`):

Cookie used to authorize actor with facebook.com. Install [Cookie-Editor](https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm) chrome extension. Login to your facebook.com account. Click on the extension and export the facebook.com cookies. Insert the contents here

## `scrapeComments.postUrl` (type: `string`):

No description

## `sortType` (type: `string`):

No description

## `scrapeUntil` (type: `string`):

Use this field if you want to only scrape posts newer than given date

## `count` (type: `integer`):

Leave this field empty if you want to scrape all items.

## `cursor` (type: `string`):

Use this field if you want to resume scraping from where the scraper stopped last time.

## `minDelay` (type: `integer`):

Minimum duration in seconds to wait before scraping next page

## `maxDelay` (type: `integer`):

Maximum duration in seconds to wait before scraping next page

## `proxy` (type: `object`):

Choose a proxy from the country where you are logged into Facebook

## Actor input object example

```json
{
  "sortType": "most_relevant",
  "cursor": "",
  "minDelay": 1,
  "maxDelay": 3,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyCountry": "US"
  }
}
```

# 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 = {
    "sortType": "most_relevant",
    "minDelay": 1,
    "maxDelay": 3,
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("curious_coder/facebook-comment-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 = {
    "sortType": "most_relevant",
    "minDelay": 1,
    "maxDelay": 3,
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("curious_coder/facebook-comment-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 '{
  "sortType": "most_relevant",
  "minDelay": 1,
  "maxDelay": 3,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyCountry": "US"
  }
}' |
apify call curious_coder/facebook-comment-scraper --silent --output-dataset

```

## MCP server setup

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