# Facebook Post Metadata Scraper (`w3crawler/facebook-post-metadata-scraper`) Actor

Extract stable public Facebook page and post metadata from HTML. The actor does not access private endpoints or claim unavailable comments.

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

## Pricing

from $2.99 / 1,000 post metadata

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

Extract public Facebook post or Page metadata from the HTML delivered by an anonymous request. For individual posts it identifies the public post ID, canonical URL, text, author, publication time, aggregate reactions/comments/shares, media type, Open Graph/Twitter metadata, selected head links, JSON-LD, and an optional bounded visible-text excerpt. Page URLs are accepted as a clearly labeled page-metadata fallback.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/facebook-post-metadata-scraper) and select **Try for free** or open the **Input** tab.
2. Set `startUrls` and `maxItems` for the data you need.
3. Keep `maxItems` and the other limits small for the first run.
4. Start the Actor, open the dataset, and export the saved records as JSON, CSV, or Excel. Open **Run summary** (`OUTPUT`) to check the outcome and counts.

### Input

All fields are optional; the defaults below are ready to use. Unsupported field names and out-of-range values are rejected before requests start.

| Field | Type | Required? | Default | Meaning |
| --- | --- | --- | --- | --- |
| `startUrls` | object array | Optional | Not supplied | Public Facebook page, post, Reel, Watch, photo, group permalink, or share URL to inspect. |
| `maxItems` | integer | Optional | `10` | Maximum number of unique input URLs to process; one dataset record is emitted per processed URL. 1–100. |
| `includePageText` | boolean | Optional | `true` | Include a bounded, script-free visible-text excerpt from an accessible public page. |
| `includeMedia` | boolean | Optional | `true` | Include public Open Graph and Twitter image URLs and image alt text when present. |
| `includeStructuredData` | boolean | Optional | `true` | Parse only public application/ld+json data. Facebook application-state JSON is not parsed. |
| `includeLinks` | boolean | Optional | `true` | Include bounded canonical, alternate, manifest, and icon link records from the HTML head. |
| `maxTextLength` | integer | Optional | `5000` | Maximum length of the optional visible-text excerpt per page. 100–20000. |
| `maxStructuredDataItems` | integer | Optional | `20` | Maximum number of public JSON-LD values to retain per page. 0–100. |
| `maxLinks` | integer | Optional | `20` | Maximum number of relevant public link records to retain per page. 0–100. |
| `maxConcurrency` | integer | Optional | `1` | Maximum number of public page requests running at once. Keep this low for Facebook. 1–3. |
| `minDelayMs` | integer | Optional | `250` | Minimum delay before each public request. Retries use bounded exponential pacing. 0–5000. |
| `maxDelayMs` | integer | Optional | `4000` | Upper bound for retry pacing, from 0 to 10000 ms; the runtime never waits longer than this configured value between attempts. |
| `maxRequestRetries` | integer | Optional | `2` | Number of retries after a network or transport failure. HTTP access blocks are not bypassed or retried. 0–5. |
| `requestTimeoutSecs` | integer | Optional | `45` | Timeout for each public HTML request. 5–60. |
| `maxBytes` | integer | Optional | `5000000` | Hard response-size limit for each public HTML request. 100000–5000000. |

Example input:

```json
{
  "startUrls": [
    {
      "url": "https://www.facebook.com/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol"
    }
  ],
  "maxItems": 10,
  "includePageText": true,
  "includeMedia": true,
  "includeStructuredData": true,
  "includeLinks": true,
  "maxTextLength": 5000,
  "maxStructuredDataItems": 20,
  "maxLinks": 20,
  "maxConcurrency": 1,
  "minDelayMs": 250,
  "maxDelayMs": 4000,
  "maxRequestRetries": 2,
  "requestTimeoutSecs": 45,
  "maxBytes": 5000000
}
```

The Actor reads public Facebook HTML with credential-free HTTP requests. Each `startUrls` entry is an object with a required `url` string. The Actor does not sign in, use cookies, call a private GraphQL endpoint, or claim comments that are not exposed in the delivered HTML.

### Output

The dataset contains one row per processed public URL. The schema declares no required fields; optional information appears only when the delivered public HTML publishes it, and missing values are omitted rather than inferred. No diagnostic or placeholder rows are written.

