# Facebook Ads Library Scraper — Ad Intelligence (`muhammadafzal/facebook-ads-library-scraper`) Actor

Scrape Facebook Ads Library creatives, advertisers, copy, media, landing pages, dates, and targeting signals for competitor and campaign research.

- **URL**: https://apify.com/muhammadafzal/facebook-ads-library-scraper.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 ad scrapeds

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/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.

- **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 — Ad Intelligence

Scrape ads from the **Meta/Facebook Ads Library** by keyword, advertiser Page URL, or pre-configured Ad Library URL. Get ad copy, creatives, CTA, spend estimates, reach data, running days, **winner scores**, and EU transparency data — all in clean, flat, structured JSON.

No login required. No Meta API token needed.

### Features

- **3 input modes**: Search by keyword, advertiser Page URL, or paste an Ad Library URL with filters
- **Ad intelligence signals**: Winner score (0-100), winner tier, winner signals, CTA detection, ad categorization, running days
- **EU transparency data**: Spend ranges, impression ranges, EU total reach, demographic distribution (age/gender breakdown)
- **Full creative extraction**: Images, videos (HD/SD/preview), carousel cards, CTA text/type/URL
- **Advertiser metadata**: Page name, ID, URL, profile picture, like count, verification status, page category
- **Flat, clean output**: No nested API dumps — every field is at the top level, ready for spreadsheets, databases, and AI pipelines
- **52 countries supported**: Or search all countries at once
- **No login**: Works entirely from the public Ad Library

### Use Cases

- **Competitor ad research**: Monitor rival brands' ad creatives, copy, and strategies
- **Dropshipping & product research**: Find winning ads by winner score and running duration
- **Agency reporting**: Bulk-collect active ads for clients across countries and platforms
- **Political ad monitoring**: Collect DSA/transparency data (spend ranges, reach, demographics) for regulatory analysis
- **Creative benchmarking**: Compare CTAs, formats, and copy angles across competitors
- **Market research**: Track seasonal spend shifts and creative strategy changes

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `searchTerms` | string\[] | No\* | `["nike"]` | Keywords to search (e.g. "skincare", "crypto trading") |
| `pageUrls` | string\[] | No\* | `[]` | Facebook Page URLs or numeric page IDs |
| `adLibraryUrls` | string\[] | No\* | `[]` | Full Ad Library URLs with filters pre-configured |
| `country` | string | No | `ALL` | Country code or `ALL` for worldwide |
| `adActiveStatus` | string | No | `ALL` | `ACTIVE`, `INACTIVE`, or `ALL` |
| `adType` | string | No | `ALL` | `ALL`, `POLITICAL_AND_ISSUE_ADS`, `HOUSING_ADS`, `EMPLOYMENT_ADS`, `CREDIT_ADS` |
| `mediaType` | string | No | `ALL` | `ALL`, `IMAGE`, `VIDEO`, `MEME`, `NONE` |
| `maxResults` | integer | No | `100` | Maximum ads to collect across all sources |
| `proxyConfiguration` | object | No | Residential | Proxy settings (residential recommended for deep pagination) |

\*At least one of `searchTerms`, `pageUrls`, or `adLibraryUrls` must be provided.

### Output

Each ad is returned as a flat JSON record:

