# Facebook Posts Scraper (`deepmine/facebook-posts-scraper`) Actor

Scrape posts from any public Facebook page: text, reactions by type, comments and shares counts, video views, photos, links, hashtags and mentions, plus each post's comments and replies. Date filters, no login, no cookies, no browser.

- **URL**: https://apify.com/deepmine/facebook-posts-scraper.md
- **Developed by:** [DeepMine](https://apify.com/deepmine) (community)
- **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 Posts Scraper

Scrape posts from any public Facebook page: text, reactions by type, comments and shares counts, video views and
plays, photos, links, hashtags, mentions, the post's top comment and the page's Ad Library id. Optionally get each
post's comments and replies too. No login, no cookies, no browser.

| 🏷️ Page | 📝 Text | ❤️ Reactions | 💬 Comments | 🔁 Shares | 🎞️ Type | 📅 Posted |
|---|---|---|---|---|---|---|
| BBC News | Elon Musk has suggested that the US government may… | 73 | 34 | 11 | Photo | 2026-10-15T00:00:07Z |
| BBC News | Why has Donald Trump posted an AI video of himself… | 205 | 185 | 27 | Video | 2026-10-14T23:02:00Z |
| BBC News | President Donald Trump has ousted Kimberly Guilfoy… | 172 | 53 | 12 | Video | 2026-10-14T22:32:08Z |

<sub>Collected 2026-10-14 (local test run).</sub>

### Input

- **Facebook page or post links** (`startUrls`): pages like `https://www.facebook.com/humansofnewyork` (or just
  `humansofnewyork`), or single post links.
- **Posts per page** (`resultsLimit`): the newest N posts of each page; empty = every post the page shows.
- **Video transcripts** (`captionText`): each video's captions as plain text in `transcriptText`, where the video
  has captions. Free: no add-on charge.
- **Posts newer than / older than** (`onlyPostsNewerThan`, `onlyPostsOlderThan`): `2026-01-31`, an ISO time, or
  `7 days`, `3 months`. Free: no add-on charge.
- **Get comments of each post** (`includeComments`, `maxCommentsPerPost`, `viewOption`, `includeNestedComments`,
  `onlyCommentsNewerThan`): comments go to a separate Comments dataset.

The input keys are the same as apify/facebook-posts-scraper's and facebook-comments-scraper's (`maxPosts` and
`commentsSortOrder` work as aliases), so most existing inputs run as they are.

### Output

One row per post, the same keys in every row (null when Facebook doesn't show a value):

`thumbnailUrl`, `pageName`, `text`, `textSnippet`, `url`, `likes` (all reactions), `comments`, `shares`,
`viewsCount`, `videoPostViewCount`, `playCount`, `time`, `postType`, `isVideo`, `videoDurationSeconds`, `videoUrl`,
`captionsUrl`, `captionsLocale`, `transcriptText`, `reactionLikeCount`, `reactionLoveCount`, `reactionCareCount`, `reactionHahaCount`, `reactionWowCount`,
`reactionSadCount`, `reactionAngryCount`, `topReactionsCount`, `liveViewerCount`, `imageUrls`, `mediaUrls`,
`mediaIds`, `imageCaptions`, `mediaCount`, `link`, `previewTitle`, `previewDescription`, `previewSource`,
`previewImageUrl`, `previewTargetUrl`, `actionLinkTitle`, `actionLinkUrl`, `hashtags`, `mentions`, `textLinks`,
`collaborators`, `paidPartnership`, `sharedPostId`, `sharedPostUrl`, `sharedPostText`, `sharedPostAuthor`,
`sharedPostTime`, `topComments`, `topCommentsAuthors`, `topCommentsDetails`, `userName`, `userId`,
`userProfileUrl`, `userProfilePic`, `pageAdLibraryId`, `isBusinessPageActive`, `postId`, `feedbackId`,
`topLevelUrl`, `timestamp`, `timeCreated`, `timestampCreated`, `facebookUrl`, the apify-compatible group below,
`inputUrl`, `scrapedAt`.

**apify-compatible keys.** Code written against apify/facebook-posts-scraper's rows runs unchanged: every row also
has its nested keys, built from the flat columns: `facebookId` (the page's id), `user` (`id`, `name`,
`profileUrl`, `profilePic`), `pageAdLibrary` (`id`, `is_business_page_active`), `textReferences` (the text's
hashtags, mentions and links as Facebook names them) and `media` (`__typename`, `id`, `thumbnail`, `url`,
`ocrText` of each photo, video or link preview). `topCommentsDetails` is apify's `topComments` objects:
`commentId`, `commentUrl`, `text`, `date`, `likesCount`, `profileName`, `profileId`, `profileUrl`,
`profilePicture`, `threadingDepth`.

Comments rows: `profilePicture`, `profileName`, `text`, `textSnippet`, `commentUrl`, `likesCount`, `commentsCount`,
`date`, `threadingDepth`, `replyToCommentId`, `replyToName`, reactions by type, `attachmentImageUrls`,
`attachmentType`, `mentions`, `isAuthorVerified`, `profileUrl`, `profileId`, `postTitle`, `postDescription`,
`postUrl`, `postId`, `pageName`, `facebookId`, `commentId`, `id`, `feedbackId`, `timestamp`, `facebookUrl`,
`inputUrl`, `scrapedAt`.

Picture and video links are Facebook's signed CDN links: they expire after a few days, so download what you keep.
Logged out, Facebook shows many commenters with an anonymous id and no profile link.

Video posts carry `viewsCount` (plays, as Facebook counts them), `videoPostViewCount` (views of the video in
this post) and `playCount`. A post that shares someone else's video has no counters of its own. A video with
captions names its captions file (`captionsUrl`, an .srt) and its language (`captionsLocale`); with **Video
transcripts** on, `transcriptText` holds the captions as plain text (up to 50,000 characters).

A post that shares another post keeps its own words in `text` (empty when it adds none, `postType` "Share") and the
original's id, text, link, author and time in `sharedPostId`, `sharedPostText`, `sharedPostUrl`, `sharedPostAuthor`
and `sharedPostTime`.

### Pricing

Pay per post, and per comment when you ask for comments. No start fee, no charge for date filters. A run never
charges past your spending limit.

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

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

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

Also get each post's comments, into a separate Comments dataset. Each comment is charged as a 'comment' event, on top of the post.

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

Up to this many comments of each post.

## `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).

## `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": 50,
  "captionText": false,
  "includeComments": false,
  "maxCommentsPerPost": 20,
  "viewOption": "RANKED_UNFILTERED",
  "includeNestedComments": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "residentialFallback": true
}
```

# Actor output Schema

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

No description

## `comments` (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": 50
};

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

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

```

## MCP server setup

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