# Facebook Group & Post Scraper (Posts, Comments, Media) (`dazzling_browser_mce/facebook-group-exporter`) Actor

Fast, reliable & stealth Facebook scraper. Extract group posts, full nested comments with replies, reactions, shares, author info, and high-res media. Export to CSV, Excel, or JSON.

- **URL**: https://apify.com/dazzling\_browser\_mce/facebook-group-exporter.md
- **Developed by:** [RoYz](https://apify.com/dazzling_browser_mce) (community)
- **Categories:** Social media, Lead generation, Marketing
- **Stats:** 2 total users, 1 monthly users, 20.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 Group & Post Scraper (Posts, Comments, Media)

An all-in-one, high-performance scraper for **Facebook Groups** and **Posts**. Extract feed posts, complete nested comment threads (with replies & mentions), reactions, shares, and high-resolution media attachments.

Built with **Anti-Ban Stealth technology** and full session protection (`datr`, `sb`, `c_user`, `xs`), ensuring your account remains completely safe without unexpected logouts or checkpoints.

***

### 🌟 Key Features

- **📥 1. Latest Group Posts Extraction (Fast):**
  - Automatically fetches the newest/latest posts directly from the top of the group feed.
  - Post text content, post ID, and author name & ID.
  - Exact publication timestamp (formatted as `YYYY-MM-DD HH:MM:SS`).
  - Reaction counts (Likes, Loves, etc.), comment counts, and share counts.
  - Direct permalinks to each post.
  - Pipe-delimited media URLs (`url1 | url2`) for clean single-line Excel rows.
  - Zero-width space (`\u200b`) protection so Excel won't corrupt large Facebook IDs into scientific notation (e.g. `1.79E+15`).

- **💬 2. Deep Post Comments Extraction:**
  - Extracts root comments and all nested replies.
  - Captures commenter profile names, author IDs, comment timestamps, and mentions.

- **📸 3. High-Resolution Media Extraction:**
  - Extracts direct full-size image & video URLs from single posts or multi-photo albums.

- **🛡️ 4. Anti-Ban Stealth & Safe Sessions:**
  - Uses `selenium-stealth` to mask automation indicators (`navigator.webdriver`).
  - Injects full cookie headers (`datr`, `sb`, `c_user`, `xs`) to preserve device fingerprints and prevent Facebook from triggering security checkpoints.

***

### 📊 Comparison: Why Choose This Scraper?

| Feature | This Actor | Traditional Scrapers |
| :--- | :---: | :---: |
| **Account Safety (Session Preservation)** | ✅ **100% Safe (Full Cookie Sync)** | ❌ Often causes account lockout |
| **Excel-Ready Formatting** | ✅ **IDs & Dates Pre-Formatted** | ❌ Numbers broken in Excel |
| **Nested Comment Replies** | ✅ **Full Thread Extraction** | ❌ Top-level comments only |
| **Album & High-Res Media** | ✅ **Direct Image & Video URLs** | ❌ Thumbnails only |
| **Speed & Reliability** | ⚡ **Direct GraphQL Pagination** | 🐢 Slow DOM parsing |

***

### 📖 How to Use

#### Step 1: Get Your Facebook Cookies (`c_user` & `xs`)

1. Open Chrome/Edge and log in to [Facebook](https://www.facebook.com).
2. Open Developer Tools (`F12`) -> **Application** -> **Cookies** -> `https://www.facebook.com` (or use the free **Cookie-Editor** extension).
3. Copy the value of **`c_user`** and **`xs`**.

#### Step 2: Configure & Run

1. **Target URL:** Paste the Facebook Group URL (e.g. `https://www.facebook.com/groups/luxurycondobkk/`).
2. **c\_user & xs:** Paste your `c_user` and `xs` cookie values into the respective fields.
3. Set the **Max Posts** you wish to scrape and click **Start**.

***

### 📥 Input Parameters

| Parameter | Type | Description | Default |
| :--- | :--- | :--- | :--- |
| `url` | String | Facebook Group URL to extract posts from | *Required* |
| `c_user` | String | Facebook User ID cookie (e.g. `100084729...`) | *Required (or `cookie`)* |
| `xs` | String | Facebook Session token cookie (e.g. `24%3A...`) | *Required (or `cookie`)* |
| `count` | Integer | Maximum number of latest posts to extract | `20` |
| `cookie` | String | Alternative: Full Cookie Header String (`c_user=...; xs=...; datr=...`) | Optional |
| `user_agent` | String | Custom User-Agent for custom browser simulation | Latest Chrome |

***

### 📤 Sample Output Data (JSON / CSV)

```json
{
  "post_id": "​1795628701447592",
  "author_id": "​61590621901221",
  "author_name": "Luxury Real Estate",
  "text": "Exclusive penthouse for sale in Bangkok CBD. Prime location, 3 bedrooms, 250 sqm.",
  "created_time": "2026-08-21 18:55:00",
  "reaction_count": 48,
  "comment_count": 12,
  "share_count": 5,
  "permalink": "https://www.facebook.com/groups/luxurycondobkk/posts/1795628701447592/",
  "media_total_count": 4,
  "media_urls_complete": true,
  "media_urls": "https://scontent.xx.fbcdn.net/v/...jpg | https://scontent.xx.fbcdn.net/v/...jpg",
  "comments": "Comment | John Doe | author_id: 10001 | 2026-08-21 19:10:00 | Is this still available?"
}
```

***

### 💡 Best Practices & Tips

> \[!WARNING]
> **DO NOT USE YOUR MAIN PERSONAL ACCOUNT!**
> Web scraping carries inherent risks. Facebook strictly monitors automated behavior. Even with our advanced stealth technology, accounts used for scraping may face temporary checkpoints or permanent bans.
> **Always use a secondary, dummy, or burner account** dedicated specifically for data extraction to ensure your primary personal account remains safe.

- **Preserve `datr` & `sb`:** Always copy the full cookie string from Cookie-Editor to maintain session integrity and prevent login alerts.

***

### ⚖️ Legal & Privacy

This actor is designed for authorized research, marketing intelligence, and personal data management. Users are responsible for complying with Facebook's Terms of Service and applicable privacy regulations (GDPR/CCPA).

# Actor input Schema

## `url` (type: `string`):

Paste the link to the Facebook Group you want to extract posts from.

## `c_user` (type: `string`):

Your Facebook User ID cookie (e.g. 100084729104821). Found in Chrome DevTools or Cookie-Editor.

## `xs` (type: `string`):

Your Facebook Session Token cookie (e.g. 24%3Ab2k1...%3A2). Found in Chrome DevTools or Cookie-Editor.

## `count` (type: `integer`):

How many of the LATEST posts do you want to scrape? (E.g. 20, 50, 100)

## `cookie` (type: `string`):

Optional: If you prefer pasting your full cookie header string all at once instead of c\_user & xs.

## `user_agent` (type: `string`):

Leave this as default unless you want a specific custom browser signature.

## Actor input object example

```json
{
  "url": "https://www.facebook.com/groups/luxurycondobkk/",
  "count": 20,
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "url": "https://www.facebook.com/groups/luxurycondobkk/",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
};

// Run the Actor and wait for it to finish
const run = await client.actor("dazzling_browser_mce/facebook-group-exporter").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 = {
    "url": "https://www.facebook.com/groups/luxurycondobkk/",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
}

# Run the Actor and wait for it to finish
run = client.actor("dazzling_browser_mce/facebook-group-exporter").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 '{
  "url": "https://www.facebook.com/groups/luxurycondobkk/",
  "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
}' |
apify call dazzling_browser_mce/facebook-group-exporter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dazzling_browser_mce/facebook-group-exporter"
        }
    }
}

```

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/i6NbJjXduQnJggKGv/builds/Ibwl4WB2J905T6vsd/openapi.json
