Facebook Ads Meta Adlibrary Scraper
Pricing
$0.50 / 1,000 results
Facebook Ads Meta Adlibrary Scraper
Cheapest and fastest Facebook / Meta Adlibrary scraper on Apify. Scrape All ads per Adlibrary Url including creatives and collateral results. Scrapes Full Results for all Ads across Facebook, Instragram, Threads, Whatsapp, Messenger and Audience Network.
Pricing
$0.50 / 1,000 results
Rating
5.0
(1)
Developer

Murat
Actor stats
2
Bookmarked
11
Total users
7
Monthly active users
8 days ago
Last modified
Categories
Share
Facebook Ads Library Scraper
Fast and reliable scraper for Facebook Ads Library that can extract thousands of ads from any Facebook Page. Built with automatic rate limit handling, proxy rotation, and intelligent session management.
โจ Key Features
- ๐ High Performance: Scrapes ~5-10 ads/second with optimized GraphQL requests
- ๐ Automatic Rate Limit Handling: Automatically switches IPs and renews sessions when rate limited
- ๐ Smart Proxy Rotation: Rotates through multiple countries (US, UK, CA, AU, DE) for better success rates
- ๐ช Robust & Reliable: Multiple retry attempts with exponential backoff
- ๐ Unlimited Scraping: Can scrape thousands of ads from any page (tested with 15,000+ ads)
- โก Real-time Streaming: Results saved immediately to dataset
- ๐ฏ Flexible Filtering: Filter by country, status, ad type, and more
๐ What You Can Extract
Each ad includes comprehensive data:
- Ad Content: Text, titles, descriptions, call-to-action
- Media: Images, videos, carousel content
- Targeting: Demographics, locations, interests
- Performance: Impressions, spend ranges (when available)
- Metadata: Creation time, status, page info
- URLs: Ad snapshot links, landing pages
๐ฏ Use Cases
- ๐ Competitive Analysis: Monitor competitor ad strategies
- ๐ Market Research: Discover industry trends and messaging
- ๐ฑ Social Media Monitoring: Track brand campaigns
- ๐ผ Business Intelligence: Analyze advertising tactics
- ๐จ Creative Inspiration: Study successful ad creatives
- ๐ Spend Tracking: Monitor advertising investments
๐ Quick Start
Option 1: Using Page ID
{"pageId": "109806077081081","country": "US","activeStatus": "all","maxAds": 5000}
Option 2: Using Full URL
{"url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&search_type=page&view_all_page_id=109806077081081","maxAds": 5000,"requestDelay": 100}
Option 3: Unlimited Scraping
{"pageId": "109806077081081","requestDelay": 100}
Leave maxAds empty to scrape all available ads
๐ Input Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | * | - | Full Facebook Ads Library URL |
pageId | string | * | - | Facebook Page ID (alternative to URL) |
country | string | No | "ALL" | Country code (US, GB, ALL, etc.) |
activeStatus | string | No | "all" | Filter: all, active, or inactive |
adType | string | No | "all" | Filter: all, political, housing, employment, credit |
maxAds | integer | No | unlimited | Maximum number of ads to scrape |
requestDelay | integer | No | 500 | Delay between requests in milliseconds |
useProxy | boolean | No | true | Enable Apify proxy rotation after rate limiting |
maxSessionRenewals | integer | No | 10 | Max times to renew session when rate limited |
* Either url or pageId is required
๐ก How It Works
Smart Architecture
- Browser Initialization: Launches Playwright browser to capture authentication tokens from Facebook
- Token Extraction: Intercepts GraphQL requests to extract necessary authentication headers
- Direct API Requests: Makes fast, direct GraphQL API calls using captured tokens
- Cursor-Based Pagination: Efficiently navigates through results using Facebook's cursor system
- Rate Limit Detection: Automatically detects rate limiting (error code 1675004)
- Intelligent Recovery: When rate limited:
- Closes current browser session
- Waits with exponential backoff (30s-120s)
- Creates new session with different proxy IP
- Rotates through 5 countries for IP diversity
- Retries up to 6 times before falling back to no-proxy
- Resumes exactly where it left off
Rate Limit Handling Flow
Rate limit detected โ Wait 30-120s โ Try proxy (US) โ Failed?โ Wait 10s โ Try proxy (GB) โ Failed?โ Wait 20s โ Try proxy (CA) โ Failed?โ Wait 30s โ Try proxy (AU) โ Failed?โ Wait 40s โ Try proxy (DE) โ Failed?โ Wait 50s โ Try without proxy โ Failed?โ Stop with error
๐ค Output Format
Results are saved to Apify dataset in JSON format:
{"ad_archive_id": "1234567890","page_id": "109806077081081","page_name": "Example Brand","ad_creation_time": "2024-01-15T10:30:00+0000","ad_creative_bodies": ["Check out our new collection!"],"ad_creative_link_titles": ["Shop Now"],"ad_creative_link_descriptions": ["Free shipping on orders over $50"],"ad_snapshot_url": "https://www.facebook.com/ads/library/?id=1234567890","currency": "USD","spend": {"lower_bound": "100","upper_bound": "500"},"impressions": {"lower_bound": "10000","upper_bound": "50000"},"scrapedAt": "2024-11-17T08:30:00.000Z"}
๐๏ธ Advanced Configuration
High-Speed Scraping
For maximum speed (with higher rate limit risk):
{"pageId": "109806077081081","requestDelay": 100,"maxSessionRenewals": 15}
Conservative Scraping
For slower but more reliable scraping:
{"pageId": "109806077081081","requestDelay": 1000,"maxSessionRenewals": 5}
โก Performance
- Speed: 5-10 ads per second (varies by rate limiting)
- Reliability: 99% success rate with automatic recovery
- Scale: Tested with 15,000+ ads per run
- Efficiency: ~10 ads per GraphQL request
๐ก๏ธ Best Practices
- Start with limits: Test with
maxAds: 100first - Monitor logs: Check Actor logs for rate limit handling
- Adjust delays: Increase
requestDelayif frequently rate limited - Enable proxies: Keep
useProxy: truefor automatic recovery - Be patient: Let the actor handle rate limits automatically
- Export data: Download dataset after completion
โ Common Issues
"Failed to capture GraphQL tokens"
Solution: This usually happens with blocked proxy IPs. The actor will automatically retry with different IPs. If all retries fail, it may indicate Facebook is blocking the proxy provider.
Frequent Rate Limiting
Solution:
- Increase
requestDelayto 1000ms or higher - Increase
maxSessionRenewalsfor more retry attempts - Ensure
useProxy: trueis enabled
Duplicate Ads
Solution: The actor automatically deduplicates ads by ad_archive_id. Duplicates in output are rare.
๐ Cost Estimation
Typical costs on Apify (approximate):
- 1,000 ads: ~0.01-0.02 credits
- 10,000 ads: ~0.10-0.20 credits
- 100,000 ads: ~1.00-2.00 credits
Costs vary based on rate limiting, proxy usage, and request delays
๐ง Technical Details
- Platform: Apify Actor (Node.js)
- Browser: Playwright with Chromium
- Proxy: Apify Residential Proxies with country rotation
- API: Facebook GraphQL API (AdLibrarySearchPaginationQuery)
- Storage: Apify Dataset with immediate persistence
๐ Support & Feedback
Having issues or suggestions?
- Check Actor logs for detailed error messages
- Review input parameters for correctness
- Ensure Page ID or URL is valid
- Contact Apify support for platform issues
โ๏ธ Legal & Ethical Use
This actor scrapes publicly available data from Facebook's Ad Library. Users are responsible for:
- Complying with Facebook's Terms of Service
- Respecting data privacy and applicable laws
- Using scraped data ethically and legally
- Not overwhelming Facebook's servers
Note: This tool is for research, analysis, and competitive intelligence purposes only.
๐ Version History
- v1.0: Initial release with basic GraphQL scraping
- v2.0: Added automatic rate limit handling and proxy rotation
- v3.0: Implemented country rotation and session management
- Current: Robust retry logic with 6-attempt fallback system
Made with โค๏ธ for the Apify community
Extract insights, stay competitive, and make data-driven decisions with Facebook Ads Library Scraper.