# Facebook Pages Groups Scraper (`sophisticated_zythum/facebook-pages-groups-scraper`) Actor

- **URL**: https://apify.com/sophisticated\_zythum/facebook-pages-groups-scraper.md
- **Developed by:** [Md Saif Ahmed](https://apify.com/sophisticated_zythum) (community)
- **Categories:** Social media, Agents, SEO tools
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.37 / result

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.

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

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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 Pages & Groups Scraper

Extract posts from Facebook Pages & Groups.

Built on enterprise-grade infrastructure with a **100% success rate** and pay-per-result pricing — you only pay for posts actually delivered.

---

### What does Facebook Pages & Groups Scraper do?

This actor collects public data from Facebook Pages and Groups:

- **Posts** — content, likes, comments, shares, media, timestamps
- **Page/Group Profiles** — name, URL, follower count, category
- **Media** — images and videos from posts
- **Deduplication** — smart dedup across multiple targets
- **Sorting** — by recent or popular

Supports multiple URLs in a single run — scraping 5 pages takes the same time as scraping 1.

---

### ⚠️ Important: Cookie Required

This actor requires a **Facebook cookie** to extract more than 5 posts. Without a cookie, Facebook limits public view to ~5 posts.

#### Required cookies (only 2):

| Cookie | Description |
|--------|-------------|
| `c_user` | Your Facebook user ID (numbers only) |
| `xs` | Your session token (long string with `%3A` encoding) |

#### How to get your cookies:

1. Open Facebook in your browser and log in (use a **throwaway account**)
2. Press **F12** to open DevTools
3. Go to **Application** tab → **Cookies** → `https://www.facebook.com`
4. Find and copy the values of `c_user` and `xs`
5. Enter each value in the corresponding input field

**⚠️ Use a throwaway Facebook account** — your real account could be banned if Facebook detects unusual activity.

**Cookie expires in ~24-48 hours** — you'll need to get a new cookie periodically.

**Note:** Only `c_user` and `xs` are required. Other cookies like `presence`, `wd`, `fr`, etc. are not needed.

---

### What data do you get?

#### Post fields

| Field | Description |
|---|---|
| `type` | Record type (`post`) |
| `pageId` | Page or Group ID |
| `postId` | Unique Facebook post ID |
| `author` | Post author name |
| `content` | Post text content |
| `likes` | Total likes |
| `comments` | Total comments |
| `shares` | Total shares |
| `media` | Array of images/videos |
| `postUrl` | Direct link to the post |
| `timestamp` | When the post was published |
| `extractedAt` | Timestamp of extraction |

#### Profile fields

| Field | Description |
|---|---|
| `type` | Record type (`profile`) |
| `pageId` | Page or Group ID |
| `pageName` | Page or Group name |
| `url` | Facebook URL |
| `followers` | Follower count |
| `about` | About description |
| `category` | Category (e.g., "Group", "Media") |
| `verified` | Whether the page is verified |
| `extractedAt` | Timestamp of extraction |

---

### Use cases

- **Competitor analysis** — Monitor a competitor's posting frequency, engagement, and content strategy
- **Market research** — Understand how your audience talks about a topic
- **Content strategy** — Identify top-performing post formats and topics
- **Community monitoring** — Track discussions in industry groups
- **Lead generation** — Build lists of active pages in a niche
- **Academic research** — Collect public social media data for studies

---

### How to use

#### 1. Get your Facebook cookie

Follow the instructions above to get `c_user` and `xs` values from a throwaway account.

#### 2. Add your targets

Provide one or more Facebook Page or Group URLs:
- **Pages**: `https://www.facebook.com/natgeo`
- **Groups**: `https://www.facebook.com/groups/photography`

#### 3. Set filters (optional)

- **Max Posts** — how many posts per target (default: 50, max: 500)
- **Sort Order** — Recent or Popular
- **Min Likes** — skip posts below this threshold
- **Min Comments** — skip posts below this threshold
- **Newer Than** — only posts from the last N days

#### 4. Run and export

Results appear in the **Dataset** tab. Export as JSON, CSV, or Excel.

---

### Input example

```json
{
  "targets": [
    "https://www.facebook.com/natgeo",
    "https://www.facebook.com/groups/photography"
  ],
  "cUser": "61592410981000",
  "xs": "44%3A4Yf88PLrCDu9Dw%3A2%3A1784999879%3A-1%3A-1%3A%3AAcza15Ezu72iy5XNF9Nk4g14P5-i_9_WxyKvnwBvQg",
  "maxPosts": 100,
  "sortOrder": "Recent",
  "minLikes": 100,
  "newerThan": 30
}
````

***

### Output example

#### Post record

```json
{
  "type": "post",
  "pageId": "natgeo",
  "postId": "1234567890",
  "author": "National Geographic",
  "content": "Exploring the depths of the ocean...",
  "likes": 15234,
  "comments": 432,
  "shares": 891,
  "media": [
    { "type": "image", "url": "https://..." }
  ],
  "postUrl": "https://www.facebook.com/natgeo/posts/1234567890",
  "timestamp": "2026-04-15T12:00:00.000Z",
  "extractedAt": "2026-05-07T10:00:00.000Z"
}
```

#### Profile record

```json
{
  "type": "profile",
  "pageId": "natgeo",
  "pageName": "National Geographic",
  "url": "https://www.facebook.com/natgeo",
  "followers": 48000000,
  "about": "Experience the world through the eyes of National Geographic photographers.",
  "category": "Media/news company",
  "verified": true,
  "extractedAt": "2026-05-07T10:00:00.000Z"
}
```

***

### Pricing

This actor uses **pay-per-result** pricing — you are only charged for posts successfully extracted.

| Plan | Price per 1,000 posts |
|---|---|
| Free | $2.99 |
| Starter | $2.43 |
| Scale | $1.86 |
| Business | $1.37 |

There is no monthly subscription. Charges apply only when the actor runs successfully.

You can cap total spend using Apify's **Max total charge** setting before running.

***

### FAQ

**Does this require a Facebook account or login?**
Yes. You need to provide a Facebook cookie from a throwaway account. This is required to view more than 5 posts.

**Can I scrape private groups?**
No. Only public Facebook Pages and Groups can be scraped.

**How many posts can I get per target?**
With a valid cookie, you can extract 50-100+ posts per target. Without a cookie, Facebook limits public view to ~5 posts.

**Does it work with groups?**
Yes. Simply provide a group URL (e.g., `https://www.facebook.com/groups/photography`) and the actor will extract public posts.

**How fresh is the data?**
Data is collected live from Facebook at the time you run the actor — always up to date.

**Is this legal?**
This actor collects only publicly available data from Facebook, in the same way a user would view a page or group in a browser. It complies with GDPR for public data collection. Always ensure your use case complies with your local regulations.

**How long does the cookie last?**
Facebook cookies typically expire in 24-48 hours. You'll need to get a new cookie periodically.

**Will this get my Facebook account banned?**
Using a throwaway account is recommended. Facebook may detect unusual activity and ban accounts used for scraping.

***

### Proxies

This actor uses **Apify Residential Proxies** by default for reliable scraping. You can configure alternative proxy settings in the Advanced section.

***

### Support

For issues or questions, please open an issue on the actor's GitHub repository.

# Actor input Schema

## `targets` (type: `array`):

Enter Facebook Page or Group URLs (one per line)

## `cUser` (type: `string`):

Your Facebook c\_user cookie (numbers only). Get from DevTools → Application → Cookies → facebook.com → c\_user

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

Your Facebook xs cookie (session token). Get from DevTools → Application → Cookies → facebook.com → xs

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

Maximum number of posts to extract per page or group

## `sortOrder` (type: `string`):

How to sort the extracted posts

## `minLikes` (type: `integer`):

Skip posts with fewer likes than this

## `minComments` (type: `integer`):

Skip posts with fewer comments than this

## `newerThan` (type: `integer`):

Only extract posts from the last N days

## `proxyConfiguration` (type: `object`):

Proxy settings for scraping

## Actor input object example

```json
{
  "targets": [
    "https://www.facebook.com/natgeo"
  ],
  "maxPosts": 50,
  "sortOrder": "Recent",
  "minLikes": 0,
  "minComments": 0,
  "newerThan": 0,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "targets": [
        "https://www.facebook.com/natgeo"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("sophisticated_zythum/facebook-pages-groups-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 '{
  "targets": [
    "https://www.facebook.com/natgeo"
  ]
}' |
apify call sophisticated_zythum/facebook-pages-groups-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Facebook Pages Groups Scraper",
        "description": null,
        "version": "0.0",
        "x-build-id": "Xo9zKTCulqsnWYxsY"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/sophisticated_zythum~facebook-pages-groups-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-sophisticated_zythum-facebook-pages-groups-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/sophisticated_zythum~facebook-pages-groups-scraper/runs": {
            "post": {
                "operationId": "runs-sync-sophisticated_zythum-facebook-pages-groups-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/sophisticated_zythum~facebook-pages-groups-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-sophisticated_zythum-facebook-pages-groups-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": [
                    "targets",
                    "cUser",
                    "xs"
                ],
                "properties": {
                    "targets": {
                        "title": "Facebook URLs",
                        "type": "array",
                        "description": "Enter Facebook Page or Group URLs (one per line)",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "cUser": {
                        "title": "c_user Cookie",
                        "type": "string",
                        "description": "Your Facebook c_user cookie (numbers only). Get from DevTools → Application → Cookies → facebook.com → c_user"
                    },
                    "xs": {
                        "title": "xs Cookie",
                        "type": "string",
                        "description": "Your Facebook xs cookie (session token). Get from DevTools → Application → Cookies → facebook.com → xs"
                    },
                    "maxPosts": {
                        "title": "Max Posts per Target",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of posts to extract per page or group",
                        "default": 50
                    },
                    "sortOrder": {
                        "title": "Sort Posts By",
                        "enum": [
                            "Recent",
                            "Popular"
                        ],
                        "type": "string",
                        "description": "How to sort the extracted posts",
                        "default": "Recent"
                    },
                    "minLikes": {
                        "title": "Minimum Likes",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Skip posts with fewer likes than this",
                        "default": 0
                    },
                    "minComments": {
                        "title": "Minimum Comments",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Skip posts with fewer comments than this",
                        "default": 0
                    },
                    "newerThan": {
                        "title": "Newer Than (days)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only extract posts from the last N days",
                        "default": 0
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings for scraping",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
