# Facebook Ads Library Scraper: Creatives, Collation & Insights (`datablow/facebook-ads-scraper`) Actor

Extract comprehensive ad data from Meta / Facebook Ads Library — ad IDs, collation groups, advertiser details, spend, reach, publisher platforms, high-res images, and video URLs without blocking.

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

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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.

- **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 Ads Library Scraper (Meta Ad Spy & Creative Extractor)

A high-performance, production-ready **Facebook Ads Library Scraper** for the Apify platform. Extract comprehensive ad data, creative assets (high-res images & HD videos), ad archive IDs, collation variations, spend, reach, publisher platforms, and advertiser details without blocking.

***

### 🌟 Key Features

- 🛡️ **Zero-Blocking Stealth Engine**: Uses real Chromium instances with genuine fingerprinting and authentication token exchange. Meta's anti-scraping defenses are naturally bypassed without triggering CAPTCHAs or IP bans.
- 📸 **Complete Creative Media Assets**:
  - Full high-resolution creative images.
  - HD and SD MP4 video URLs with video preview thumbnails.
  - Carousel cards array with individual card headlines, images, and links.
  - Full primary text (ad copy), headlines, link descriptions, and Call-To-Action (CTA) buttons.
- 📊 **Collation & Variations Grouping**:
  - Extracts `collationID` and `collationCount` showing how many variations of an ad are actively being tested.
- 🌐 **Multi-Platform Coverage**:
  - Scrapes platform distribution across **Facebook**, **Instagram**, **Audience Network**, and **Messenger**.
- 🔍 **Dual Search Modes**:
  - **Keyword & Brand Search**: Search by any brand or keyword (e.g., `["nike", "shopify", "saas"]`).
  - **Page ID Search**: Extract every ad published by a specific Facebook Page ID.
- 📈 **Spend, Reach & Compliance Metadata**:
  - Captures spend ranges, estimated audience reach, start/end dates, total active duration, and digital media (AI generated) disclosures.
- 🚀 **Apify Residential Proxy Ready**: Built-in rotation for enterprise-grade scalability.

***

### 📥 Input Configuration

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `searchTerms` | Array | `["nike"]` | Keywords or brand names to search in Meta Ads Library. |
| `pageIds` | Array | `[]` | Optional: Specific Facebook Page IDs to scrape all ads from. |
| `country` | String | `"US"` | Target country code (`US`, `GB`, `DE`, `CA`, `AU`, `IN`, or `ALL`). |
| `activeStatus` | String | `"all"` | Filter ads by status: `all`, `active`, `inactive`. |
| `adType` | String | `"all"` | Ad category: `all`, `political_and_issue_ads`, `housing`, `employment`, `credit`. |
| `mediaType` | String | `"all"` | Filter by format: `all`, `image`, `video`, `meme`, `image_and_meme`. |
| `maxAds` | Integer | `50` | Maximum number of unique ads to scrape. |
| `proxyConfiguration` | Object | `{}` | Apify Proxy configuration (Residential recommended). |

#### Example Input (`INPUT.json`)

