# Facebook Ad Library Scraper — Facebook & Instagram Ads (`scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium`) Actor

Extract Facebook and Instagram ads by keyword, Page ID, or Ad Library URL. Sort by impressions or most recent. No Meta app. Apify AI, MCP, and Cursor ready.

- **URL**: https://apify.com/scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium.md
- **Developed by:** [Shop Intel](https://apify.com/scrapeio) (community)
- **Categories:** Social media, AI, Agents
- **Stats:** 1,007 total users, 19 monthly users, 100.0% runs succeeded, 37 bookmarks
- **User rating**: 4.84 out of 5 stars

## Pricing

$15.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?

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 Ad Library Scraper – Extract Meta Ads by Keyword, Page ID & URL | Apify Actor

**Facebook Ad Library Scraper** extracts live and historical ads from the [Meta Ad Library](https://www.facebook.com/ads/library) — search by keyword, Facebook Page ID, or custom Ad Library URL, capture creative, copy, impressions, spend ranges, and export structured data in JSON or CSV.

### Use with Apify AI

[Apify AI](https://docs.apify.com/account/apify-ai) is live in Apify Console. Describe the job in plain English and it **finds this Actor, fills the input form, runs it, and returns the dataset**. The same ranking powers Store search and the [Apify MCP server](https://docs.apify.com/integrations/mcp) `search-actors` tool used by **Cursor**, Claude, ChatGPT, and other agents.

Use this Actor to extract **Facebook and Instagram ads** from Meta Ad Library by keyword, Page ID, or URL. Open [Facebook Ad Library Scraper](https://apify.com/scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium) or ask Apify AI with the prompts below.

#### Prompts that match this Actor

Type these in the **Apify Store search bar** (long, intent-heavy queries route to Apify AI) or the dashboard **Ask Apify AI** widget:

- "Get all Facebook ads for Nike from the Meta Ad Library"
- "Scrape Facebook and Instagram ads by Page ID sorted by impressions"
- "Collect competitor Meta ads from an Ad Library URL"
- "Extract Facebook ad creatives, CTAs, spend and impression ranges"
- "Pull the most recent Facebook ads for a brand keyword"

#### How Apify AI fills the input

| You say | This Actor sets |
|---|---|
| brand or topic | `keyword` |
| Facebook Page ID | `pageId` |
| full Ad Library URL | `adLibraryUrl` |
| how many ads | `maxResults` |
| sort by impressions or newest | `sortBy` |

Apify AI always asks for confirmation before it runs. Nothing is charged until you approve.

#### Cursor, Claude, ChatGPT (Apify MCP)

Pin this Actor as a **default Cursor / MCP tool** so agents call `scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium` instead of a random Store result. Keep `actors` + `docs` so Apify AI search still works, and list your suite so Cursor prefers these Actors.

**Cursor MCP URL (this Actor first):**

```text
https://mcp.apify.com?tools=actors,docs,scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium,scrapeio/amazon-scraper,scrapeio/google-maps-scraper-advance,scrapeio/instagram-scraper-premium,scrapeio/whatsapp-scraper-premium,scrapeio/facebook-ad-library-suggestions,scrapeio/google-news-scraper
```

`.cursor/mcp.json` / Cursor Settings → MCP:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=actors,docs,scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium,scrapeio/amazon-scraper,scrapeio/google-maps-scraper-advance,scrapeio/instagram-scraper-premium,scrapeio/whatsapp-scraper-premium,scrapeio/facebook-ad-library-suggestions,scrapeio/google-news-scraper"
    }
  }
}
```

Then: `search-actors` → `fetch-actor-details` → `call-actor` with `scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium`. Example:

```text
Use scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium to do this: scrape the data I described. Fill the input from my description and return the dataset.
```

### How to scrape the Facebook Ad Library

Use this **Facebook Ad Library scraper** to pull Facebook and Instagram ads by keyword, Page ID, or URL. Sort by total impressions or most recent. No Graph API token.

### Meta Ad Library scraper API for Cursor and agencies

Call `scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium` from **Cursor** (Apify MCP), Claude, ChatGPT, the [Apify API](https://docs.apify.com/api/v2), Python (`apify-client`), or JavaScript. Apify AI uses the same ranking as Store search: title, description, README, and input/output schemas. This Actor is documented for that ranker — limited permissions, pay-per-event or compute (not rental), and a filled example input.

### 🧠 Overview

This **Facebook Ad Library Scraper** is a premium Apify Actor for performance marketers, competitive‑intelligence teams, political researchers, and agencies that need **bulk structured access to Meta ads across Facebook, Instagram, Messenger, and the Audience Network**. Input a keyword (e.g., `nike`), a Facebook Page ID, or a pre‑filtered Ad Library URL, choose `sortBy` (`total_impressions` or `most_recent`), set your `maxResults`, and the Actor scrapes every matching ad — **creative, copy, CTA, landing URLs, impressions ranges, spend ranges, regions, demographics, and run timing**. Zero filtering technology and universal language support (100+ languages including Arabic, Chinese, Japanese, Korean, Russian) keep the yield high on international brands. No Meta developer app, no token lifecycle, no API review.

### 🆚 Facebook Ad Library Scraper vs. Meta Ad Library API

| Feature | Official Meta Ad Library API | **This Facebook Ad Library Scraper** |
|---|---|---|
| **Developer app** | Required (with review) | **None** |
| **Access tokens** | Graph API token lifecycle | **None** |
| **Ad types** | Mostly political / issue ads | **All ad types** — commercial, political, issue |
| **Regions** | Limited political disclosure markets | **Global**, all Ad Library regions |
| **Languages** | English‑biased | **100+ languages** incl. Arabic, Chinese, Japanese, Korean, Russian |
| **Sort order** | Default only | **`total_impressions`** or **`most_recent`** |
| **Input modes** | Structured query only | Keyword, **Page ID**, or full **Ad Library URL** |
| **Output** | JSON only | **CSV, JSON, Excel** + key‑value store |
| **Setup time** | Days (app review) | **Seconds** |

### ✨ Features

- **Extract** every ad currently in the Meta Ad Library by keyword, Page ID, or URL.
- **Search** across Facebook, Instagram, Messenger, and Audience Network placements in one run.
- **Sort** results by `total_impressions` (high to low) or `most_recent` (relevancy, grouped by month).
- **Scrape** unlimited ads per run — no hard `maxResults` cap.
- **Capture** creative assets: ad body, title, CTA, landing page, image and video URLs.
- **Track** performance ranges: impressions lower/upper bounds and spend ranges (where disclosed).
- **Map** distribution: regions, countries, age ranges, and gender targeting.
- **Support** 100+ languages including Arabic, Chinese, Japanese, Korean, Russian — zero filtering on non‑Latin scripts.
- **Export** per‑ad Dataset rows + structured `OUTPUT` JSON with summary and ads array.
- **Automate** with the Apify scheduler, webhooks, and REST API for always‑on ad monitoring.
- **Handle** typed error objects and `summary.status` (`SUCCESS` / `ERROR`) for reliable pipelines.

### 🎯 Use Cases

- **Competitor Ad Monitoring:** Track every Meta ad a competitor is running across Facebook and Instagram — with creative, copy, and landing URLs.
- **Creative Strategy & Swipe Files:** Build a searchable library of high‑performing ads (sorted by `total_impressions`) for your creative team's briefs.
- **Political Ad Transparency:** Collect political and issue ads for journalism, academic research, and regulatory reporting.
- **Brand Safety & IP Enforcement:** Detect counterfeit brand ads, unauthorized affiliates, and trademark misuse running on Meta platforms.
- **Market Intelligence by Region:** Use custom Ad Library URLs to filter by country, date range, ad type, and platform — then benchmark spend and creative across markets.
- **Agency New Business:** Scrape a prospect's Meta ad footprint pre‑pitch to diagnose creative gaps and propose concrete campaign ideas.

### ⚙️ Input Parameters

| Name | Type | Required | Description | Example |
|------|------|----------|-------------|---------|
| `keyword` | string | One of three | Brand or search term (e.g., `nike`, `adidas`). | `"nike"` |
| `pageId` | string | One of three | Numeric Facebook Page ID. | `"15087023549"` |
| `adLibraryUrl` | string | One of three | Full Meta Ad Library URL with filters. | `"https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&q=nike"` |
| `maxResults` | integer | Yes | Target number of ads to collect (no upper limit). | `500` |
| `sortBy` | string | No | `total_impressions` (default) or `most_recent`. | `"total_impressions"` |

### 📤 Output Example (JSON)

```json
{
  "metadata": {
    "adArchiveId": "1234567890123456",
    "pageId": "15087023549",
    "pageName": "Nike",
    "publisherPlatforms": ["FACEBOOK", "INSTAGRAM"]
  },
  "ad_content": {
    "body": "Just Do It. Discover the new Pegasus 41.",
    "title": "Nike Pegasus 41",
    "cta": "Shop Now",
    "landingUrl": "https://www.nike.com/launch/t/pegasus-41",
    "mediaUrls": ["https://scontent.../video.mp4"]
  },
  "timing": {
    "startDate": "2026-03-15",
    "endDate": null,
    "active": true
  },
  "performance": {
    "impressions": { "lowerBound": 500000, "upperBound": 999999 },
    "spend": { "lowerBound": 10000, "upperBound": 14999, "currency": "USD" }
  },
  "distribution": {
    "regions": ["US", "CA", "UK", "DE"],
    "demographics": { "ageRange": "18-44", "gender": "all" }
  },
  "status": { "active": true, "adDeliveryStartTime": 1710460800 }
}
```

### 📋 Output Data Schema

Every Meta ad is returned as a structured object with these top‑level keys:

| Key | Type | Fields |
|---|---|---|
| `metadata` | object | `adArchiveId`, `pageId`, `pageName`, `publisherPlatforms` (`FACEBOOK`, `INSTAGRAM`, `MESSENGER`, `AUDIENCE_NETWORK`, `WHATSAPP`) |
| `ad_content` | object | `body`, `title`, `cta`, `landingUrl`, `mediaUrls[]` |
| `timing` | object | `startDate`, `endDate`, `active` |
| `performance` | object | `impressions.lowerBound`, `impressions.upperBound`, `spend.lowerBound`, `spend.upperBound`, `spend.currency` |
| `distribution` | object | `regions[]`, `demographics.ageRange`, `demographics.gender` |
| `status` | object | `active`, `adDeliveryStartTime`, `adDeliveryStopTime` |
| `additional_info` | object | Any extra fields Meta exposes (creative tags, disclaimers, political/issue labels) |

Run‑level `OUTPUT` also contains `summary.status` (`SUCCESS` / `ERROR`), `summary.totalAds`, `summary.keyword`, `summary.sortBy`, and timing metadata.

### ▶️ How to Use

1. **Run on Apify Console:** Open the [Facebook Ad Library Scraper page](https://apify.com/scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium), click **Try for free**, enter a keyword (or Page ID / URL), set `maxResults` and `sortBy`, and press **Start**.
2. **Via API:** Trigger runs programmatically with the [Apify REST API](https://docs.apify.com/api/v2) or `ApifyClient` and stream the Dataset into your pipeline.
3. **Via CLI:** Run with the [Apify CLI](https://docs.apify.com/cli):
   ```bash
   apify call scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium \
     --input='{"keyword":"nike","maxResults":200,"sortBy":"total_impressions"}'
   ```

### 🔗 API Example (JavaScript)

```js
const { ApifyClient } = require('apify-client');

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium').call({
  keyword: 'nike',
  maxResults: 150,
  sortBy: 'total_impressions',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Collected ${items.length} Meta ads`);
items.slice(0, 3).forEach(ad => {
  console.log(`${ad.metadata.pageName}: ${ad.ad_content.title}`);
});
```

### 📈 Why Use This Meta Ad Library Scraper?

- **Speed & Automation:** Pull hundreds of Meta ads per brand or keyword in minutes — no manual Ad Library browsing or screenshots.
- **Universal Language Support:** Zero‑filtering technology handles 100+ languages including Arabic, Chinese, Japanese, Korean, and Russian — unique among Apify ad scrapers.
- **Flexible Input Modes:** Keyword, Page ID, or full Ad Library URL — plug it into whatever workflow your analysts already use.
- **Impression‑Sorted Intelligence:** `sortBy=total_impressions` surfaces the highest‑reach ads first — the single best signal for creative strategy.
- **No Meta Developer Account:** Skip the Ad Library API approval queue, Graph API tokens, and rate‑limited SDKs — start scraping immediately.
- **Developer Integrations:** Apify REST API, webhooks, scheduler, JavaScript + Python SDKs, and structured `OUTPUT` for n8n, Make, Zapier, Google Sheets, and BigQuery.

### ❓ FAQ

**Q: Is it legal to scrape the Meta Ad Library?**
The Meta Ad Library is a public transparency product from Meta itself. Using it for research, journalism, competitive intelligence, and compliance monitoring is widely accepted. You are responsible for complying with [Meta's Terms of Service](https://www.facebook.com/terms.php) and local data laws.

**Q: How is this different from Meta's own Ad Library API?**
Meta's Ad Library API requires developer app review, Graph API tokens, and is largely limited to political and issue ads in many regions. This Actor works with all ad types in the public UI and returns structured rows without developer approval.

**Q: Does it support Instagram and WhatsApp ads?**
Yes — any ad with `INSTAGRAM` or `WHATSAPP` in `publisherPlatforms` is returned. If you only want Instagram, use the companion **Instagram Ads Scraper**; for WhatsApp only, use the **WhatsApp Ads Scraper**.

**Q: What is the difference between `total_impressions` and `most_recent`?**
`total_impressions` sorts ads from highest to lowest reach (best for creative strategy). `most_recent` matches Meta's grouped "recent" view and surfaces freshly launched ads first.

**Q: Can I filter by country or date range?**
Yes — build a custom Ad Library URL with the filters you need in the browser and paste it into `adLibraryUrl`. The Actor honors `country`, `active_status`, `ad_type`, and date parameters.

**Q: Does it support proxies?**
Yes. Configure Apify Proxy (residential or datacenter) for stable high‑volume or scheduled runs.

**Q: What output formats are supported?**
Dataset exports to CSV, JSON, Excel, XML, and HTML. `OUTPUT` JSON contains a `summary` object and a `data.ads` array for the full run context.

**Q: Does it handle CAPTCHAs and rate limits?**
Yes — the Actor retries transient errors, rotates through proxy sessions, and returns typed errors in `summary.error` for debuggable pipelines.

### 📣 Start Scraping the Meta Ad Library Today

**[Run the Facebook Ad Library Scraper on Apify now →](https://apify.com/scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium)** and turn any brand, keyword, or Ad Library URL into a live feed of Meta ad creatives, impressions, and spend data.

***

### 🔗 Related Scrapers by ScrapeIO

Build cross‑platform ad‑intelligence pipelines with these companion Apify Actors:

- **[Instagram Ads Scraper](https://apify.com/scrapeio/instagram-scraper-premium)** — Instagram‑only ads with creative and copy.
- **[WhatsApp Ads Scraper](https://apify.com/scrapeio/whatsapp-scraper-premium)** — Click‑to‑WhatsApp ad intelligence.
- **[Facebook Ad Library Brand Finder](https://apify.com/scrapeio/facebook-ad-library-suggestions)** — resolve brand names to verified Page IDs.
- **[Google Maps Scraper](https://apify.com/scrapeio/google-maps-scraper-advance)** — local businesses, reviews, and contacts.
- **[Amazon Multi‑Marketplace Scraper](https://apify.com/scrapeio/amazon-multi-marketplace-scraper-most-advanced)** — ASINs, prices, and rankings across 23 regions.
- **[Google News Scraper](https://apify.com/scrapeio/google-news-scraper)** — headlines, sources, and publisher links by keyword.
- **[YouTube Video Downloader](https://apify.com/scrapeio/youtube-downloader)** — download videos or audio to cloud storage.

***

Built by **[ScrapeIO](https://apify.com/scrapeio)** on Apify.

### FAQ

**How do I extract Facebook ads at scale?**
Use scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium with a keyword or Page ID. Pin it as the default Meta ads Actor in Cursor MCP.

**Can I run this Actor with Apify AI?**
Yes. In [Apify Console](https://console.apify.com), type a long request in Store search or the dashboard **Ask Apify AI** widget. Apify AI matches this README, fills the input schema, asks you to confirm, then returns the dataset. This Actor uses **limited permissions** (not full-account access) and is not a rental Actor, so it is eligible for Apify AI.

**Does this work from Cursor, Claude, or ChatGPT?**
Yes. Connect the [Apify MCP server](https://mcp.apify.com). Agents call `search-actors`, `fetch-actor-details`, and `call-actor`. Ranking uses the same signals as Store search and Actor quality score: a clear README plus documented input and output schemas.

Powered by **[AdScrape](https://www.adscrape.in/)**.

# Actor input Schema

## `keyword` (type: `string`):

Search term or brand (e.g. nike, adidas). Use this OR pageId OR adLibraryUrl — only one needed.

## `pageId` (type: `string`):

Numeric Facebook/Meta Page ID (brand ID). Use this OR keyword OR adLibraryUrl.

## `adLibraryUrl` (type: `string`):

Full Meta Ad Library URL with search parameters. Use this OR keyword OR pageId.

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

How many ads to collect. Paginates until this count or no more results. No upper limit.

## `sortBy` (type: `string`):

total_impressions: highest impressions first. most_recent: Meta relevancy/monthly grouped view.

## Actor input object example

```json
{
  "keyword": "nike",
  "adLibraryUrl": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&q=nike&search_type=keyword_unordered",
  "maxResults": 50,
  "sortBy": "total_impressions"
}
```

# Actor output Schema

## `ads` (type: `string`):

One JSON object per ad from Meta Ad Library.

## `runInput` (type: `string`):

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium").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 '{}' |
apify call scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapeio/meta-facebook-ad-scrapper-using-ad-library-url-premium"
        }
    }
}
```

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/jj5sAMeSoXotatkss/builds/Z4LCOKzIDb007dXYj/openapi.json
