Meta Ad Library Scraper
Pricing
from $4.99 / 1,000 results
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
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
2 months ago
Last modified
Categories
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
proxyConfigurationwithuseApifyProxy: trueandapifyProxyGroups: ["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
| Field | Type | Default | Description |
|---|---|---|---|
query | string | "Nike" | Search term to look for in the Meta Ad Library |
country | string | "US" | ISO 3166-1 alpha-2 country code |
maxItems | integer | 50 | Maximum number of ads to scrape (1–5000) |
adType | string | "all" | Filter by ad type: all, political, commercial |
platform | string | "all" | Filter by platform: all, facebook, instagram, audience_network, messenger |
proxyConfiguration | object | Apify Proxy | Proxy settings for the scraper |
Example Input
{"query": "Nike","country": "US","maxItems": 10,"adType": "all","platform": "all"}
Output
Each scraped ad contains:
| Field | Type | Description |
|---|---|---|
position | integer | Result position index |
pageName | string | Name of the Facebook/Instagram page running the ad |
adText | string | Text content of the ad creative |
platform | string | Platform where the ad was shown |
startDate | string | Date the ad started running |
status | string | Current status of the ad (Active, Inactive, etc.) |
link | string | Link to the ad in the Meta Ad Library |
mediaUrl | string | URL of the ad image or video creative |
impressions | string | Impression count or range |
query | string | The search query used |
country | string | The country filter used |
scrapedAt | string | ISO 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
- Go to the actor's page on Apify Console
- Set the input parameters
- 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 installnpm 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