# Meta Ad Scraper (`hello.datawizards/facebook-ad-scraper`)

Meta Ad Scraper is an Apify Actor that extracts detailed ad data from the Meta (Facebook) Ad Library, including titles, creatives, CTAs, and advertiser info. Ideal for marketing analytics, ad intelligence, and competitor research with full proxy support and clean JSON output.

- **URL**: https://apify.com/hello.datawizards/facebook-ad-scraper.md
- **Developed by:** [datawizards](https://apify.com/hello.datawizards) (community)
- **Categories:** Agents, Automation, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

# README

***

## 📢 Meta Ad Scraper · Apify Actor

Scrape **Facebook (Meta) Ad Library data** in structured JSON format — including ad titles, images, CTAs, advertiser details, and more.
Perfect for **ad intelligence, market research, brand monitoring, or competitor analysis**.
Built and maintained by [DataWizards](https://linkedin.com/in/data-wizards-aa8080342).

***

### 📌 What Is `Meta Ad Scraper`?

The **Meta Ad Scraper** Apify Actor extracts **live and archived ad data** from the **Facebook Ads Library**, based on specific **search queries and target countries**.

This actor is designed to help you easily gather actionable advertising data — including page details, media assets, CTAs, and ad metadata — all formatted in clean, ready-to-use JSON.

Ideal for marketers, media buyers, analysts, and researchers seeking deep insights into ad campaigns across Meta platforms.

***

### 🧠 Key Features

✅ **Search by Keyword and Country** – Get ads for any brand, keyword, or product.
✅ **High-Quality JSON Output** – Structured ad metadata ready for analysis or dashboards.
✅ **Full Ad Metadata** – Includes page info, CTA, images, videos, text, categories, and more.
✅ **Apify Proxy Integration** – Seamless proxy configuration with residential IPs for reliability.
✅ **Custom Item Limits** – Define how many ads you want per query for optimized scraping.
✅ **Easy Integration** – Plug directly into BI tools, data lakes, or analytics pipelines.
✅ **Automated Ad Intelligence** – Track creative trends and brand advertising patterns efficiently.

***

### 🛠️ Input Schema

Here’s how to use the actor:

```json
{
    "countries": ["vn"],
    "item_limit": 30,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": ["RESIDENTIAL"]
    },
    "queries": ["samsung"]
}
```

#### 🔍 Input Parameters

| Parameter            | Type    | Description                                                |
| -------------------- | ------- | ---------------------------------------------------------- |
| `countries`          | Array   | List of country codes (ISO format) where ads are targeted. |
| `item_limit`         | Integer | Max number of ads to retrieve per query.                   |
| `proxyConfiguration` | Object  | Proxy settings (Apify proxies supported).                  |
| `queries`            | Array   | Keywords or brand names to search for in Meta Ad Library.  |

#### 🔐 Proxy Configuration

- **useApifyProxy**: Set to `true` for smooth operation.
- **apifyProxyGroups**: Recommended – use `"RESIDENTIAL"` for optimal coverage and reduced blocking.

***

### 📤 Output Example

```json
[
  {
    "title": "👉 Tủ sấy siêu sale",
    "page_id": "779396745264983",
    "page_name": "Review Có Tâm",
    "ad_archive_id": "807921918725816",
    "page_profile_uri": "https://www.facebook.com/61582293906645/",
    "page_profile_picture_url": "https://scontent.fcgh39-1.fna.fbcdn.net/...",
    "page_like_count": 1130,
    "body_text": "😍 Tủ sấy quần áo - chân ái cho mùa mưa...",
    "cta_text": "Get promotions",
    "cta_type": "GET_PROMOTIONS",
    "display_format": "IMAGE",
    "page_categories": ["Shopping"],
    "images": ["https://scontent.fcgh39-1.fna.fbcdn.net/..."],
    "videos": [],
    "is_active": true,
    "start_date": 1762243200,
    "end_date": 1762243200,
    "publisher_platform": ["FACEBOOK"],
    "extra_links": []
  }
]
```

#### 🧾 Output Fields Explained

| Field                | Description                                                        |
| -------------------- | ------------------------------------------------------------------ |
| `title`              | The ad’s main headline or promotional text.                        |
| `page_name`          | Name of the advertiser’s page.                                     |
| `page_id`            | Unique Facebook Page ID.                                           |
| `ad_archive_id`      | Unique ad identifier in the Meta Ad Library.                       |
| `body_text`          | The ad’s description or promotional message.                       |
| `cta_text`           | Text of the call-to-action button (e.g., “Shop Now”, “Get Offer”). |
| `images` / `videos`  | URLs of media assets used in the ad.                               |
| `publisher_platform` | Platforms where the ad is shown (Facebook, Instagram, etc.).       |
| `is_active`          | Boolean showing whether the ad is currently active.                |
| `page_categories`    | Category tags related to the advertiser’s business.                |

***

### 🚀 Use Cases

🧭 **Ad Intelligence & Competitive Research**
Monitor and analyze competitors’ ad creatives, messaging, and targeting trends.

📊 **Brand Monitoring**
Track your brand’s ad performance and detect impersonation or misuse.

💼 **Market Research & Trend Analysis**
Identify what’s trending in specific regions, niches, or product categories.

🤖 **Data Aggregation for AI Models**
Feed creative intelligence data into machine learning or AI tools for ad optimization.

📈 **Marketing Dashboards**
Build internal tools or dashboards visualizing ad spend, creatives, and campaign trends.

***

### ✅ Best Practices

- Always use **Apify Residential Proxies** for accuracy and stability.
- Limit item count for faster, lighter runs during testing (`item_limit: 10–30`).
- Schedule runs for regular ad monitoring.
- Combine multiple country codes for broader ad intelligence.
- Store results in Apify datasets or export directly to CSV/JSON for analytics tools.

***

### 🧰 Need Customization?

Want to add new fields, filters, or simplify the output?
**DataWizards** can tailor it to your exact needs!

📧 Email: <hello.datawizard@gmail.com>
✉️ **Subject**: `Meta Ad Scraper – Custom Output Request`
🔗 Connect on LinkedIn: [linkedin.com/in/data-wizards-aa8080342](https://linkedin.com/in/data-wizards-aa8080342)

***

### 💬 Feedback & Support

Found a bug? Need assistance or integration help?
We’re always ready to help you improve your workflow.

📩 **Email:** <hello.datawizard@gmail.com>
✉️ **Subject:** `Bug Report – Meta Ad Scraper Actor`
💼 **LinkedIn:** [DataWizards](https://linkedin.com/in/data-wizards-aa8080342)

> *DataWizards – Your go-to partner for scalable, smart, and reliable data extraction.*

***

#### 🏁 Start collecting powerful Meta Ad insights today — with **Meta Ad Scraper** by DataWizards.

Fast. Scalable. Reliable. 🎯

# Actor input Schema

## `queries` (type: `array`):

A list of URLs of the web pages you want to scrape data from.

## `countries` (type: `array`):

A list of URLs of the web pages you want to scrape data from.

## `item_limit` (type: `integer`):

The maximum number of items to scrape.

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

Specifies proxy servers that will be used by the scraper in order to hide its origin.

## Actor input object example

```json
{
  "queries": [
    "samsung"
  ],
  "countries": [
    "vn"
  ],
  "item_limit": 30,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "queries": [
        "samsung"
    ],
    "countries": [
        "vn"
    ],
    "item_limit": 30,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("hello.datawizards/facebook-ad-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 = {
    "queries": ["samsung"],
    "countries": ["vn"],
    "item_limit": 30,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("hello.datawizards/facebook-ad-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 '{
  "queries": [
    "samsung"
  ],
  "countries": [
    "vn"
  ],
  "item_limit": 30,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call hello.datawizards/facebook-ad-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Meta Ad Scraper",
        "description": "Meta Ad Scraper is an Apify Actor that extracts detailed ad data from the Meta (Facebook) Ad Library, including titles, creatives, CTAs, and advertiser info. Ideal for marketing analytics, ad intelligence, and competitor research with full proxy support and clean JSON output.",
        "version": "0.0",
        "x-build-id": "ILPVAhvggvcy1pMEv"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/hello.datawizards~facebook-ad-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-hello.datawizards-facebook-ad-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/hello.datawizards~facebook-ad-scraper/runs": {
            "post": {
                "operationId": "runs-sync-hello.datawizards-facebook-ad-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/hello.datawizards~facebook-ad-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-hello.datawizards-facebook-ad-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "queries"
                ],
                "properties": {
                    "queries": {
                        "title": "List of Facebook Ad Search Queries",
                        "type": "array",
                        "description": "A list of URLs of the web pages you want to scrape data from.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "countries": {
                        "title": "List of Facebook Ad Search Country Codes",
                        "type": "array",
                        "description": "A list of URLs of the web pages you want to scrape data from.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "item_limit": {
                        "title": "Max_limit",
                        "type": "integer",
                        "description": "The maximum number of items to scrape.",
                        "default": 30
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Specifies proxy servers that will be used by the scraper in order to hide its origin.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
