Meta Ad Library Scraper avatar

Meta Ad Library Scraper

Pricing

from $4.99 / 1,000 results

Go to Apify Store
Meta Ad Library Scraper

Meta Ad Library Scraper

A robust, high-performance utility designed for developer automation, data integration, and AI training. Features built-in captcha bypass, headful/headless browser execution, and proxy support to scrape Meta Ad Library data seamlessly, reliably, and at scale.

Pricing

from $4.99 / 1,000 results

Rating

0.0

(0)

Developer

Coding Frontned

Coding Frontned

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 months ago

Last modified

Share

Apify actor to scrape Facebook and Instagram ad creatives from the Meta Ad Library.

Important: The Meta Ad Library requires residential proxies to access reliably. Configure proxyConfiguration with useApifyProxy: true and apifyProxyGroups: ["RESIDENTIAL"]. Without residential proxies the scraper will encounter 403 errors or login walls.

Features

  • Search the Meta Ad Library by keyword or brand name
  • Filter by country/region, ad type (political/commercial), and platform
  • Extract ad text, page name, status, start date, media URL, and impressions
  • Supports Facebook, Instagram, Audience Network, and Messenger platforms
  • Automatic scrolling and "See more" handling to load additional results
  • Proxy support for reliable scraping

Input

FieldTypeDefaultDescription
querystring"Nike"Search term to look for in the Meta Ad Library
countrystring"US"ISO 3166-1 alpha-2 country code
maxItemsinteger50Maximum number of ads to scrape (1–5000)
adTypestring"all"Filter by ad type: all, political, commercial
platformstring"all"Filter by platform: all, facebook, instagram, audience_network, messenger
proxyConfigurationobjectApify ProxyProxy settings for the scraper

Example Input

{
"query": "Nike",
"country": "US",
"maxItems": 10,
"adType": "all",
"platform": "all"
}

Output

Each scraped ad contains:

FieldTypeDescription
positionintegerResult position index
pageNamestringName of the Facebook/Instagram page running the ad
adTextstringText content of the ad creative
platformstringPlatform where the ad was shown
startDatestringDate the ad started running
statusstringCurrent status of the ad (Active, Inactive, etc.)
linkstringLink to the ad in the Meta Ad Library
mediaUrlstringURL of the ad image or video creative
impressionsstringImpression count or range
querystringThe search query used
countrystringThe country filter used
scrapedAtstringISO timestamp of when the data was scraped

Example Output

{
"position": 1,
"pageName": "Nike",
"adText": "Just Do It. Shop the latest Nike collection.",
"platform": "facebook",
"startDate": "Started running on Jan 10, 2025",
"status": "Active",
"link": "https://www.facebook.com/ads/library/?id=123456789",
"mediaUrl": "https://scontent.xx.fbcdn.net/v/example.jpg",
"impressions": "10K-50K",
"query": "Nike",
"country": "US",
"scrapedAt": "2025-01-25T10:30:00.000Z"
}

Usage

Apify Console

  1. Go to the actor's page on Apify Console
  2. Set the input parameters
  3. Click "Start"

API

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_TOKEN' });
const run = await client.actor('your-username/meta-ad-library-scraper').call({
query: 'Nike',
country: 'US',
maxItems: 50,
adType: 'all',
platform: 'facebook',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

Local Development

npm install
npm start

Project Structure

src/
├── main.js # Actor entry point — reads input, configures crawler
├── constants.js # Shared constants (URLs, maps, limits)
├── routes.js # Crawler route handlers (search page)
└── utils/
├── extraction.js # Ad card data extraction from page DOM
└── url.js # URL builder for Meta Ad Library search