
Facebook Ads Scraper
Pricing
$0.70 / 1,000 results
Go to Store

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.
0.0 (0)
Pricing
$0.70 / 1,000 results
1
Total users
7
Monthly users
7
Runs succeeded
>99%
Last modified
5 days ago
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:
{"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:
{"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
{"targets": [{"country": "United States", "keyword": "real estate"},{"country": "Canada", "keyword": "homes for sale"}]}
Advanced Configuration
{"targets": [{"country": "United Kingdom", "keyword": "property investment"},{"country": "Australia", "keyword": "vacation rentals"}],"adsLimit": 500,"scrollCount": 5,"headless": false,"maxConcurrency": 2,"delay": 3000}
β οΈ Important Notes
- Rate Limiting: The scraper includes delays to respect Facebook's rate limits
- Resource Usage: Optimized for Apify's resource constraints
- Data Quality: Filters out Facebook-internal links and duplicates
- Authentication: Designed to work without login (public Ad Library)
Built with β€οΈ for the Apify platform