Facebook Ad Library Scraper (Playwright)
Pricing
from $10.00 / 1,000 results
Facebook Ad Library Scraper (Playwright)
Scrape ads from Meta Ad Library using Playwright. Intercepts GraphQL responses for structured data extraction. No API key or Facebook account required.
Pricing
from $10.00 / 1,000 results
Rating
0.0
(0)
Developer
Admo Solutions
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
6 days ago
Last modified
Categories
Share
Facebook Ad Library Scraper
Scrape ads from Meta's public Ad Library using Playwright. Supports two modes: keyword search and Facebook page scraping. Extracts comprehensive ad data including page IDs, URLs, CTA details, platforms, and carousel cards — no API key or Facebook account required.
Why use this Actor?
- Two scraping modes — Search by keyword OR scrape ads from Facebook page URLs
- No API key required — Uses the public Ad Library website
- Relay cache extraction — Parses embedded GraphQL data from page source for complete field coverage
- Residential proxy support — Built-in proxy rotation for reliable scraping
- Deduplication — Automatically deduplicates by ad archive ID
- Structured output — Clean JSON dataset with full ad metadata
- Self-contained — No external Actor dependencies
How to use
Mode 1: Search by keyword
- Enter a search term (e.g., "skincare", "fitness coaching", "SaaS")
- Optionally set a country code (e.g., "US", "IN", "GB")
- Run the Actor
Mode 2: Scrape ads from Facebook pages
- Add Facebook page URLs to the "Facebook Page URLs" field
- Optionally set a country code
- Run the Actor
Supported URL formats:
https://www.facebook.com/ZapierApphttps://www.facebook.com/profile.php?id=123456facebook.com/YourPage
Input
| Field | Description | Default |
|---|---|---|
| Search Terms | Keywords to search in Ad Library (search mode) | "skincare" |
| Page URLs | Facebook page URLs to scrape ads from (page mode) | [] |
| Country Code | ISO 2-letter country code | "US" |
| Ad Type | Filter by ad category | "ALL" |
| Active Status | Filter by active/inactive | "ACTIVE" |
| Max Items | Maximum ads to extract | 100 |
| Max Scrolls | Scroll iterations | 20 |
| Scroll Delay | Delay between scrolls (ms) | 2000 |
Output
Each ad contains:
| Field | Description | Source |
|---|---|---|
adArchiveId | Unique ad identifier | Relay cache |
pageId | Facebook page ID | Relay cache |
pageName | Advertiser page name | Relay cache |
pageUrl | Advertiser Facebook page URL | Relay cache |
body | Ad text content | Relay cache |
title | Ad headline | Relay cache |
linkUrl | CTA destination URL | Relay cache |
ctaText | CTA button text (e.g., "Learn more") | Relay cache |
ctaType | CTA type (e.g., "LEARN_MORE", "SHOP_NOW") | Relay cache |
startDate | When the ad started running (Unix timestamp) | Relay cache |
isActive | Whether the ad is currently active | Relay cache |
platforms | Where the ad runs (Facebook, Instagram, etc.) | Relay cache |
mediaType | Ad format (image, video, carousel, text) | Relay cache |
snapshot | Additional metadata (categories, likes, cards) | Relay cache |
Output Example
{"adArchiveId": "1591671712123479","pageId": "108268605296897","pageName": "TikTok - US","pageUrl": "https://www.facebook.com/100083860366075/","body": "Fun awaits, no delays.","title": "{{product.name}}","linkUrl": "http://play.google.com/store/apps/details?id=com.zhiliaoapp.musically","ctaText": "Learn more","ctaType": "LEARN_MORE","startDate": 1774508400,"isActive": true,"platforms": ["FACEBOOK", "INSTAGRAM", "AUDIENCE_NETWORK", "MESSENGER", "THREADS"],"mediaType": "carousel","snapshot": {"pageCategories": ["Entertainment website"],"pageLikeCount": 157244,"cards": [{"title": "Treat yourself on TikTok.", "linkUrl": "https://www.tiktok.com/"}]}}
How it works
This Actor uses Playwright to load the Meta Ad Library page, then extracts ad data from the embedded Relay cache (serialized GraphQL data in the page source):
- Navigation — Loads the Ad Library search results page
- Relay cache extraction — Parses the embedded
ad_library_main.search_results_connection.edgesJSON from the page source - Scrolling — Scrolls to load more ads and re-extracts from updated page source
- DOM fallback — If Relay cache extraction fails, falls back to DOM-based text parsing
- Deduplication — Deduplicates by ad archive ID
Tips
- Use residential proxy for best results (Facebook blocks datacenter IPs)
- Higher scroll count = more results but longer runtime
- Start with 100 items to test, then increase as needed
- Deduplication happens automatically by ad archive ID
Cost Estimation
This Actor runs Playwright browser automation. Typical costs:
- 100 ads: ~$0.05-0.15 compute
- 1000 ads: ~$0.50-1.50 compute
- Proxy costs depend on your plan
Known Limitations
- Facebook may block requests without residential proxy
- Ad Library page structure changes may require updates to the Relay cache parser
- Image/video URLs may be empty for some ad formats (carousel cards often lack direct image URLs in the cache)
Disclaimer
Our Actors are ethical and do not extract any private user data. They only extract what has been chosen to share publicly on the Meta Ad Library. We therefore believe that our Actors, when used for ethical purposes by Apify users, are safe. However, you should be aware that your results could contain personal data. Personal data is protected by the GDPR in the European Union and by other regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you're unsure whether your reason is legitimate, consult your lawyers.
Support
- Having trouble? Open an Issue on the Actor page.
- For programmatic access, see the API tab.