# Facebook Posts Scraper ($2/1000 results) (`api-ninja/facebook-posts-scraper`) Actor

📘 Scrape public Facebook page posts, captions, and engagement data in a few clicks.

- **URL**: https://apify.com/api-ninja/facebook-posts-scraper.md
- **Developed by:** [API ninja](https://apify.com/api-ninja) (community)
- **Categories:** Social media, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 346 total users, 30 monthly users, 100.0% runs succeeded, 13 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.00 / 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.
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

### What does Facebook Posts Scraper do?

**Facebook Posts Scraper** lets you extract **posts from public [Facebook](https://www.facebook.com/) pages and individual post URLs** in a repeatable, API-friendly way. Paste one or more Facebook page URLs, page IDs, or direct post links, choose how many results you want, optionally add a date range, and run the Actor to collect post data into an Apify dataset.

This Actor is built for teams and individuals who need **public Facebook page content**, **engagement metrics**, and **structured output** without building and maintaining their own scraper pipeline. Because it runs on the [Apify platform](https://apify.com/), you also get scheduling, monitoring, logs, integrations, and API access out of the box.

### What can this Facebook Posts Scraper do?

- Extract posts from **public Facebook pages**
- Accept **Facebook page URLs**, **numeric page IDs**, and **individual post URLs**
- Fetch one post directly from its URL, without resolving a page ID or collecting its feed
- Collect paginated results automatically
- Limit output with `maxResults` or keep going with `parseAllResults`
- Filter posts by optional `startDate` and `endDate`
- Return structured post data including message text, author info, URLs, timestamps, and engagement counts
- Save results to an Apify dataset that you can export as JSON, CSV, Excel, XML, or HTML

This Actor is especially useful if you want a Facebook page posts API workflow combined with Apify features such as:

- **Scheduling** recurring runs
- **API access** for automation
- **Run history and logs** for monitoring
- **Integrations** with Make, Zapier, webhooks, and custom systems
- **Scalable execution** without managing infrastructure

### Why use Facebook Posts Scraper?

If you work with social media data, public content monitoring, reporting, or research, this Actor gives you a practical way to turn Facebook page activity into structured data.

Common use cases include:

- Tracking brand pages over time
- Monitoring competitors' posting activity
- Collecting post engagement metrics for reporting
- Building internal dashboards for content analysis
- Archiving public page content for research or audits
- Feeding public Facebook page data into ETL and BI pipelines

Instead of manually checking pages or building your own collection process, you can use this Actor as a reusable data source inside the Apify platform.

### What data can Facebook Posts Scraper extract?

The Actor returns one dataset item per post. Depending on the post, the output can include core content, author fields, engagement totals, media references, and attached objects.

| Field                        | Description                                                            |
| ---------------------------- | ---------------------------------------------------------------------- |
| `post_id`                    | Unique Facebook post identifier                                        |
| `type`                       | Post type                                                              |
| `url`                        | Direct URL to the Facebook post                                        |
| `message`                    | Main post text                                                         |
| `message_rich`               | Rich-text post message when available                                  |
| `timestamp`                  | Post timestamp in Unix seconds                                         |
| `comments_count`             | Number of comments                                                     |
| `reactions_count`            | Total number of reactions                                              |
| `reshare_count`              | Number of reshares                                                     |
| `reactions`                  | Breakdown of reactions such as like, love, care, haha, wow, sad, angry |
| `author.id`                  | Facebook page ID of the author                                         |
| `author.name`                | Facebook page name                                                     |
| `author.url`                 | Facebook page URL                                                      |
| `author.profile_picture_url` | Profile image URL                                                      |
| `image`                      | Attached image data when present                                       |
| `video`                      | Attached video data when present                                       |
| `external_url`               | External link attached to the post when present                        |

### How to scrape Facebook page posts or individual posts

Using this Actor is straightforward:

1. Open **Facebook Posts Scraper** in Apify Console.
2. In the **Input** tab, add public Facebook page URLs, numeric page IDs, or individual post URLs. You can mix them in one run.
3. Set `maxResults` if you want to cap the number of saved posts per page.
4. Turn on `parseAllResults` if you want the Actor to paginate until no more posts are available.
5. Optionally set `startDate` and/or `endDate` in `YYYY-MM-DD` format.
6. Click **Start**.
7. Review the dataset in the **Storage** tab or access it via API.

This flow works well for both no-code users and developers. Non-technical users can run it directly in the Apify Console. Developers can trigger runs and download results programmatically through the Apify API.

### Input

The Actor input is designed to be simple:

- `urls`: Required. A list of Facebook page URLs, numeric page IDs, or individual post URLs.
- `maxResults`: Optional. Maximum number of posts to save per input page.
- `parseAllResults`: Optional. When enabled, the Actor keeps paginating until there are no more results.
- `startDate`: Optional. Start of the date range in `YYYY-MM-DD` format.
- `endDate`: Optional. End of the date range in `YYYY-MM-DD` format.

**Direct post URLs return one dataset item per input link.** The Actor fetches post details and logs “Post details retrieved and saved” after saving the result. `maxResults`, `parseAllResults`, `startDate`, and `endDate` apply only to page feeds; direct posts are retrieved regardless of their publication date.

If both `startDate` and `endDate` are provided, the Actor validates that the start date is not later than the end date.

Example input:

```json
{
    "urls": [
        "https://www.facebook.com/facebook/",
        "100064860875397",
        "https://www.facebook.com/sugoimedia/posts/pfbid0G3toRTS8i1VEp81CG8h6gURB1RWkkuHVUHL1jnYA7EoFQMpiyDxaehLsiQvMtL1Hl"
    ],
    "maxResults": 100,
    "parseAllResults": false,
    "startDate": "2026-05-08",
    "endDate": "2026-05-14"
}
```

#### Recognized individual post URL formats

The Actor identifies content links by their path and identity query parameters. The `/page/posts/post-id` format also appears in [Apple's FacebookPost documentation](https://developer.apple.com/documentation/applenewsformat/facebookpost). Common formats include:

| Format                               | Example                                                                          |
| ------------------------------------ | -------------------------------------------------------------------------------- |
| Page post (numeric ID or `pfbid...`) | `https://www.facebook.com/sugoimedia/posts/pfbid...`                             |
| Post permalink                       | `https://www.facebook.com/permalink.php?story_fbid=456&id=123`                   |
| Mobile post                          | `https://m.facebook.com/story.php?story_fbid=456&id=123`                         |
| Group post                           | `https://www.facebook.com/groups/123/posts/456/` or `/groups/123/permalink/456/` |
| Photo post                           | `https://www.facebook.com/photo.php?fbid=456` or `/photo/?fbid=456`              |
| Page photo                           | `https://www.facebook.com/example/photos/a.123/456/`                             |
| Video post                           | `https://www.facebook.com/example/videos/456/` (also `/videos/title/456/`)       |
| Watch/video link                     | `https://www.facebook.com/watch/?v=456` or `/video.php?v=456`                    |
| Reel                                 | `https://www.facebook.com/reel/456/`                                             |
| Shared post, video, or reel          | `https://www.facebook.com/share/p/TOKEN/` (also `/share/v/` and `/share/r/`)     |
| Short video link                     | `https://fb.watch/TOKEN/`                                                        |

Facebook subdomains such as `m.facebook.com`, `mbasic.facebook.com`, and `web.facebook.com` are recognized. Query parameters that identify a post are preserved. Page tabs such as `/example/posts/` and `/example/videos/` remain page inputs because they do not identify an individual post. Numeric inputs remain **page IDs**, not post IDs.

These formats are routed to the post-details service. Recognizing a link does not guarantee that the upstream service can retrieve it: private, deleted, restricted, or unsupported content may fail. For shared or short links that fail, try the full post permalink. Ephemeral Facebook Stories and generic `/share/TOKEN/` links are not supported as direct post inputs.

### Output

The Actor stores results in the default dataset. Direct post links save the returned post object in the same dataset format as page posts; additional fields such as `authors`, media details, and `top_comments` are included when the service returns them. You can download the dataset in various formats such as **JSON, HTML, CSV, Excel, XML, or RSS** depending on your workflow.

Example output:

```json
[
    {
        "post_id": "1486934193478596",
        "type": "post",
        "url": "https://www.facebook.com/facebook/posts/pfbid0YYGLM1J7LhQafNHkQ7HngKyAMVrW1ednAunWsVbTLc6MpDT1Grsmqx48sx626unPl",
        "message": "This is your sign to spend some time outside today 🌏",
        "message_rich": "This is your sign to spend some time outside today 🌏",
        "timestamp": 1776870303,
        "comments_count": 7637,
        "reactions_count": 49639,
        "reshare_count": 4159,
        "reactions": {
            "angry": 45,
            "care": 1109,
            "haha": 331,
            "like": 36638,
            "love": 11356,
            "sad": 39,
            "wow": 121
        },
        "author": {
            "id": "100064860875397",
            "name": "Facebook",
            "url": "https://www.facebook.com/facebook",
            "profile_picture_url": "https://example.com/profile.jpg"
        },
        "external_url": null,
        "comments_id": "1486934193478596",
        "shares_id": "1486934193478596",
        "associated_group_id": null
    }
]
```

### How much does it cost to scrape Facebook page posts?

The cost depends on:

- how many Facebook pages or direct post links you process
- how many posts you request per page
- whether you enable full pagination with `parseAllResults`
- how often you run the Actor

If you only need recent posts from a small set of pages, costs stay low. If you run large historical collections across many pages with full pagination, usage will increase accordingly.

To keep costs predictable:

- start with a small `maxResults`
- test on one or two pages first
- only enable `parseAllResults` when you need the full archive available through pagination
- use date filters to reduce unnecessary collection

For many users, the fastest way to estimate cost is to run a small sample and then scale up based on the number of pages and posts actually needed.

### Tips and advanced options

- Use **numeric page IDs** when you already have them. This reduces one resolution step before post collection begins.
- Use **date filters** when you need a specific reporting period.
- Use **`maxResults`** when you only need recent or representative samples.
- Use **`parseAllResults`** when completeness matters more than speed.
- Check the **run logs** to review request parameters, pagination progress, retries, and saved item counts.
- Use the **Apify API** if you want to trigger this Actor from your own app or data workflow.

### FAQ

#### Can I scrape personal Facebook profiles?

Personal profile feeds are not supported. Page feed scraping is designed for **public Facebook pages**. Individual post links are fetched through the post-details service when the content is publicly accessible.

#### Can I use both URLs and numeric IDs in one run?

Yes. The `urls` input can contain a mix of public Facebook page URLs, numeric page IDs, and direct post URLs.

For Facebook URLs in the form `profile.php?id=<numeric ID>`, the Actor uses the ID directly and skips the page ID lookup. This does not add support for personal profile feeds.

#### Can I collect all available posts from a page?

Yes. Turn on `parseAllResults` and the Actor will continue paginating until no more results are available.

#### Can I filter by date?

Yes, for page feeds. Direct post URLs always fetch the requested post regardless of date. You can provide `startDate`, `endDate`, or both. If both are provided, the Actor validates the date range before the run proceeds.

#### What if a request fails?

Temporary request failures are retried up to four attempts. Rate limits can delay a run; exhausted source quotas or long cooldowns stop the request with an error. Check the run log and try again later if the source remains unavailable.

A successful first page with no posts and no cursor gets one confirmation request after 3 seconds. If it is still empty, the run finishes successfully with zero posts. Later empty pages without a cursor end pagination immediately; empty pages with a cursor continue to the next page. HTTP failures during the confirmation request follow the error retry policy above.

#### Can I export the data to spreadsheets or BI tools?

Yes. Dataset results can be exported in common formats, and you can also consume them through the Apify API.

### Disclaimers and support

This Actor is intended for collecting **publicly available Facebook page data**. Make sure your use complies with the target website terms and with the laws and regulations that apply in your jurisdiction.

If you run into an issue, check:

- the Actor input for invalid URLs or date ranges
- the run logs for request and pagination details
- the **Issues** tab for feedback and known limitations

If you need custom fields, custom transformations, or a broader Facebook data workflow, this Actor can be extended into a more tailored solution.

# Actor input Schema

## `urls` (type: `array`):

Add public Facebook page URLs (https://www.facebook.com/humansofnewyork/), numeric page IDs, or individual post URLs (https://www.facebook.com/sugoimedia/posts/pfbid...). Post links fetch only that post. Recognized formats include /posts/, permalink.php or story.php with story_fbid, photo links, video/watch/reel links, group post permalinks, /share/p/, /share/v/, /share/r/, and fb.watch links. Availability depends on the post and upstream service. Personal profile feeds are not supported.

## `maxResults` (type: `integer`):

Choose how many posts to save for each Facebook page. Ignored when Parse all posts is enabled. Direct post URLs always fetch one post.

## `parseAllResults` (type: `boolean`):

When enabled, the Actor keeps paginating until there are no more posts available for the page. Does not apply to direct post URLs.

## `startDate` (type: `string`):

Optional. Only collect page posts published on or after this date in YYYY-MM-DD format. Does not apply to direct post URLs.

## `endDate` (type: `string`):

Optional. Only collect page posts published on or before this date in YYYY-MM-DD format. Does not apply to direct post URLs.

## Actor input object example

```json
{
  "urls": [
    "https://www.facebook.com/facebook/"
  ],
  "maxResults": 20,
  "parseAllResults": false
}
```

# Actor output Schema

## `results` (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 = {
    "urls": [
        "https://www.facebook.com/facebook/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-ninja/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 = { "urls": ["https://www.facebook.com/facebook/"] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,api-ninja/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/Vz7ENMkHJh9h1e2V2/builds/Ic7P51fqVSzWCAruu/openapi.json
