# Facebook Page Posts Scraper (`powerai/facebook-page-posts-scraper`) Actor

Extract posts from any public Facebook page using its page ID, with optional date filtering and automatic pagination up to your specified maxResults.

- **URL**: https://apify.com/powerai/facebook-page-posts-scraper.md
- **Developed by:** [PowerAI](https://apify.com/powerai) (community)
- **Categories:** Social media
- **Stats:** 657 total users, 66 monthly users, 96.9% runs succeeded, 8 bookmarks
- **User rating**: 4.74 out of 5 stars

## Pricing

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

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 Scraper

Extract posts from any public Facebook page using its page ID. This actor leverages the latest Facebook page posts API and supports automatic pagination to collect up to your specified `maxResults`.

### Features

- Scrape posts from any public Facebook page using its page ID.
- Optional date range filtering with start_date and end_date.
- Automatic pagination to fetch large result sets.
- Returns structured post data including content, reactions, comments, and media.

### Input

| Field      | Type    | Required | Description                                      |
|------------|---------|----------|--------------------------------------------------|
| page_id    | string  | Yes      | The Facebook page ID to scrape posts from.       |
| start_date | string  | No       | Optional start date (yyyy-mm-dd) to filter posts.|
| end_date   | string  | No       | Optional end date (yyyy-mm-dd) to filter posts.  |
| maxResults | integer | No       | Maximum number of posts to fetch  |

### Output

Each output item is a Facebook post object:

```json
[
	{
		"post_id": "1296377462490362",
		"type": "post",
		"url": "https://www.facebook.com/LombardOlkusz/posts/pfbid0xHDQtfzbGjH3dMqUZHkNr6VTGgsuUYSz6Joq6kyAwVaVVpWBM2P7VsUWkUHHwhvZl",
		"message": "Pamiętaj tylko u nas najlepsze ceny skupu złota 🙂🙂przyjdź sprawdź...zapraszamy od godziny 8 do godziny 19🙂kontakt telefoniczny 512 777 884 🙂",
		"timestamp": 1747506554,
		"comments_count": 0,
		"reactions_count": 0,
		"reshare_count": 5,
		"reactions": {
			"angry": 0,
			"care": 0,
			"haha": 0,
			"like": 0,
			"love": 0,
			"sad": 0,
			"wow": 0
		},
		"author": {
			"id": "100063543614476",
			"name": "Komis Skup sprzedaż Złota",
			"url": "https://www.facebook.com/LombardOlkusz",
			"profile_picture_url": "https://scontent.fjoi2-1.fna.fbcdn.net/v/t39.30808-1/407757874_870519151742864_2776592356750657064_n.jpg?stp=c5.0.296.296a_cp0_dst-jpg_s40x40_tt6&_nc_cat=100&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=s9jkZhdtE8UQ7kNvwEd3zfi&_nc_oc=AdlWbNIsuhWxitgvbCaoYFcFm1t-tYv8XvDB2xqg3KB9JAFF3pYgdPOgW9n867wIbHE&_nc_zt=24&_nc_ht=scontent.fjoi2-1.fna&_nc_gid=WulJOcwYpO0fAOZLcpiL5A&oh=00_AfInXs15Z7HBNtnrBTGZZNADP4a-92sEcf9p2Tv7X_eXng&oe=683DD47F"
		},
		"image": {
			"uri": "https://scontent.fjoi2-1.fna.fbcdn.net/v/t39.30808-6/497953614_1296377415823700_2526818784636674285_n.jpg?_nc_cat=111&ccb=1-7&_nc_sid=833d8c&_nc_ohc=LuYd41ewU-YQ7kNvwG6ewx8&_nc_oc=Adk-2n8IoI88YeY3H4HzF7-10Fl4DV6fS8KRHST0eH6Toru7J-1XzVqPOR_sMzm_aCg&_nc_zt=23&_nc_ht=scontent.fjoi2-1.fna&_nc_gid=WulJOcwYpO0fAOZLcpiL5A&oh=00_AfIMc9cL70rneQBXZYS12qsX9GBJ8wS2WsM2bA-kpPGnyg&oe=683DD55C",
			"height": 296,
			"width": 307
		},
		"video": null,
		"album_preview": null,
		"video_files": null,
		"video_thumbnail": null,
		"external_url": null,
		"attached_event": null,
		"attached_post": null,
		"attached_post_url": null,
		"scrapedAt": "2025-05-29T08:18:48.641Z"
	},
	...
]
```

### Example Usage

```json
{
  "page_id": "100063543614476",
  "maxResults": 3
}
```

### Notes

- The actor will automatically paginate through results until `maxResults` is reached or no more data is available.
- Make sure the page ID is correct and the page is public.
- Posts are returned in chronological order.
- Date filtering is optional but recommended for better performance.

# Actor input Schema

## `page_id` (type: `string`):

The Facebook page ID to scrape posts from.

## `start_date` (type: `string`):

Optional start date (yyyy-mm-dd) to filter posts.

## `end_date` (type: `string`):

Optional end date (yyyy-mm-dd) to filter posts.

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

Maximum number of posts to fetch (auto pagination).

## Actor input object example

```json
{
  "page_id": "100063543614476",
  "maxResults": 3
}
```

# 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("powerai/facebook-page-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 = {}

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

```

## MCP server setup

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