```json
{
  "searchTerms": ["nike", "gymshark"],
  "country": "US",
  "activeStatus": "active",
  "adType": "all",
  "mediaType": "all",
  "maxAds": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

***

### 📤 Output Data Format

The Actor pushes structured records to the default Apify Dataset. You can export results to **JSON**, **CSV**, **Excel**, or consume them via the Apify REST API.

#### Sample Output Record

```json
{
  "adId": null,
  "adArchiveID": "1046730950862281",
  "collationID": "3472161186254279",
  "collationCount": 1,
  "pageID": "146705838515566",
  "pageName": "Sukeban World",
  "pageProfilePictureUrl": "https://scontent.xx.fbcdn.net/v/...",
  "pageProfileUri": "https://www.facebook.com/61551864263186/",
  "adSnapshotUrl": "https://www.facebook.com/ads/library/?id=1046730950862281",
  "isActive": true,
  "startDate": 1752044400,
  "startDateFormatted": "2025-07-09T07:00:00.000Z",
  "endDate": null,
  "endDateFormatted": null,
  "totalActiveTime": null,
  "hideDataStatus": "NONE",
  "displayFormat": "VIDEO",
  "primaryText": "SUKEBAN at @animeexpo \n07/05/25 Los Angeles \nSneakers @nike ...",
  "title": null,
  "caption": "instagram.com",
  "linkUrl": "http://instagram.com/sukeban_world",
  "linkDescription": null,
  "ctaText": "Visit Instagram profile",
  "ctaType": "VIEW_INSTAGRAM_PROFILE",
  "creativeImageUrl": "https://scontent.xx.fbcdn.net/v/...",
  "creativeVideoUrl": "https://video.xx.fbcdn.net/o1/v/t2/f2/m86/...",
  "images": [],
  "videos": [
    {
      "video_hd_url": "https://video.xx.fbcdn.net/o1/v/t2/f2/m86/...",
      "video_sd_url": "https://video.xx.fbcdn.net/o1/v/t2/f2/m86/...",
      "video_preview_image_url": "https://scontent.xx.fbcdn.net/v/..."
    }
  ],
  "cards": [],
  "publisherPlatform": ["INSTAGRAM"],
  "targetedOrReachedCountries": [],
  "politicalCountries": [],
  "spend": null,
  "currency": "",
  "reachEstimate": null,
  "impressionsWithIndex": {
    "impressions_text": null,
    "impressions_index": -1
  },
  "containsDigitallyCreatedMedia": false,
  "isAaaEligible": false,
  "aaaInfo": null,
  "isProfilePage": false,
  "gatedType": "ELIGIBLE",
  "categories": ["UNKNOWN"],
  "archiveTypes": [],
  "hasUserReported": false,
  "reportCount": null,
  "stateMediaRunLabel": null,
  "regionalRegulationData": {
    "finserv": { "is_deemed_finserv": false, "is_limited_delivery": false },
    "tw_anti_scam": { "is_limited_delivery": false }
  },
  "menuItems": [],
  "advertiser": {
    "id": "146705838515566",
    "name": "Sukeban World",
    "profileUrl": "https://www.facebook.com/61551864263186/",
    "avatarUrl": "https://scontent.xx.fbcdn.net/v/...",
    "likeCount": 426,
    "categories": ["Sports league"]
  },
  "scrapedAt": "2026-09-12T07:34:00.000Z"
}
```

***

### 🚀 Running on Apify

1. Deploy the Actor using the Apify CLI:
   ```bash
   apify push
   ```
2. Or trigger via Apify API:
   ```bash
   curl --request POST "https://api.apify.com/v2/acts/datablow~facebook-ads-scraper/runs?token=<YOUR_TOKEN>"
   ```

# Actor input Schema

## `searchTerms` (type: `array`):

Keywords or advertiser brand names to search in Facebook Ads Library (e.g. \['nike', 'shopify']).

## `pageIds` (type: `array`):

Optional: Specific Facebook Page IDs to scrape all ads directly from their page library.

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

Optional: Direct Facebook Ads Library URLs.

## `country` (type: `string`):

Target country code (e.g. US, GB, DE, IN, CA, AU) or ALL.

## `activeStatus` (type: `string`):

Filter by ad status.

## `adType` (type: `string`):

Ad category filter.

## `mediaType` (type: `string`):

Filter by media format.

## `maxAds` (type: `integer`):

Maximum number of total unique ads to collect across search queries.

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

Apify Proxy configuration. Residential proxies are recommended for high-volume runs.

## Actor input object example

```json
{
  "searchTerms": [
    "nike"
  ],
  "country": "US",
  "activeStatus": "all",
  "adType": "all",
  "mediaType": "all",
  "maxAds": 50
}
```

# Actor output Schema

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

Default dataset containing the scraped Facebook Ads Library records.

# 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 = {
    "searchTerms": [
        "nike"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datablow/facebook-ads-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 = { "searchTerms": ["nike"] }

# Run the Actor and wait for it to finish
run = client.actor("datablow/facebook-ads-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 '{
  "searchTerms": [
    "nike"
  ]
}' |
apify call datablow/facebook-ads-scraper --silent --output-dataset

```

## MCP server setup

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