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

Input Facebook post or reel URLs and Outputs captions, post types, uploader info, likes, comments, shares, views, hashtags, comments with authors, images, video variants, audio tracks & download URLs.

- **URL**: https://apify.com/codenest/facebook-post-scraper.md
- **Developed by:** [CodeNest](https://apify.com/codenest) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 facebook post scraped (basic)s

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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

## 📘 Facebook Post Scraper - Ultimate Post & Engagement Data Extractor

**Effortlessly extract complete Facebook post data with our powerful **Facebook Post Scraper**! This Apify actor enables bulk scraping of post content, engagement metrics, media assets, and comments from any public Facebook post or reel.**

***

### 📋 Overview

Need to archive Facebook posts, analyze engagement, or track viral content? This **Facebook Post Scraper** delivers:

- 📝 **Complete Post Data** - Captions, descriptions, titles, and post types
- 📊 **Engagement Metrics** - Likes, comments, shares, and view counts
- 💬 **Comment Extraction** - Full comments with author details and timestamps
- 🖼️ **Media Assets** - Images, videos, reels, and downloadable URLs
- 🎬 **Video Variants** - Multiple quality options (HD/SD) with audio tracks
- 🏷️ **Hashtag & Mention Detection** - Extracted tags from captions

Perfect for social media analysts 📈, content researchers 🔬, marketing teams 📊, and data journalists 📰!

***

### ⭐ Core Capabilities of Facebook Post Scraper

#### 📝 Post Content Extraction

- **Full Caption Extraction** - Complete post text content
- **Post Type Detection** - Photo, video, reel, photoset, and more
- **Title & Description** - Structured post metadata
- **Uploader Information** - Author name, ID, and profile URL
- **Timestamp Data** - Published time, formatted dates, and relative dates

#### 📊 Engagement Metrics

- **Like Counts** - Total reactions on posts
- **Comment Counts** - Total comments received
- **Share Counts** - Post share metrics
- **View Counts** - Video and reel view counts
- **Reaction Data** - Engagement summary statistics

#### 💬 Comment Extraction

- **Full Comment Text** - Complete comment content
- **Comment Authors** - Name, ID, and profile URL
- **Comment Timestamps** - Creation time for each comment
- **Comment IDs** - Unique identifiers for tracking
- **Configurable Limits** - Set maximum comments to extract

#### 🖼️ Media Asset Extraction

- **Image URLs** - Direct links to post images
- **Image Metadata** - Width, height, and resolution info
- **Video Variants** - Multiple quality options (HD/SD)
- **Reel Downloads** - Direct reel video URLs
- **Audio Tracks** - Separate audio extraction for videos
- **Thumbnail URLs** - Preview images for all media

#### 🏷️ Content Analysis

- **Hashtag Detection** - Extracted hashtags from captions
- **Mention Detection** - Extracted @mentions
- **Tag Extraction** - Additional content tags

***

### ⚙️ Input Configuration

Simply enter Facebook post URLs, configure comment extraction, and click "Start". Input looks like this:

```json
{
  "include_comments": true,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  },
  "urls": [
    { "url": "https://web.facebook.com/share/p/186YkWA625/" },
    { "url": "https://web.facebook.com/share/v/1KtWb1ceJB/" }
  ],
  "max_comments": 25
}
```

#### 📝 Input Specifications

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `urls` | Array | ✅ Yes | - | Facebook post URLs to scrape |
| `url` | String | ✅ Yes | - | Valid Facebook post or reel URL |
| `include_comments` | Boolean | ❌ No | true | Extract comments from posts |
| `max_comments` | Integer | ❌ No | 25 | Maximum comments per post |
| `proxy.useApifyProxy` | Boolean | ❌ No | true | Enable Apify proxy rotation |
| `proxy.apifyProxyGroups` | Array | ❌ No | \["RESIDENTIAL"] | Proxy groups for scraping |

***

### 📤 Output Structure

Your **Facebook Post Scraper** produces comprehensive post data with engagement metrics and comments:

```json
[
  {
    "url": "https://www.facebook.com/amanullah.t.9/posts/pfbid027C8sc...",
    "input_url": "https://web.facebook.com/share/p/186YkWA625/",
    "title": "Dutch Bangla Bank Math...",
    "description": "Dutch Bangla Bank Math...",
    "caption": "Dutch Bangla Bank Math...",
    "post_type": "photo",
    "uploader": "Aman Ullah",
    "uploader_id": "100002938917817",
    "uploader_url": "https://www.facebook.com/100002938917817",
    "published_time": 1786704241,
    "date": "2026-08-14T10:44:01Z",
    "post_date": "Friday 14 August 2026 at 03:44",
    "relative_date": "about a month ago",
    "like_count": "424",
    "comment_count": "28",
    "share_count": "86",
    "hashtags": ["DBBL", "viralpost"],
    "mentions": [],
    "recent_comments_count": 10,
    "comments": [
      {
        "id": "Y29tbWVudDoyNzg2MjU2MzI4MDA5MTU5NV8xMTE2MDgzODIxMDgxOTQy",
        "text": "#ব্যাংক প্রিলি গাইডলাইন ব্যাচ...",
        "author": "Aman Ullah",
        "author_id": "100002938917817",
        "author_url": "https://www.facebook.com/100002938917817",
        "created_time": 1786704263
      }
    ],
    "images": [
      {
        "url": "https://scontent.fvii2-1.fna.fbcdn.net/...",
        "quality": "high",
        "type": "photo"
      }
    ],
    "images_count": 1,
    "photo_download_url": "https://scontent.fvii2-1.fna.fbcdn.net/...",
    "video_variants": [],
    "thumbnail_url": "https://scontent.fvii2-1.fna.fbcdn.net/...",
    "scraped_at": "2026-09-15T03:54:38.654665Z"
  }
]
```

#### 📖 Output Field Documentation

**🔹 Post Identification**
| Field | Description |
|-------|-------------|
| `url` | Resolved Facebook post URL |
| `input_url` | Original input URL provided |
| `post_type` | Type of post (photo, reel, photoset) |

**🔹 Content Data**
| Field | Description |
|-------|-------------|
| `title` | Post title |
| `description` | Full post description |
| `caption` | Post caption text |
| `hashtags` | Extracted hashtags array |
| `mentions` | Extracted @mentions array |
| `tags` | Additional content tags |

**🔹 Author Information**
| Field | Description |
|-------|-------------|
| `uploader` | Post author name |
| `uploader_id` | Facebook author ID |
| `uploader_url` | Author profile URL |

**🔹 Timestamp Data**
| Field | Description |
|-------|-------------|
| `published_time` | Unix timestamp |
| `date` | ISO 8601 formatted date |
| `post_date` | Human-readable date |
| `relative_date` | Relative time (when available) |

**🔹 Engagement Metrics**
| Field | Description |
|-------|-------------|
| `like_count` | Total reactions |
| `comment_count` | Total comments |
| `share_count` | Total shares |
| `view_count` | View count (videos/reels) |
| `recent_comments_count` | Extracted comments count |

**🔹 Comments Data**
| Field | Description |
|-------|-------------|
| `id` | Unique comment ID |
| `text` | Comment content |
| `author` | Commenter name |
| `author_id` | Commenter Facebook ID |
| `author_url` | Commenter profile URL |
| `created_time` | Comment timestamp |

**🔹 Media Assets**
| Field | Description |
|-------|-------------|
| `images` | Array of image objects |
| `images_count` | Total images in post |
| `photo_download_url` | Direct image download URL |
| `video_variants` | Video quality options |
| `reel_download_url` | Reel video download URL |
| `audio_download_url` | Extracted audio track URL |
| `audio_variants` | Audio format options |
| `thumbnail_url` | Media preview image |

***

### 🎨 Key Features of This Facebook Post Scraper

#### 📊 Engagement Analytics

- **Reaction Tracking** - Likes, comments, and shares
- **View Metrics** - Video and reel view counts
- **Formatted Counts** - Human-readable K/M/B values
- **Cross-Post Comparison** - Analyze multiple posts

#### 💬 Complete Comment Extraction

- **Configurable Limits** - Set maximum comments per post
- **Full Comment Data** - Text, author, and timestamp
- **Author Profiles** - Direct links to commenter profiles
- **Comment IDs** - Unique identifiers for tracking

#### 🎬 Media Extraction

- **Multiple Video Qualities** - HD and SD variants
- **Reel Support** - Direct reel video downloads
- **Audio Extraction** - Separate audio tracks for videos
- **Image Downloads** - High-resolution image URLs
- **Thumbnail Capture** - Preview images for all posts

#### 🏷️ Content Intelligence

- **Hashtag Extraction** - Automatic hashtag detection
- **Mention Detection** - Extracted @mentions
- **Post Type Detection** - Photo, video, reel, photoset
- **Caption Preservation** - Full text without alteration

#### 🌐 Proxy Support

- **Apify Proxy Integration** - Built-in proxy rotation
- **Residential Proxies** - Reliable scraping infrastructure
- **Rate Limit Avoidance** - Smart request handling

***

### 💡 Use Cases for Facebook Post Scraper

- **📊 Social Media Analysts** - Track engagement patterns
- **🔬 Content Researchers** - Study viral content
- **📰 Data Journalists** - Extract posts for reporting
- **🎯 Marketing Teams** - Monitor brand mentions
- **📈 Growth Marketers** - Analyze successful posts
- **💼 Competitive Intelligence** - Track competitor content
- **🎓 Academic Research** - Study social media trends
- **📱 Content Creators** - Archive and analyze posts

***

### ✨ Why Choose Our Facebook Post Scraper?

- **⚡ Fast & Reliable** - Quick post data extraction
- **🎯 100% Accurate** - Preserves all data without alteration
- **📦 Complete Data** - Everything from captions to comments
- **🔄 Regular Updates** - Adapts to Facebook changes
- **🛡️ Proxy Support** - Built-in Apify proxy integration
- **💰 Cost Efficient** - Optimized for minimal compute time
- **🔒 Privacy Focused** - Only public post data extracted

***

### ⚠️ Limitations

- Only works with publicly accessible Facebook posts
- Private or friends-only posts are not accessible
- Comment availability depends on privacy settings
- Rate limits may apply for high-volume scraping
- Some posts may not have all fields available

***

### 📧 Need Custom Features for Your Facebook Post Scraper?

Want **additional post fields**, **deeper comment extraction**, **custom output formats**, **advanced analytics**, or **automated reporting**?

✉️ Email **<codenest2.0@gmail.com>** for tailored enterprise solutions!

***

# Actor input Schema

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

List of public Facebook post URLs. Accepts photos, multi-image photosets, carousels, videos, and reels in any combination.

## `include_comments` (type: `boolean`):

Toggle ON to extract recent comments for each post (charges additional pay-per-event fee). Toggle OFF to scrape only media and basic post metrics at standard rate.

## `max_comments` (type: `integer`):

Maximum number of recent comments to extract per post (applicable when Include Comments is ON).

## `proxy` (type: `object`):

Proxy settings for requests. Apify Residential Proxy is recommended to prevent Facebook IP rate limits and geo-blocks.

## `cookie_header` (type: `string`):

Optional. Paste the raw Cookie header from your browser DevTools (Network tab -> any facebook.com request -> Headers -> Cookie). This unlocks login-gated posts and full comment threads.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://www.facebook.com/reel/1831270064408357"
    },
    {
      "url": "https://www.facebook.com/watch/?v=783325287492075"
    },
    {
      "url": "https://www.facebook.com/photo/?fbid=122101517096109874"
    }
  ],
  "include_comments": false,
  "max_comments": 25,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Tabular overview of scraped Facebook posts with authors, post types, published dates, likes, comments, shares, views, and captions.

## `allResults` (type: `string`):

Complete dataset containing full post metadata, high-resolution photos, direct MP4 video downloads, audio files, metrics, and comments.

## `outputRecord` (type: `string`):

Consolidated JSON array of all scraped posts stored in the default Key-Value Store.

# 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": [
        {
            "url": "https://www.facebook.com/reel/1831270064408357"
        },
        {
            "url": "https://www.facebook.com/watch/?v=783325287492075"
        },
        {
            "url": "https://www.facebook.com/photo/?fbid=122101517096109874"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("codenest/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 = { "urls": [
        { "url": "https://www.facebook.com/reel/1831270064408357" },
        { "url": "https://www.facebook.com/watch/?v=783325287492075" },
        { "url": "https://www.facebook.com/photo/?fbid=122101517096109874" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("codenest/facebook-post-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": [
    {
      "url": "https://www.facebook.com/reel/1831270064408357"
    },
    {
      "url": "https://www.facebook.com/watch/?v=783325287492075"
    },
    {
      "url": "https://www.facebook.com/photo/?fbid=122101517096109874"
    }
  ]
}' |
apify call codenest/facebook-post-scraper --silent --output-dataset

```

## MCP server setup

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