# Facebook Pages Scraper (`caprolok/facebook-pages-scraper`) Actor

📘 Unlock the power of social media with Facebook Post Scraper! Extract detailed insights from posts, including likes 👍, comments 💬, shares 🔁, and more. Download in JSON, CSV, Excel. Perfect for market research, trend analysis, and competitive monitoring. 🚀

- **URL**: https://apify.com/caprolok/facebook-pages-scraper.md
- **Developed by:** [Caprolok](https://apify.com/caprolok) (community)
- **Categories:** Social media, SEO tools
- **Stats:** 1,213 total users, 5 monthly users, 55.7% runs succeeded, 17 bookmarks
- **User rating**: 2.19 out of 5 stars

## 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?

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 Page Scraper

### 🚀 What is Facebook Page Scraper?

Facebook Page Scraper is an advanced tool designed to meticulously extract data from Facebook pages, providing a wealth of information for various applications. This tool is indispensable for those looking to tap into the rich vein of data available on Facebook for enhancing applications, reports, and research. Whether it's for market research or trend analysis, Facebook Page Scraper delivers the insights you need in accessible formats such as JSON, CSV, and Excel.

### 🛠 Enhanced Features

Facebook Page Scraper offers an array of features that extend beyond simple data extraction, offering deep insights into page dynamics and user interactions. The key features include:

- 📄 **Page Content:** Dive into the content of pages to understand messaging trends, user engagement, and content strategy.
- 🔗 **Page URL:** Direct links to the pages for in-depth analysis and easy reference.
- 🕒 **Timestamp:** Track the timing of page updates to identify patterns and peak activity times.
- 👍 **Engagement Metrics:** Get a detailed look into the interaction dynamics with metrics such as:
  - ❤️ **Likes Count:** Assess the popularity and appeal of pages.
  - 💬 **Comments Count:** Gauge audience engagement and feedback on page posts.
  - 🔁 **Shares Count:** Understand the virality and reach of the page's content.
  - 👀 **Video View Count:** For pages with video content, get view counts to evaluate content reach and viewer engagement.
- 🗂 **Detailed Page Insights:** Extract comprehensive information about the pages including bio, category, and follower count.
- 📊 **Customizable Data Export:** Export data in formats like JSON, CSV, and Excel, ensuring compatibility with various tools and workflows.

### 🎯 Why Choose Facebook Page Scraper?

Facebook Page Scraper is your go-to tool for a range of analytical and strategic applications:

- 🕵️‍♂️ **Competition Monitoring:** Monitor competitors' Facebook strategies, engagement levels, and audience interactions to stay ahead.
- 🔍 **Market Research:** Extract detailed data from pages to uncover market trends, consumer preferences, and industry insights.
- 📈 **Trend Analysis:** Identify trending topics and sentiments across Facebook to inform your content and marketing strategies.
- 📡 **Social Media Analysis:** Conduct thorough analyses to detect misinformation, track engagement trends, and understand overall content performance on pages.

### 📋 Easy to Start

Kickstart your data extraction journey with Facebook Page Scraper effortlessly:

1. Open the Facebook Page Scraper tool.
2. Enter the URL(s) of the Facebook page(s) you wish to analyze.
3. Click "Save & Start" to initiate the data extraction process.
4. Download the compiled data in your preferred format to analyze and integrate into your projects.

### 🌟 Transform Your Data Insights

Elevate your projects and strategies with comprehensive insights from Facebook with the Facebook Page Scraper. Begin leveraging the vast data on Facebook pages today to make informed decisions that propel your success.

# Actor input Schema

## `profile_urls` (type: `array`):

Enter a valid Facebook page URL. Only public pages are supported, not personal profiles.

## `post_urls` (type: `array`):

Optional. Enter a public Facebook post URL.

## `max_results` (type: `integer`):

If this limit is not set, by default 15 posts will be returned

## `afterTime` (type: `string`):

Scrapes post from the provided date to the present day (or date set in 'Older than'). The date should be in YYYY-MM-DD format.

## `beforeTime` (type: `string`):

Scrapes post from the provided date to the past (or date set in 'Newer than'). The date should be in YYYY-MM-DD format.

## Actor input object example

```json
{
  "profile_urls": [
    {
      "url": "https://www.facebook.com/NASA"
    }
  ],
  "post_urls": [],
  "max_results": 15
}
```

# Actor output Schema

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

Posts from the public pages you entered, including caption, date, reactions, and media when available.

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

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

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

```

## MCP server setup

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