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

Collect timeline posts from public Facebook Pages, with each post's text, creation time and permalink. Supply several Pages in one run and page through as many posts as you need.

- **URL**: https://apify.com/thenetaji/facebook-posts-scraper.md
- **Developed by:** [The Netaji](https://apify.com/thenetaji) (community)
- **Categories:** Social media, Marketing
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 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/platform/actors/running/actors-in-store#pay-per-event

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

## Facebook Posts Scraper — Page Timeline

The Actor reads a public Facebook Page's timeline exactly as a logged-out visitor sees it and returns each post's text, creation time, and permalink. No Facebook account, login, or session cookie is used at any point, and nothing is collected beyond what an anonymous visitor to the Page can already see.

### Accepted input

`page` is required and accepts a list in which each entry is a Page's username (the part after `facebook.com/`), its numeric ID, or a full `facebook.com/<page>/` URL; the three forms can be mixed in one run. A URL is reduced to the identifier before the request is made, and a leading `@` is stripped, so `@nasa`, `nasa`, and `https://www.facebook.com/nasa/` all resolve to the same Page. Duplicate entries are collapsed before any request is issued.

```json
{
  "page": ["NASA", "https://www.facebook.com/unicef/"],
  "maxItems": 50
}
```

### Result fields

Each row carries `page`, `id`, `message`, `createdAt`, `url`, and `raw`.

```json
{
  "page": "NASA",
  "id": "10160123456789012",
  "message": "Splashdown confirmed. Welcome home.",
  "createdAt": 1783968720,
  "url": "https://www.facebook.com/NASA/posts/10160123456789012"
}
```

`createdAt` is passed through as Facebook's own document reports it rather than reformatted by the Actor. `message` is `null` for posts that carry no text, such as a photo or link shared without a caption.

`maxItems` (default `50`) bounds the number of posts saved per Page; `0` continues until Facebook stops returning a next page. The bound applies per Page, so with several Pages supplied a low value is spent on the first Page in the list before any later one is reached.

### Behaviour on partial results

Each Page's timeline is a separate paginated series of requests. A Page that cannot be resolved — because the username or ID does not exist, or the Page is not public — is logged as a warning and skipped, and the run continues with the rest of the list.

### Public, logged-out data only

Every field returned here comes from what Facebook serves to an anonymous visitor. The Actor does not sign in, does not use a Facebook account or cookie of any kind, and cannot read anything a logged-out visit to the Page would not already show. A Page that requires a login to view returns no records.

### Frequently asked questions

**Does this return comments on posts?**
No. Facebook exposes no logged-out paginator for post comments — the comment thread is only reachable by opening the post and clicking to load more, which has no anonymous API equivalent. This Actor returns each post's text, timestamp, and link, not the comment thread beneath it.

**What happens for a Page that does not exist or is not public?**
No records are saved for it. The run log names the Page and the run continues with the rest of the input.

**Does this Actor also return the Page's profile details?**
No. Post fields only. Use the [Facebook Page Scraper](https://apify.com/thenetaji/facebook-page-scraper) for a Page's ID, About section, and Transparency details.

### What this is useful for

Archiving a Page's timeline history for a record that outlives Facebook's own retention of it; monitoring a competitor's or partner's posting cadence and messaging over time; and pulling a Page's post permalinks for downstream engagement or comment analysis run elsewhere.

### Related Actors

| Actor | Purpose |
| --- | --- |
| [Facebook Page Scraper](https://apify.com/thenetaji/facebook-page-scraper) | Profile, About and Transparency details for a Page |
| [Facebook Followers/Following Scraper](https://apify.com/thenetaji/facebook-followers-following-scraper) | Followers and following lists for a Page |
| [Facebook Videos Scraper](https://apify.com/thenetaji/facebook-videos-scraper) | Videos published by a Page |

# Actor input Schema

## `page` (type: `array`):

Facebook Page usernames, numeric IDs, or full facebook.com/<page>/ URLs, one per line. Posts are collected for each.

## `maxItems` (type: `integer`):

Maximum posts to save per Page. Set `0` to continue until no further posts are available.

## Actor input object example

```json
{
  "page": [
    "NASA",
    "https://www.facebook.com/unicef/"
  ],
  "maxItems": 20
}
```

# Actor output Schema

## `dataset` (type: `string`):

All records scraped by this run

# 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 = {
    "page": [
        "NASA"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("thenetaji/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 = {
    "page": ["NASA"],
    "maxItems": 20,
}

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

```

## MCP server setup

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