# Facebook Page Scraper — Posts, Reactions & Comments (`lanky_quantifier/facebook-public-scraper`) Actor

Scrape public Facebook page posts, reactions, comments, shares, and page metadata without an account or API key. Monitor brand pages, track competitor content, and export social data to JSON or CSV.

- **URL**: https://apify.com/lanky\_quantifier/facebook-public-scraper.md
- **Developed by:** [Vhub Systems](https://apify.com/lanky_quantifier) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 55 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.00 / 1,000 post scrapeds

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/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 Public Scraper — Posts, Comments & Page Data Extractor

Extract public Facebook posts, comments, likes, shares, and page metadata **without an API key**. This actor scrapes publicly accessible Facebook pages and returns structured data ready for export to JSON or CSV. Perfect for social media monitoring, brand tracking, competitor research, and content strategy.

> **No Facebook API key required.** Works on any public Facebook page.

***

### 🚀 What It Does

The **Facebook Public Scraper** is a powerful, no-API-needed extractor that crawls public Facebook pages to collect post content, engagement metrics, and page-level information. It handles dynamic content loading, bypasses lazy-loaded feeds, and returns clean, structured records. Whether you need 10 posts or 1,000, this tool delivers fast, reliable results — with no authentication required. Export directly to **JSON**, **CSV**, **Excel**, or **XML** via Apify's built-in dataset tools.

***

### 🎯 Use Cases

- **📊 Social Media Analysts** — Track post engagement trends across brand pages and benchmark against competitors
- **🏢 Marketing Teams** — Monitor campaign performance, discover high-performing content types, and measure audience sentiment
- **🔍 Competitive Intelligence** — Scrape competitor Facebook pages to analyze posting frequency, content strategy, and engagement rates
- **📰 Journalists & Researchers** — Collect public posts for academic research, fact-checking, or trend analysis
- **📈 E-commerce Brands** — Monitor product mentions, customer feedback, and promotions posted publicly on Facebook

***

### 📥 Input Parameters

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `pages` | `array` | **required** | List of Facebook page URLs or slugs (e.g., `["facebook.com/nike", "adidas"]`) |
| `maxPosts` | `integer` | `20` | Maximum number of posts to scrape per page (1–500) |
| `includeComments` | `boolean` | `false` | Whether to include comments on each post |
| `maxComments` | `integer` | `10` | Max comments per post (only if `includeComments` is `true`) |
| `proxyConfiguration` | `object` | auto | Proxy settings. Residential proxies recommended for reliability |

#### 📋 Example Input

```json
{
  "pages": [
    "https://www.facebook.com/nike",
    "https://www.facebook.com/adidas",
    "cocacola"
  ],
  "maxPosts": 50,
  "includeComments": true,
  "maxComments": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

***

### 📤 Output Sample

Each item in the output dataset represents one **Facebook post**:

```json
{
  "postId": "354892341098234",
  "pageName": "Nike",
  "pageUrl": "https://www.facebook.com/nike",
  "pageCategory": "Sportswear Brand",
  "pageLikes": 34521890,
  "pageFollowers": 37214003,
  "postUrl": "https://www.facebook.com/nike/posts/354892341098234",
  "postText": "Just Do It. 🏃 Our new Air Max 2024 drops this Friday. Are you ready? #Nike #AirMax",
  "postType": "photo",
  "likesCount": 45231,
  "commentsCount": 1823,
  "sharesCount": 2941,
  "reactionsCount": {
    "like": 38201,
    "love": 5124,
    "haha": 312,
    "wow": 198,
    "sad": 42,
    "angry": 17
  },
  "publishedAt": "2024-03-15T14:32:00.000Z",
  "imageUrls": [
    "https://scontent.facebook.com/v/t39.30808-6/airmax2024.jpg"
  ],
  "videoUrl": null,
  "isSponsored": false,
  "comments": [
    {
      "commentId": "comment_98421",
      "authorName": "John Smith",
      "authorProfileUrl": "https://www.facebook.com/john.smith.profile",
      "text": "These look incredible! Can't wait to get a pair 🔥",
      "likesCount": 124,
      "publishedAt": "2024-03-15T15:10:00.000Z",
      "replies": []
    }
  ],
  "scrapedAt": "2024-03-16T09:00:00.000Z"
}
```

***

### 💰 Pricing

This actor uses the **pay-per-result** model on Apify.

| Volume | Approximate Cost |
|--------|-----------------|
| 100 posts | ~$0.10 |
| 1,000 posts | ~$0.80 |
| 10,000 posts | ~$6.00 |
| 100,000 posts | ~$50.00 |

> Costs may vary based on page complexity, comment loading, and proxy usage. Run a small test first to estimate costs for your specific use case.

***

### ⚙️ How It Works

1. **Page Detection** — The actor accepts both full URLs (`https://facebook.com/nike`) and short slugs (`nike`). It normalizes all inputs before scraping.

2. **Dynamic Feed Loading** — Facebook uses infinite scroll and JavaScript-rendered content. This actor uses Playwright to emulate a real browser session, scrolling the page feed until `maxPosts` is reached or the feed is exhausted.

3. **Data Extraction** — Post data (text, engagement metrics, timestamps, media URLs) is extracted using robust CSS selectors and DOM traversal. The actor handles multiple post formats: text-only, photo, video, event, link-share.

4. **Comment Loading** — When `includeComments` is enabled, the actor clicks "View more comments" links and extracts comment threads up to `maxComments` per post.

5. **Proxy Rotation** — Residential proxies are used to avoid detection and rate-limiting. Each request cycle rotates IP addresses to maintain session health.

6. **Output** — All scraped data is pushed to Apify's dataset in real-time as posts are scraped, meaning you can stream results even during long runs.

***

### ⚠️ Limitations

- **Public pages only** — This actor cannot access private profiles, groups, or any content requiring Facebook login
- **Dynamic content** — Some post types (Stories, Reels, Watch videos) may not be fully supported in all cases
- **Rate limiting** — Facebook aggressively rate-limits scrapers. Very high `maxPosts` values (500+) per run may occasionally encounter soft blocks; using residential proxies minimizes this
- **Engagement accuracy** — Facebook sometimes shows approximate counts (e.g., "45K likes" instead of exact numbers); the actor returns the best available precision
- **Historical posts** — The scraper follows Facebook's feed chronologically. Very old posts (3+ years) may require many scroll operations and increase runtime
- **Geographical restrictions** — Some pages show different content in different regions; proxy location may affect results
- **Facebook ToS** — Use this tool responsibly and in accordance with Facebook's Terms of Service. Only scrape publicly available data

***

### 🔗 Related Actors

- [Instagram Profile Scraper](https://apify.com/store) — Extract posts, followers, and bio from public Instagram profiles
- [Twitter/X Profile Scraper](https://apify.com/store) — Scrape tweets, likes, and engagement from public Twitter accounts
- [YouTube Channel Scraper](https://apify.com/store) — Extract videos, view counts, and comments from YouTube channels

***

### 📞 Support

Having issues? Check the [Apify documentation](https://docs.apify.com) or open a support ticket. For actor-specific bugs, use the **Issues** tab on this actor's page.

# Actor input Schema

## `pages` (type: `array`):

List of public Facebook page URLs or usernames/slugs to scrape. Examples: 'https://www.facebook.com/cocacola', 'cocacola', 'NASA'.

## `maxPosts` (type: `integer`):

Maximum number of posts to collect per Facebook page. Pagination is followed automatically.

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

Whether to include comment counts in the output. Disabling may slightly speed up extraction.

## Actor input object example

```json
{
  "pages": [
    "https://www.facebook.com/NASA",
    "cocacola"
  ],
  "maxPosts": 20,
  "includeComments": true
}
```

# 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 = {
    "pages": [
        "https://www.facebook.com/NASA",
        "cocacola"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("lanky_quantifier/facebook-public-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "pages": [
    "https://www.facebook.com/NASA",
    "cocacola"
  ]
}' |
apify call lanky_quantifier/facebook-public-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=lanky_quantifier/facebook-public-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/9o821Z4XjS1UCog21/builds/6dx3niZSIwHsNPNaS/openapi.json
