Facebook Ad Library Scraper
Pricing
$0.50 / 1,000 results
Facebook Ad Library Scraper
Scrapes ads from the Facebook Ad Library. Accepts search URLs or Facebook page URLs and returns structured ad data.
Pricing
$0.50 / 1,000 results
Rating
0.0
(0)
Developer
Practical Tools
Actor stats
0
Bookmarked
2
Total users
1
Monthly active users
a day ago
Last modified
Categories
Share
Extract ads from the Facebook Ad Library — including creative content, targeting info, impressions, and page details — without needing a Facebook account or API key.
Accepts both Ad Library search URLs and Facebook page URLs as input. Handles cursor-based pagination automatically to collect up to any number of ads per source.
Features
- No login required — scrapes the public Ad Library
- Two input modes — Ad Library search URLs or Facebook page URLs
- Full ad data — archive ID, page info, dates, impressions, reach, and the full creative snapshot (body text, images, videos, CTA, links)
- Automatic pagination — follows cursor-based pages until the limit is reached
- Proxy-ready — supports Apify residential proxies or custom proxy URLs
Input
| Field | Type | Description |
|---|---|---|
urls | array | Ad Library search URLs (facebook.com/ads/library/?...) or Facebook page URLs (facebook.com/SomePage) |
limitPerSource | integer | Maximum number of ads to collect per input URL (default: 10) |
scrapeAdDetails | boolean | Include the full ad creative snapshot — images, videos, body text, CTA (default: true) |
scrapePageAds.activeStatus | string | Filter by ad status when the input is a Facebook page URL: all, active, inactive |
scrapePageAds.countryCode | string | Country filter for page URL inputs. ISO 3166-1 alpha-2 code (e.g. US, IN) or ALL |
scrapePageAds.sortBy | string | Sort order for page URL inputs: impressions_desc, impressions_asc, start_date_desc, start_date_asc |
proxyConfiguration | object | Proxy settings. Residential proxies are strongly recommended — Facebook blocks datacenter IPs |
Example input
{"urls": [{ "url": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&q=nike&search_type=keyword_unordered&media_type=all" }],"limitPerSource": 50,"scrapeAdDetails": true,"proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }}
Using Facebook page URLs
If you provide a Facebook page URL (e.g. https://www.facebook.com/Nike), the scraper resolves the numeric page ID and builds the Ad Library URL automatically using the scrapePageAds.* options:
{"urls": [{ "url": "https://www.facebook.com/Nike" },{ "url": "https://www.facebook.com/Adidas" }],"limitPerSource": 30,"scrapePageAds.activeStatus": "active","scrapePageAds.countryCode": "US","scrapePageAds.sortBy": "impressions_desc"}
Note: scrapePageAds.* options are only applied when the input URL is a Facebook page URL. For Ad Library search URLs, all query parameters come directly from the URL you provide.
Output
Each item in the dataset represents one ad:
{"adArchiveID": "914351827969140","adid": null,"isActive": true,"pageName": "LinkedIn","pageID": "6191007822","startDate": 1720000000,"endDate": 1774767600,"collationCount": 1,"collationID": "1507717401043960","currency": "","entityType": null,"impressionsWithIndex": {"impressionsText": null,"impressionsIndex": -1},"reachEstimate": null,"pageInfo": {"id": "6191007822","name": "LinkedIn","profilePictureURL": "https://..."},"snapshot": {"body": { "text": "Grow your business with LinkedIn Ads." },"title": "LinkedIn Ads","link_url": "https://business.linkedin.com/...","cta_text": "Learn More","cta_type": "LEARN_MORE","display_format": "VIDEO","images": [],"videos": [{ "video_hd_url": "https://...", "video_preview_image_url": "https://..." }],"page_id": "6191007822","current_page_name": "LinkedIn","page_profile_picture_url": "https://..."},"url": "https://www.facebook.com/ads/library/?..."}
Set scrapeAdDetails: false to omit the snapshot field and reduce dataset size.
How it works
Facebook's Ad Library server-side renders ad data as a JSON blob embedded in the initial HTML response (a Relay store dump containing search_results_connection). The scraper:
- Navigates to the Ad Library URL using a stealth Chromium browser
- Captures the HTML response and extracts the embedded JSON blob using balanced-brace parsing
- Normalises the snake_case API fields into a clean output schema
- Reads the
page_info.end_cursorfrom the response and enqueues the next page URL (?after=<cursor>) if more ads are needed - Repeats until
limitPerSourceis reached or no more pages exist
For Facebook page URLs, the scraper first visits the page to extract its numeric ID, then builds and processes the corresponding Ad Library URL.
Proxy
The Facebook Ad Library is a public transparency tool — no proxy is required in most cases. The actor runs cleanly on Apify's infrastructure without additional proxy configuration.
If you encounter blocks or CAPTCHAs (more likely with very high volumes or repeated runs from the same IP), you can optionally add residential proxies:
"proxyConfiguration": {"useApifyProxy": true,"apifyProxyGroups": ["RESIDENTIAL"]}