| Field | Type | Description |
|-------|------|-------------|
| `adId` | string | Meta Ad Library archive ID |
| `pageName` | string|null | Advertiser page name |
| `pageId` | string | Advertiser page ID |
| `pageUrl` | string|null | Facebook Page URL |
| `pageLikeCount` | number|null | Page like count |
| `pageVerified` | boolean|null | Page verification status |
| `adText` | string|null | Ad body copy |
| `headline` | string|null | Ad headline |
| `ctaText` | string|null | CTA button text |
| `ctaType` | string|null | CTA type code |
| `ctaUrl` | string|null | Landing page URL |
| `displayFormat` | string | image, video, carousel, or unknown |
| `mediaType` | string | image, video, or meme |
| `imageUrls` | string\[] | Direct CDN image URLs |
| `videoUrls` | object\[] | Video objects with hd, sd, preview URLs |
| `carouselCards` | object\[] | Carousel card data |
| `platforms` | string\[] | Platforms (facebook, instagram, etc.) |
| `isActive` | boolean | Currently running? |
| `startDate` | string|null | Start date (YYYY-MM-DD) |
| `endDate` | string|null | End date (YYYY-MM-DD) |
| `daysRunning` | number|null | Days the ad has been running |
| `winnerScore` | number | 0-100 score (longer running + active + more variants = higher) |
| `winnerTier` | string | high (>=70), medium (>=40), low (<40) |
| `winnerSignals` | string\[] | Signals: long\_running, still\_active, high\_variants, etc. |
| `detectedCtas` | string\[] | CTA phrases detected in ad text |
| `hashtags` | string\[] | Hashtags in ad text |
| `emojiCount` | number | Emoji count in ad text |
| `wordCount` | number | Word count of ad body |
| `adCategory` | string | Auto-detected: ecommerce, lead\_gen, app\_install, etc. |
| `spend` | object|null | EU spend range: {lower, upper} |
| `impressions` | object|null | EU impression range: {lower, upper} |
| `euTotalReach` | number|null | Total EU reach estimate |
| `demographicDistribution` | array|null | Age/gender breakdown |
| `containsAiMedia` | boolean | AI-generated content flag |
| `scrapedAt` | string | ISO 8601 scrape timestamp |
| `sourceUrl` | string | Source Ad Library URL |

### Winner Score

The winner score helps identify proven, high-performing ads:

| Score | Tier | Meaning |
|-------|------|---------|
| 70-100 | **high** | Long-running, active, with multiple creative variants — likely a winner |
| 40-69 | **medium** | Established ad with some signals of success |
| 0-39 | **low** | New or inactive ad — unproven |

Signals: `long_running` (60+ days), `still_active`, `high_variants` (3+ carousel cards), `multiple_variants`, `proven_active` (30+ days AND active).

### Pricing

This actor uses **Pay-Per-Event** pricing:

| Event | Price | Description |
|-------|-------|-------------|
| Actor Start | $0.00005 | Charged when the actor starts (1 event per GB memory) |
| Ad Scraped | $0.001 | Charged per ad extracted to the dataset |

**Example costs:**

- 100 ads = $0.10
- 1,000 ads = $1.00
- 10,000 ads = $10.00

Platform usage costs (compute + proxy) are paid by the user, not subtracted from the actor owner's revenue.

### Proxy Requirements

The actor defaults to **Apify residential proxies** (`RESIDENTIAL` group), which are required for:

- Scraping more than ~30 ads per search (Facebook rate-limits pagination per IP)
- Accessing country-specific Ad Library content

For heavy bulk scraping, consider providing your own premium residential proxy via the `proxyConfiguration` field.

### Limitations

- The Meta Ad Library is a dynamic SPA — occasional rate limiting may reduce result counts
- EU transparency data (spend, reach, demographics) is only available for ads targeting EU/UK markets
- Instagram follower counts and page "About" data require visiting individual pages (not included in base scraping for speed)
- The Ad Library may not show ads from pages that have been deleted or restricted

### Example Input

```json
{
    "searchTerms": ["running shoes", "fitness app"],
    "country": "US",
    "adActiveStatus": "ACTIVE",
    "mediaType": "VIDEO",
    "maxResults": 200
}
```

```json
{
    "pageUrls": ["https://www.facebook.com/nike"],
    "country": "ALL",
    "adActiveStatus": "ALL",
    "maxResults": 500
}
```

### Export scraped data

Export scraped data, run the scraper via API, schedule and monitor runs, or integrate with other tools.

```bash
## Run via Apify CLI
apify run USERNAME/facebook-ads-library-scraper --input='{"searchTerms":["nike"],"maxResults":50}'

## Get results
apify dataset get-default --format=json
```

### What is Facebook Ads Library Scraper?

**Facebook Ads Library Scraper** turns the target data into structured, reusable results on Apify. Use it when you need repeatable collection for analysts, developers, agencies, researchers, and AI-agent workflows without maintaining a custom scraper or one-off integration. Run it manually, schedule recurring jobs, call it through the Apify API, or connect it to an AI agent through the Apify MCP server.

