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
1
Total users
0
Monthly active users
17 hours 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, media assets, 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
- Bulk cursor pagination — Fetch hundreds of ads (500+) via Facebook's Relay GraphQL pagination instead of slow scrolling
- Date filtering — Filter by ad start date (
startDateMin/startDateMax), applied at the URL level and as a post-scrape filter - Page enrichment (optional) — Add page likes, followers, phone, email, website, address, category and rating to every ad
- No API key required — Uses the public Ad Library website
- Rich media fields —
imageUrls,videoUrls,displayFormat,caption,profileImageUrl - 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, empty = worldwide | "US" |
| Ad Type | Filter by ad category | "ALL" |
| Active Status | Filter by active/inactive | "ACTIVE" |
| Start Date Min | Only ads started on/after this date (YYYY-MM-DD) | "" |
| Start Date Max | Only ads started on/before this date (YYYY-MM-DD) | "" |
| Enrich Pages | Visit each page to add likes/phone/etc. fields | false |
| Max Items | Maximum ads to extract | 100 |
| Max Scrolls | Scroll iterations (used as fallback) | 20 |
| Scroll Delay | Delay between scrolls (ms) | 2000 |
| Proxy Configuration | Apify Proxy — leave off for small runs | off |
Output
Each ad contains:
| Field | Description |
|---|---|
adArchiveId | Unique ad identifier |
pageId / pageName / pageUrl | Advertiser page info |
body / title / caption | Ad text content |
linkUrl / ctaText / ctaType | CTA destination and button |
startDate / endDate / isActive | Flight dates (YYYY-MM-DD) |
platforms | Where the ad runs (Facebook, Instagram, ...) |
mediaType / displayFormat | image, video, carousel, text |
imageUrls / videoUrls / profileImageUrl | Media asset URLs |
beneficiaryName / payerName | Funding transparency fields |
source | Which input source produced this ad |
snapshot | Raw extra metadata (categories, likes, cards) |
With Enrich Pages enabled, each ad additionally gets: pageLikes, pageFollowers, pagePhone, pageEmail, pageWebsite, pageAddress, pageCategory, pageCategories, isVerified, pageRating, pageRatingCount.
How it works
- Navigation — Loads the Ad Library search/page results with
waitUntil: commit(Facebook's multi-MB payload hangsdomcontentloadedover proxies) - Relay cache extraction — Parses all embedded
ad_library_main.search_results_connection.edgesJSON blobs from the page source, deduped by ad archive ID - Bulk cursor pagination — Harvests the
end_cursorfrom page HTML, sniffs the livedoc_idfrom Facebook's JS bundles, then walks the RelayAdLibrarySearchPaginationQueryendpoint with the session's cookies — hundreds of ads in seconds instead of scrolls - Scroll fallback — If pagination isn't available (exhausted cursor, no doc_id), scrolls the results container with stale-round detection
- Date filter — Post-scrape inclusive filter on
startDate - Deduplication — By ad archive ID across all sources
Tips
- Small runs (≤ ~30 ads): no proxy needed — keep Proxy Configuration off
- Bulk runs (500+): enable Apify Proxy with the RESIDENTIAL group and country US — Facebook rate-limits datacenter IPs (error 1675004)
- Higher
maxScrollsonly matters when pagination falls back to scrolling - Start with
maxItems: 100to test, then increase as needed
Cost Estimation
- 100 ads: ~$0.05-0.15 compute
- 500 ads (bulk pagination): ~$0.15-0.40 compute
- Proxy costs depend on your plan
Known Limitations
- Facebook may block datacenter IPs — bulk pagination needs a residential proxy
- Ad Library page structure changes may require updates to the Relay cache parser
- Enrich Pages adds ~1-3s per unique page (browser visits)
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.