# Facebook: Page Posts, Links & Comments (`deepmine/facebook`) Actor

Facebook scraper for public Page posts and comments. Paste a Page link to export posts with text, reactions, shares and links. Add comments in a separate dataset.

- **URL**: https://apify.com/deepmine/facebook.md
- **Developed by:** [DeepMine](https://apify.com/deepmine) (community)
- **Categories:** Social media, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.79 / 1,000 posts

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?

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: Page Posts, Links & Comments

Facebook scraper for public Page posts and comments. Paste a Page link to export posts with text, reactions, shares and links. Add comments in a separate dataset.

### Try it: Public Page posts and comments

```json
{
  "startUrls": [
    {
      "url": "https://www.facebook.com/humansofnewyork"
    }
  ],
  "resultsLimit": 25,
  "includeComments": true,
  "maxCommentsPerPost": 5,
  "includeNestedComments": true
}
```

### Output

The result fields and dataset views match [facebook-scraper](https://apify.com/deepmine/facebook-scraper). Open the Output tab to see the result rows, or download the dataset as JSON or CSV.

- [Facebook comments](.actor/dataset_comments_schema.json)
- [Facebook posts](.actor/dataset_schema.json)

### Pricing

The primary result price per 1,000 rows is `USD 1.79/1.49/1.19/0.79` (Free / Starter / Scale / Business).
Comments and replies are optional and billed separately at USD 0.24 per 1,000 rows.

If this Actor helps, please leave a review on its Apify Store page.

# Actor input Schema

## `startUrls` (type: `array`):

Public Facebook pages, e.g. <code>https://www.facebook.com/humansofnewyork</code> (a page name like <code>nasa</code> works too), or links to single posts.

## `resultsLimit` (type: `integer`):

The newest posts to get from each page (empty: every post the page shows, like apify/facebook-posts-scraper). Facebook gives pages' posts newest first, years deep.

## `includeComments` (type: `boolean`):

Also get each post's comments, into a separate Comments dataset (the run's Output tab shows both). Each comment is charged as a 'comment' event, $0.24 per 1,000 comments, on top of the post. Off: no comments are read and none is charged.

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

Up to this many comments of each post (with 'Get each post's comments' on).

## `searchQueries` (type: `array`):

Words to search Facebook posts for, e.g. <code>black friday</code>. Each keyword returns public posts that match it, with the same fields as page posts plus <code>searchQuery</code>. 'Max posts' applies per keyword.

## `searchSortBy` (type: `string`):

Top results (Facebook's own order) or most recent first.

## `searchLocation` (type: `string`):

Only posts tagged at this place: a Facebook location ID like <code>106078429431815</code> (London), or the place's Facebook link, which ends in that ID. With a location, results come newest first (Facebook applies the filter to the recent order only). Every search row carries <code>taggedLocationId</code>, <code>taggedLocationName</code> and <code>taggedLocationUrl</code> when the post is tagged at a place.

## `captionText` (type: `boolean`):

Also get each video's captions as plain text (<code>transcriptText</code>), where the video has captions. Free: no extra charge. The captions file's link (<code>captionsUrl</code>) is in every video row either way.

## `onlyPostsNewerThan` (type: `string`):

Only posts published after this date: <code>2026-01-31</code>, an ISO time, or relative like <code>7 days</code>, <code>3 months</code>. The run stops reading a page once its posts are older.

## `onlyPostsOlderThan` (type: `string`):

Only posts published before this date (same formats).

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

Facebook's own comment orders.

## `includeNestedComments` (type: `boolean`):

Replies to comments (up to 3 levels), each as its own row with the comment it answers.

## `onlyCommentsNewerThan` (type: `string`):

Only comments written after this date (comments are then read newest first).

## `apifyCompatible` (type: `boolean`):

For code written against apify/facebook-posts-scraper's rows: <code>topComments</code> and <code>collaborators</code> hold objects (as <code>topCommentsDetails</code> and <code>collaboratorsDetails</code>), <code>collaborators</code> is <code>\[]</code> on a post without any, and a field the post has no value for is left out instead of <code>null</code>. Every other key stays as it is. Off: the rows as described on the Output tab.

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

Apify Proxy datacenter IPs by default.

## `residentialFallback` (type: `boolean`):

When Facebook refuses a datacenter IP, ask again on a residential one.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.facebook.com/humansofnewyork"
    }
  ],
  "resultsLimit": 25,
  "includeComments": true,
  "maxCommentsPerPost": 5,
  "searchSortBy": "top",
  "captionText": false,
  "viewOption": "RANKED_UNFILTERED",
  "includeNestedComments": true,
  "apifyCompatible": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "residentialFallback": true
}
```

# Actor output Schema

## `posts` (type: `string`):

No description

## `summary` (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 = {
    "startUrls": [
        {
            "url": "https://www.facebook.com/humansofnewyork"
        }
    ],
    "resultsLimit": 25,
    "includeComments": true,
    "maxCommentsPerPost": 5,
    "includeNestedComments": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("deepmine/facebook").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 = {
    "startUrls": [{ "url": "https://www.facebook.com/humansofnewyork" }],
    "resultsLimit": 25,
    "includeComments": True,
    "maxCommentsPerPost": 5,
    "includeNestedComments": True,
}

# Run the Actor and wait for it to finish
run = client.actor("deepmine/facebook").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 '{
  "startUrls": [
    {
      "url": "https://www.facebook.com/humansofnewyork"
    }
  ],
  "resultsLimit": 25,
  "includeComments": true,
  "maxCommentsPerPost": 5,
  "includeNestedComments": true
}' |
apify call deepmine/facebook --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,deepmine/facebook"
        }
    }
}
```

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/7AzZcsbGd3JFXGgxx/builds/ESbRX7FVUFS9YRQ7m/openapi.json