| Field | Type | Availability | Meaning |
| --- | --- | --- | --- |
| `url` | string | When a row is saved | Canonical record URL, preferring the public post URL and otherwise the public Page or request URL. |
| `requestUrl` | string | When a row is saved | Credential-free Facebook URL supplied for this record. |
| `sourceUrl` | string | When published | Alias for the supplied public URL. |
| `source` | string | When a row is saved | Public transport/source label. |
| `finalUrl` | string | When published | Final Facebook URL after bounded same-site redirects. |
| `pageTitle` | string | When published | HTML document title. |
| `isPost` | boolean | When published | Whether the public document resolved to an individual post. |
| `postId` | string | When published | Public post identifier when exposed in the URL or HTML. |
| `postUrl` | string | When published | Canonical public post URL when available. |
| `postText` | string | When published | Public post text from Open Graph or description metadata. |
| `authorName` | string | When published | Public author or Page name when exposed. |
| `authorId` | string | When published | Public author/Page identifier when exposed. |
| `authorUsername` | string | When published | Public author/Page path segment when available. |
| `publishedTimestamp` | integer | When published | Public post creation Unix timestamp when exposed. |
| `publishedAt` | string | When published | ISO representation of the public post creation time. |
| `reactionCount` | integer | When published | Public aggregate reaction count when exposed. |
| `commentCount` | integer | When published | Public aggregate comment count when exposed. |
| `shareCount` | integer | When published | Public aggregate share count when exposed. |
| `mediaType` | string | When published | Publicly inferred media type such as photo or video. |
| `pageDescription` | string | When published | Public page/document description metadata. |
| `imageUrl` | string | When published | First public Open Graph image URL when enabled. |
| `imageUrls` | string array | When published | Deduplicated public Open Graph image URLs. |
| `imageAlt` | string | When published | Public Open Graph image alt text. |
| `canonicalUrl` | string | When published | Public canonical URL from Open Graph or a canonical link. |
| `pageType` | string | When published | Public Open Graph type. |
| `locale` | string | When published | Public Open Graph locale. |
| `twitterTitle` | string | When published | Public Twitter card title. |
| `twitterDescription` | string | When published | Public Twitter card description. |
| `twitterImageUrl` | string | When published | Public Twitter card image URL. |
| `metadataKeys` | string array | When published | Sorted public meta property/name keys observed in the HTML. |
| `linkRelTypes` | string array | When published | Sorted public link-rel tokens observed in the HTML head. |
| `links` | object array | When published | Bounded public canonical/alternate/manifest/icon link records. |
| `publicStructuredData` | object array | When published | Bounded public application/ld+json objects; application-state JSON is not parsed. |
| `pageText` | string | When published | Optional bounded script-free visible text excerpt. |
| `pageTextAvailable` | boolean | When published | Whether a visible text excerpt was retained. |
| `pageTextTruncated` | boolean | When published | Whether the visible text exceeded maxTextLength. |
| `scrapedAt` | string | When a row is saved | UTC time when the record was normalized. |

No current-schema post-metadata rows are stored in the Actor's default local dataset, so the example is an empty array rather than an invented post record:

```json
[]
```

When a row is saved, `url` is the canonical post URL when available and otherwise the Page URL; `requestUrl` and `sourceUrl` preserve the supplied input. Page URLs produce a Page-metadata fallback with `isPost: false`, while individual posts set `postId`, `postUrl`, and the post-level metadata that the public HTML exposes. Missing comments are not fabricated: this Actor does not return comments.

### Run summary

**Run summary** is stored separately from the dataset in the run's key-value store under `OUTPUT`.

| Field | Meaning |
| --- | --- |
| `recordType` | Summary discriminator; always `facebook-post-metadata-run-summary`. |
| `id` | Run-summary identifier derived from the supplied URL set. |
| `status` | Actor process outcome: `SUCCEEDED` or `FAILED`. |
| `runStatus` | Canonical run status; matches `status`. |
| `dataStatus` | Completeness of the saved records: `COMPLETE`, `PARTIAL`, `NO_RESULTS`, or `FAILED`. |
| `itemCount` | Page or post records written to the dataset. |
| `postMetadataCount` | Records resolved to an individual public post. |
| `dataAvailableCount` | Records with a public HTML response and usable metadata. |
| `blockedCount` | Records blocked, denied, empty, or failed closed. |
| `diagnosticItems` | Diagnostic dataset rows; always zero because diagnostics stay in the summary and logs. |
| `diagnosticCount` | Operational issues recorded for the run. |
| `failedCount` | Requests or extractions that failed. |
| `dataAvailable` | Whether at least one source-backed record was saved. |
| `scrapedAt` | Time the first record was normalized, in ISO UTC. |
| `completedAt` | Time the run summary was written, in ISO UTC. |

No current-schema `OUTPUT` snapshot is stored in the Actor's default key-value store, so the summary table is shown without a value example.

| Status | Data status | Meaning |
| --- | --- | --- |
| `SUCCEEDED` | `COMPLETE` | Eligible URLs were processed and their available metadata was saved. |
| `SUCCEEDED` | `PARTIAL` | Some records were saved, but a later request or extraction failed. Saved rows remain available. |
| `SUCCEEDED` | `NO_RESULTS` | The URLs were processed cleanly but no usable public metadata was found. |
| `FAILED` | `FAILED` | A fatal error occurred before any usable record was saved. |

### Coverage and limitations