The Actor stores results in an Apify dataset, where they can be previewed and exported as JSON, CSV, Excel, XML, or RSS. Availability and completeness depend on the source, supplied inputs, public visibility, authentication requirements, and upstream rate limits.

### Use cases for Facebook Ads Library Scraper

- Build structured datasets for research, reporting, enrichment, or monitoring.
- Automate repetitive collection with schedules, webhooks, and API calls.
- Feed clean records into spreadsheets, databases, CRMs, BI tools, AI agents, or RAG pipelines.
- Track changes over time by running the same validated input on a schedule.
- Replace fragile manual copy-and-paste work with a reproducible Apify workflow.

### How to use Facebook Ads Library Scraper

1. Open the Actor input page and choose a focused, valid target.
2. Set a conservative result limit for the first run.
3. Start the Actor and inspect the dataset for coverage and field availability.
4. Export the results or connect the dataset to your downstream system.
5. Scale gradually and use scheduling, pagination, or proxies when supported.

#### Important input options

- `searchTerms` — Keywords to search for in the Ad Library (e.g. 'nike', 'running shoes', 'crypto trading'). Each keyword runs as a separate search. Use this when the user provides a topic, niche, or product
- `pageUrls` — Facebook Page URLs (e.g. https://www.facebook.com/nike) or numeric page IDs. Returns every public ad run by that advertiser. Use this when the user provides a specific brand's Facebook page.
- `adLibraryUrls` — Paste full Meta Ad Library URLs (https://www.facebook.com/ads/library/?...) with filters already configured in the URL. Useful when you've set up a search in the Ad Library UI and want to sc
- `country` — Country whose Ad Library to query. Use 'ALL' to search every country at once. Applied to search terms and page URLs. Ad Library URLs use whatever country is encoded in the URL.
- `adActiveStatus` — Filter by whether ads are currently running. 'ACTIVE' = still being delivered, 'INACTIVE' = stopped, 'ALL' = both.
- `adType` — Meta groups ads into transparency categories. 'ALL' covers every public ad. Political, Housing, Employment, and Credit ads have additional spend/reach disclosures.
- `mediaType` — Restrict results by creative format. 'ALL' includes every format.
- `maxResults` — Maximum number of ads to collect across all sources combined. Set to 0 or leave high for unlimited. Each ad is billed at the 'result-item' rate.

### API and automation example

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('muhammadafzal/facebook-ads-library-scraper').call({
  // Add the same input fields you use in the Apify Console.
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Related Apify Actors

Use these dedicated tools when a neighboring data source or workflow is a better match:

- [Instagram Followers & Following Scraper — With Cookies](https://apify.com/muhammadafzal/instagram-following-scraper)
- [Lawyer & Attorney Lead Scraper — Verified Emails](https://apify.com/muhammadafzal/lawyer-lead-scraper)
- [Leads Finder Pro - B2B Leads with Emails \[Apollo Alternative\]](https://apify.com/muhammadafzal/leads-finder-pro)
- [Yellow Pages US Scraper — Business Leads & Reviews](https://apify.com/muhammadafzal/yellow-pages-us-scraper)
- [Justia Lawyer Directory Scraper — Attorney Leads](https://apify.com/muhammadafzal/justia-lawyer-directory-scraper)
- [Yellow Pages Australia Scraper — Business Leads & Reviews](https://apify.com/muhammadafzal/yellow-pages-au-scraper)
- [OpenTable Restaurants, Ratings & Reviews Scraper](https://apify.com/muhammadafzal/opentable-scraper)
- [Etsy Scraper Pro — Products, Prices, Reviews & Shop Data](https://apify.com/muhammadafzal/etsy-scraper-pro)
- [YouTube Thumbnail Downloader](https://apify.com/muhammadafzal/youtube-thumbnail-downloader)
- [Email Validator — Syntax, MX & Risk Checks](https://apify.com/muhammadafzal/email-address-validator)

### Frequently asked questions

#### How many results can I scrape with Facebook Ads Library Scraper?

The practical total depends on the source, input limits, pagination, available records, run timeout, and upstream restrictions. Start with a small run, verify the output, and increase the limit gradually.

#### Can I integrate Facebook Ads Library Scraper with other apps?

Yes. Use Apify integrations, webhooks, schedules, dataset exports, Make, Zapier, Google Sheets, cloud storage, or your own application.

#### Can I use Facebook Ads Library Scraper with the Apify API?

Yes. Start runs with the Apify REST API or an official Apify client, then retrieve records from the run's default dataset. Keep your API token in a secret or environment variable.

#### Can I use Facebook Ads Library Scraper through an MCP Server?

Yes. The Apify MCP server can expose the Actor to compatible AI clients and agents. Review the input and expected cost before allowing an autonomous workflow to run it at scale.

#### Do I need proxies?

It depends on the source and volume. Use the default configuration first. For larger or geographically sensitive jobs, select an appropriate proxy configuration only when the Actor supports it.

#### Is it legal to scrape this data?

Scraping rules vary by source, jurisdiction, data type, and intended use. Collect only data you are authorized to access, respect applicable terms and privacy laws, and avoid restricted or personal data misuse. This documentation is not legal advice.

#### Your feedback

If a field is missing, a source layout has changed, or you need a supported use case documented, open an issue on the Actor page with a reproducible input and run ID.

# Actor input Schema

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

Keywords to search for in the Ad Library (e.g. 'nike', 'running shoes', 'crypto trading'). Each keyword runs as a separate search. Use this when the user provides a topic, niche, or product name to find ads for. Use pageUrls instead when the user provides a specific Facebook Page URL.

## `pageUrls` (type: `array`):

Facebook Page URLs (e.g. https://www.facebook.com/nike) or numeric page IDs. Returns every public ad run by that advertiser. Use this when the user provides a specific brand's Facebook page. Use searchTerms instead when the user wants to search by keyword/topic.

## `adLibraryUrls` (type: `array`):

Paste full Meta Ad Library URLs (https://www.facebook.com/ads/library/?...) with filters already configured in the URL. Useful when you've set up a search in the Ad Library UI and want to scrape it. Filters encoded in the URL are preserved.

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

Country whose Ad Library to query. Use 'ALL' to search every country at once. Applied to search terms and page URLs. Ad Library URLs use whatever country is encoded in the URL.

## `adActiveStatus` (type: `string`):

Filter by whether ads are currently running. 'ACTIVE' = still being delivered, 'INACTIVE' = stopped, 'ALL' = both.

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

Meta groups ads into transparency categories. 'ALL' covers every public ad. Political, Housing, Employment, and Credit ads have additional spend/reach disclosures.

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

Restrict results by creative format. 'ALL' includes every format.

## `maxResults` (type: `integer`):

Maximum number of ads to collect across all sources combined. Set to 0 or leave high for unlimited. Each ad is billed at the 'result-item' rate.

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

Proxy settings for the scraper. Defaults to Apify residential proxies. If Facebook blocks Apify's shared proxies (403 errors), provide your own premium residential proxy URL (e.g. from Decodo, Bright Data, or IPRoyal) via the proxyConfiguration custom URL field. This is required for reliable scraping — Facebook aggressively blocks shared datacenter and residential proxy pools.

## Actor input object example

```json
{
  "searchTerms": [
    "nike"
  ],
  "country": "ALL",
  "adActiveStatus": "ALL",
  "adType": "ALL",
  "mediaType": "ALL",
  "maxResults": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Link to the dataset containing all extracted ad 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"
    ],
    "country": "ALL",
    "adActiveStatus": "ALL",
    "adType": "ALL",
    "mediaType": "ALL",
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadafzal/facebook-ads-library-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"],
    "country": "ALL",
    "adActiveStatus": "ALL",
    "adType": "ALL",
    "mediaType": "ALL",
    "maxResults": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("muhammadafzal/facebook-ads-library-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 '{
  "searchTerms": [
    "nike"
  ],
  "country": "ALL",
  "adActiveStatus": "ALL",
  "adType": "ALL",
  "mediaType": "ALL",
  "maxResults": 100
}' |
apify call muhammadafzal/facebook-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/mhpQeUJkVe584dlqz/builds/saqf8Orn6EQacUXtV/openapi.json
