# Facebook Post Scraper (`devninja/facebook-post-scraper`) Actor

This actor helps you collect Facebook posts quickly. Extract public posts from Facebook pages, profiles, and groups with keyword-based filtering, and smart anti-bot detection for reliable data extraction

- **URL**: https://apify.com/devninja/facebook-post-scraper.md
- **Developed by:** [Devinja](https://apify.com/devninja) (community)
- **Categories:** Social media, Integrations, Developer tools
- **Stats:** 103 total users, 3 monthly users, 0.0% runs succeeded, 10 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Post Scraper

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue?logo=apify)](https://apify.com)
[![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)

This actor helps you collect Facebook posts quickly. Extract public posts from Facebook pages, profiles, and groups with keyword-based filtering, date range selection, and smart anti-bot detection for reliable data extraction.

### **Key Features**

- **Fast and Efficient**: Collects Facebook post data quickly without slowing down
- **Comprehensive Insights**: Gathers post content, author details, images, and engagement numbers
- **Scalable**: Designed to handle large volumes of data smoothly
- **Reliable for Business Use**: Built to run consistently with smart error handling

### Use Cases

- **Social Media Monitoring**: Track brand mentions and sentiment
- **Market Research**: Analyze trends and public opinion
- **Content Analysis**: Study viral content and engagement patterns
- **Competitor Intelligence**: Monitor competitor social media activity
- **Academic Research**: Collect data for social science studies
- **Trend Analysis**: Identify emerging topics and hashtags

### Sample Output

```json
[
    {
        "post_id": "752211920250854",
        "type": "post",
        "url": "https://www.facebook.com/story.php?story_fbid=752211920250854&id=100063861587219&_rdr",
        "message": "🌙 Midnight Cravings Alert! 🌙\n\nIndulge in a foodie's dream at Food Market Manila's Midnight Breakfast Buffet in the heart of BGC! 🍽️ For just 499 pesos, you can savor mouthwatering Filipino dishes ALL YOU CAN! 🇵🇭✨\n\nGather your friends and family, and join us for a gastronomic adventure under the stars. 🌟\n\n📅 Date: Every Tuesday to Sunday\nTime: 12 AM - 6 AM\n📍 Location: Food Market Manila, BGC\n\nDon't miss out on this incredible feast - tag your fellow foodies and let's make this midnight unforgettable! 🤩🍴\n\n#MidnightBreakfastBuffet #FoodMarketManila #BGC\n\n📷 credits to: @whatwherewhen.dy follow her tiktok account everyone",
        "timestamp": 1755594566,
        "comments_count": 30,
        "reactions_count": 64,
        "reshare_count": 21,
        "author": {
            "id": "100063861587219",
            "name": "The Food Market Manila",
            "url": "https://www.facebook.com/FoodMarketManila",
            "profile_picture_url": ""
        },
        "image": null,
        "images": null,
        "reactions": {
            "angry": 0,
            "care": 1,
            "haha": 0,
            "like": 37,
            "love": 22,
            "sad": 0,
            "wow": 4
        },
        "video": {
            "id": "999820931139886",
            "title": "Video",
            "url": "https://www.facebook.com/FoodMarketManila/videos/999820931139886/",
            "is_live_streaming": false,
            "__typename": "Video"
        },
        "album_preview": null,
        "video_files": null,
        "video_thumbnail": {
            "uri": "https://scontent.fceb3-1.fna.fbcdn.net/v/t15.5256-10/373462618_843834153985155_5976054732541719805_n.jpg?stp=cp0_dst-jpg_e15_p403x403_q65_tt6&_nc_cat=109&ccb=1-7&_nc_sid=c3bc4c&efg=eyJpIjoidCJ9&_nc_eui2=AeHZi_6Hqfn3427vYohHjCasFEUj4EdB470URSPgR0HjvS67GLBiIL7cc5yADpXVkqwcZCmcVFqmacfKHQHkxqul&_nc_ohc=PiIoENydGOMQ7kNvwGa7XfS&_nc_oc=AdnEY0bxbaxPg7MgoYuCQy3bHxEU6XwZijHUsQrcjdHFboiPw-f8_nA5FumqGtSXQAQ&_nc_zt=23&_nc_ht=scontent.fceb3-1.fna&_nc_gid=55n0dmFB-y_gHlv3291-Jg&oh=00_AfVbE8u4NN331ikoy91H4i2wW4XgBsx3fl_PF1ndDuR7vg&oe=68AA0165",
            "height": 0,
            "width": 0,
            "id": "999820931139886"
        },
        "external_url": null,
        "attached_event": null,
        "attached_post": null,
        "attached_post_url": null,
        "text_format_metadata": null,
        "contact_info": {
            "phone_numbers": [],
            "email_addresses": [],
            "websites": [],
            "addresses": []
        },
        "hashtags": [],
        "mentions": [],
        "content_type": "video",
        "location_info": null,
        "account_info": {
            "account_type": "business",
            "is_verified": false,
            "page_category": null
        },
        "query": "food"
    }
]
````

### Input Parameters

| Property           | Description                                                                               |
|--------------------|-------------------------------------------------------------------------------------------|
| `query`            | The search term to look for in Facebook posts. Supports multiple comma-delimited queries. |
| `search_type`      | Type of content to search for (`posts` ,`videos`, `reels`).                               |
| `start_date`       | Start date for filtering posts (format: YYYY-MM-DD).                                      |
| `end_date`         | End date for filtering posts (format: YYYY-MM-DD).                                        |
| `max_posts`        | Maximum number of posts to extract (up to 1500).                                          |
| `recent_posts`     | Focus on recent posts; affects sorting of results.                                        |

### Related Actors

Explore our comprehensive suite of data extraction and AI-powered tools:

#### 📄 Facebook & Social Media Scrapers

##### [Facebook Post Scraper](https://apify.com/devninja/facebook-post-scraper)

[![Rating](https://img.shields.io/badge/Rating-5.0-green)](https://apify.com/devninja/facebook-post-scraper)

A reliable Facebook Post Scraper for extracting public posts from Facebook pages, profiles, and groups at scale. This smart scraping agent supports keyword-based filtering, date range selection, mobile-optimized scraping, and built-in anti-bot detection handling for better reliability.

##### [Facebook Comments Scraper | Webhook Support](https://apify.com/devninja/facebook-comments-scraper-webhook-support)

[![Rating](https://img.shields.io/badge/Rating-5.0-green)](https://apify.com/devninja/facebook-comments-scraper-webhook-support)

This Apify actor is designed for businesses, teams, and individuals—supporting video URLs, post URLs, photo URLs, and reels—without the hassle of manual scraping or complex setups, making it perfect for analyzing conversations, monitoring engagement, and gathering insights from Facebook.

##### [Facebook Profiles and Pages Scraper](https://apify.com/devninja/facebook-profiles-pages-scraper)

[![Rating](https://img.shields.io/badge/Rating-5.0-green)](https://apify.com/devninja/facebook-profiles-pages-scraper)

A powerful data extraction tool for collecting posts, comments, reactions, and media from public Facebook profiles and pages. Perfect for social media analysis, content research, and market intelligence.

##### [Facebook Groups Scraper](https://apify.com/devninja/facebook-groups-scraper)

[![Rating](https://img.shields.io/badge/Rating-5.0-green)](https://apify.com/devninja/facebook-groups-scraper)

Extract posts, reactions, and media from public Facebook groups for social media analysis and market research.

#### 📄 AI-Powered Tools

##### [AI Facebook Post Analyzer](https://apify.com/devninja/ai-facebook-post-analyzer)

[![Rating](https://img.shields.io/badge/Rating-5.0-green)](https://apify.com/devninja/ai-facebook-post-analyzer)

This actor transforms Facebook posts into actionable business insights. Search for posts about any topic, analyze them with AI, and get intelligent answers to your business questions. Perfect for market research, brand monitoring, trend analysis, and competitive intelligence.

##### [AI Document Assistant](https://apify.com/devninja/ai-document-assistant)

[![Rating](https://img.shields.io/badge/Rating-5.0-green)](https://apify.com/devninja/ai-document-assistant)

This actor analyzes uploaded documents using AI to extract and process information. It helps businesses quickly get answers from their documents and automate decision-making.

##### [AI Humor and Quotes Generator](https://apify.com/devninja/ai-humor-quotes-generator)

[![Rating](https://img.shields.io/badge/Rating-5.0-green)](https://apify.com/devninja/ai-humor-quotes-generator)

Generate original jokes, inspirational quotes, or a mix of both based on your keywords. Perfect for content creators, social media managers, greeting cards, presentations, and entertainment apps. Uses advanced prompt engineering to create family-friendly, engaging content.

#### 📄 Specialized Scrapers

##### [Streem Article Scraper](https://apify.com/devninja/streem-article-scraper)

[![Rating](https://img.shields.io/badge/Rating-5.0-green)](https://apify.com/devninja/streem-article-scraper)

Extract full-text articles and metadata from Streem article links with ease. This actor is built for reliability and scalability—simply provide a list of Streem URLs, and it will crawl each page, clean the content, and return structured results.

***

*All actors are developed by [Devinja](https://apify.com/devninja) and maintained with regular updates for optimal performance and reliability.*

# Actor input Schema

## `query` (type: `string`):

Supports multiple comma-delimited queries. Each query will be searched separately. Example: 'technology, movies'.

## `search_type` (type: `string`):

Type of content to search for

## `max_posts` (type: `integer`):

Maximum number of posts to extract Per Query i.e technology = 10, movies = 10

## `recent_posts` (type: `boolean`):

Focus on recent posts (affects search sorting)

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

Start date for filtering posts (YYYY-MM-DD format)

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

End date for filtering posts (YYYY-MM-DD format)

## Actor input object example

```json
{
  "query": "technology, movies",
  "search_type": "posts",
  "max_posts": 50,
  "recent_posts": false
}
```

# 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("devninja/facebook-post-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("devninja/facebook-post-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 '{}' |
apify call devninja/facebook-post-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Post Scraper",
        "description": "This actor helps you collect Facebook posts quickly. Extract public posts from Facebook pages, profiles, and groups with keyword-based filtering, and smart anti-bot detection for reliable data extraction",
        "version": "1.0",
        "x-build-id": "XZl4m2WGk1yLtghbr"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/devninja~facebook-post-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-devninja-facebook-post-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/devninja~facebook-post-scraper/runs": {
            "post": {
                "operationId": "runs-sync-devninja-facebook-post-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/devninja~facebook-post-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-devninja-facebook-post-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "max_posts",
                    "query",
                    "search_type"
                ],
                "properties": {
                    "query": {
                        "title": "🟢 Search Queries i.e technology, movies",
                        "maxLength": 100,
                        "type": "string",
                        "description": "Supports multiple comma-delimited queries. Each query will be searched separately. Example: 'technology, movies'.",
                        "default": "technology"
                    },
                    "search_type": {
                        "title": "🟢 Search Type",
                        "enum": [
                            "posts",
                            "videos",
                            "reels"
                        ],
                        "type": "string",
                        "description": "Type of content to search for",
                        "default": "posts"
                    },
                    "max_posts": {
                        "title": "🟢 Maximum Posts Per Query",
                        "minimum": 1,
                        "maximum": 1500,
                        "type": "integer",
                        "description": "Maximum number of posts to extract Per Query i.e technology = 10, movies = 10",
                        "default": 50
                    },
                    "recent_posts": {
                        "title": "Recent Posts Only",
                        "type": "boolean",
                        "description": "Focus on recent posts (affects search sorting)",
                        "default": false
                    },
                    "start_date": {
                        "title": "Start Date",
                        "type": "string",
                        "description": "Start date for filtering posts (YYYY-MM-DD format)"
                    },
                    "end_date": {
                        "title": "End Date",
                        "type": "string",
                        "description": "End date for filtering posts (YYYY-MM-DD format)"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