The Actor reads public HTML delivered to an anonymous request. It does not log in, use cookies, call private GraphQL endpoints, bypass access controls, or return comments that are not present in the delivered page. Individual post URLs produce post-level metadata when the HTML exposes it; Page URLs produce a clearly labeled Page-metadata fallback with `isPost: false`.

Fields absent from the public HTML are omitted rather than invented. Page text is bounded by `maxTextLength`, JSON-LD by `maxStructuredDataItems`, and link records by `maxLinks`. Access-denied, empty, or blocked responses are reported in the run summary and logs, not written as dataset rows. Optional image and structured-data fields appear only when enabled and publicly present.

### Usage and support

Cost depends on URL count, response size, retries, timeouts, and concurrency. Start with small item and page limits, inspect the dataset and run summary, then scale gradually. See the Actor's Pricing tab for current account rates. Use the [Actor Issues page](https://apify.com/w3crawler/facebook-post-metadata-scraper/issues) to report a problem. Include the run ID, the input used, and the run summary; do not include tokens, cookies, or private data. This Actor is not affiliated with Facebook. Use it only for public data and in accordance with the source's terms, robots guidance, and applicable law. Public pages can contain personal information; use the output only for lawful purposes.

# Actor input Schema

## `startUrls` (type: `array`):

Public Facebook page, post, Reel, Watch, photo, group permalink, or share URL to inspect.

## `maxItems` (type: `integer`):

Maximum number of unique input URLs to process; one dataset record is emitted per processed URL.

## `includePageText` (type: `boolean`):

Include a bounded, script-free visible-text excerpt from an accessible public page.

## `includeMedia` (type: `boolean`):

Include public Open Graph and Twitter image URLs and image alt text when present.

## `includeStructuredData` (type: `boolean`):

Parse only public application/ld+json data. Facebook application-state JSON is not parsed.

## `includeLinks` (type: `boolean`):

Include bounded canonical, alternate, manifest, and icon link records from the HTML head.

## `maxTextLength` (type: `integer`):

Maximum length of the optional visible-text excerpt per page.

## `maxStructuredDataItems` (type: `integer`):

Maximum number of public JSON-LD values to retain per page.

## `maxLinks` (type: `integer`):

Maximum number of relevant public link records to retain per page.

## `maxConcurrency` (type: `integer`):

Maximum number of public page requests running at once. Keep this low for Facebook.

## `minDelayMs` (type: `integer`):

Minimum delay before each public request. Retries use bounded exponential pacing.

## `maxDelayMs` (type: `integer`):

Upper bound for retry pacing; the runtime never waits longer than this configured value between attempts.

## `maxRequestRetries` (type: `integer`):

Number of retries after a network or transport failure. HTTP access blocks are not bypassed or retried.

## `requestTimeoutSecs` (type: `integer`):

Timeout for each public HTML request.

## `maxBytes` (type: `integer`):

Hard response-size limit for each public HTML request.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.facebook.com/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol"
    }
  ],
  "maxItems": 1,
  "includePageText": true,
  "includeMedia": true,
  "includeStructuredData": true,
  "includeLinks": true,
  "maxTextLength": 5000,
  "maxStructuredDataItems": 20,
  "maxLinks": 20,
  "maxConcurrency": 1,
  "minDelayMs": 250,
  "maxDelayMs": 4000,
  "maxRequestRetries": 2,
  "requestTimeoutSecs": 45,
  "maxBytes": 5000000
}
```

# Actor output Schema

## `datasetUrl` (type: `string`):

Dataset items produced by the actor.

## `summary` (type: `string`):

No description

## `dataset` (type: `string`):

Dataset items produced by the Actor.

## `runSummary` (type: `string`):

Run status and counters stored by the Actor.

# 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 = {
    "startUrls": [
        {
            "url": "https://www.facebook.com/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol"
        }
    ],
    "maxItems": 1,
    "includePageText": true,
    "includeMedia": true,
    "includeStructuredData": true,
    "includeLinks": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/facebook-post-metadata-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 = {
    "startUrls": [{ "url": "https://www.facebook.com/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol" }],
    "maxItems": 1,
    "includePageText": True,
    "includeMedia": True,
    "includeStructuredData": True,
    "includeLinks": True,
}

# Run the Actor and wait for it to finish
run = client.actor("w3crawler/facebook-post-metadata-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 '{
  "startUrls": [
    {
      "url": "https://www.facebook.com/NASA/posts/pfbid025kwyoBjhFGUC22fC4Sies56D5xvd65ZHR5PYjHhc7XSzqGsxuWq2uDVriZNxWbeol"
    }
  ],
  "maxItems": 1,
  "includePageText": true,
  "includeMedia": true,
  "includeStructuredData": true,
  "includeLinks": true
}' |
apify call w3crawler/facebook-post-metadata-scraper --silent --output-dataset

```

## MCP server setup

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