Facebook Ads Scraper
by shahzeb-king
Facebook Ads Library Scraper - Lightning Fast Edition | Extract Active Facebook Ads Data Instantly. Scrape ads by country & keyword with ultra-fast HT...
Opens on Apify.com
About Facebook Ads Scraper
Facebook Ads Library Scraper - Lightning Fast Edition | Extract Active Facebook Ads Data Instantly. Scrape ads by country & keyword with ultra-fast HTML parsing. Perfect for marketing research, competitor analysis & lead generation. Headless browser automation with Playwright & Apify.
What does this actor do?
Facebook Ads Scraper is a web scraping and automation tool available on the Apify platform. It's designed to help you extract data and automate tasks efficiently in the cloud.
Key Features
- Cloud-based execution - no local setup required
- Scalable infrastructure for large-scale operations
- API access for integration with your applications
- Built-in proxy rotation and anti-blocking measures
- Scheduled runs and webhooks for automation
How to Use
- Click "Try This Actor" to open it on Apify
- Create a free Apify account if you don't have one
- Configure the input parameters as needed
- Run the actor and download your results
Documentation
Facebook Ads Scraper - Apify Actor A high-performance Facebook Ads Library scraper built for the Apify platform using Playwright. This actor efficiently scrapes Facebook's Ad Library for ads based on country-keyword pairs with optimized resource usage. ## 🚀 Features - High Performance: Optimized for Apify platform with minimal resource consumption - Batch Processing: Controlled concurrency to prevent memory issues - Comprehensive Data: Extracts detailed ad information including: - Ad status and Library ID - Page name and start date - Primary text and Call-to-Action (CTA) - External links and image URLs - Raw ad content - Robust Error Handling: Continues processing even if individual ads fail - Real-time Output: Results are saved to Apify dataset immediately ## 📋 Input Schema The actor accepts the following input parameters: json { "targets": [ { "country": "United States", "keyword": "rental properties" }, { "country": "Canada", "keyword": "vacation homes" } ], "adsLimit": 1000, "scrollCount": 3, "headless": true, "maxConcurrency": 1, "delay": 2000 } ### Parameters - targets (required): Array of country-keyword pairs to scrape - adsLimit (optional): Maximum ads per target (default: 1000) - scrollCount (optional): Number of scroll actions to load more ads (default: 3) - headless (optional): Run browser in headless mode (default: true) - maxConcurrency (optional): Maximum concurrent browser instances (default: 1) - delay (optional): Delay between actions in milliseconds (default: 2000) ## 📊 Output Format Each scraped ad contains: json { "country": "United States", "keyword": "rental properties", "ads": [ { "status": "Active", "library_id": "123456789", "started": "Started running on Jan 1, 2024", "page": "Example Page", "primary_text": "Find your dream rental property...", "cta": "Learn More", "links": [ { "type": "link", "url": "https://example.com", "text": "Visit Website" } ], "image_urls": ["https://example.com/image.jpg"], "raw_text": "Full ad text content...", "scraped_at": "2024-01-01T12:00:00.000Z" } ], "ads_count": 150, "processed_at": "2024-01-01T12:00:00.000Z" } ## 🛠️ Technical Details ### Architecture - Runtime: Node.js 18 with Playwright - Browser: Chromium with optimized launch arguments - Concurrency: Configurable batch processing - Memory: Optimized for low memory usage on Apify ### Key Optimizations - Single browser instance with multiple contexts - Immediate data saving to prevent loss - Progressive scroll delays to avoid rate limiting - Efficient XPath selectors for fast element detection - Minimal DOM queries with smart caching ### Error Handling - Graceful handling of missing elements - Automatic retry on transient failures - Detailed error logging for debugging - Continues processing even if individual ads fail ## 📝 Usage Examples ### Basic Usage json { "targets": [ {"country": "United States", "keyword": "real estate"}, {"country": "Canada", "keyword": "homes for sale"} ] } ### Advanced Configuration json { "targets": [ {"country": "United Kingdom", "keyword": "property investment"}, {"country": "Australia", "keyword": "vacation rentals"} ], "adsLimit": 500, "scrollCount": 5, "headless": false, "maxConcurrency": 2, "delay": 3000 } ## ⚠️ Important Notes 1. Rate Limiting: The scraper includes delays to respect Facebook's rate limits 2. Resource Usage: Optimized for Apify's resource constraints 3. Data Quality: Filters out Facebook-internal links and duplicates 4. Authentication: Designed to work without login (public Ad Library) --- Built with ❤️ for the Apify platform
Categories
Common Use Cases
Market Research
Gather competitive intelligence and market data
Lead Generation
Extract contact information for sales outreach
Price Monitoring
Track competitor pricing and product changes
Content Aggregation
Collect and organize content from multiple sources
Ready to Get Started?
Try Facebook Ads Scraper now on Apify. Free tier available with no credit card required.
Start Free TrialActor Information
- Developer
- shahzeb-king
- Pricing
- Paid
- Total Runs
- 690
- Active Users
- 106
Related Actors
Video Transcript Scraper: Youtube, X, Facebook, Tiktok, etc.
by invideoiq
Linkedin Profile Details Scraper + EMAIL (No Cookies Required)
by apimaestro
Twitter (X.com) Scraper Unlimited: No Limits
by apidojo
Content Checker
by jakubbalada
Apify provides a cloud platform for web scraping, data extraction, and automation. Build and run web scrapers in the cloud.
Learn more about ApifyNeed Professional Help?
Couldn't solve your problem? Hire a verified specialist on Fiverr to get it done quickly and professionally.
Trusted by millions | Money-back guarantee | 24/7 Support