Facebook Ads Library Scraper
Pricing
$10.00/month + usage
Facebook Ads Library Scraper
This script uses to scrape Facebook Ads data from the Facebook Ads Library based on a user-provided keyword. It captures ads in real-time as the page loads and scrolls, then saves them into a JSON file.
Pricing
$10.00/month + usage
Rating
0.0
(0)
Developer

Data Pilot
Actor stats
0
Bookmarked
4
Total users
1
Monthly active users
2 days ago
Last modified
Categories
Share
π Facebook Ads Library Scraper is a powerful tool designed to extract and analyze ads from Facebook's Ads Library effortlessly. Whether you're a marketer, researcher, or analyst, this scraper helps you gather insights on ad campaigns, including images, videos, and key metadata. Built with advanced automation, it delivers accurate, real-time Facebook Ads data without manual effort.
π₯ Features
- Comprehensive Data Extraction β Capture ad details like archive ID, CTA text, page info, and media assets (images and videos).
- Keyword-Based Search β Search for ads using specific keywords or queries across all countries and ad types.
- High Efficiency β Asynchronous processing with Playwright for fast, headless browsing and scrolling.
- Deduplication β Automatically removes duplicates to ensure clean, unique results.
- Customizable Scrolling β Set maximum scrolls to control the depth of data collection.
- Secure and Reliable β Uses proxies and error handling for uninterrupted scraping.
- Media Asset Extraction β Download and extract images and videos from ads.
- Real-Time Data β Get current Facebook Ads Library data for accurate analysis.
βοΈ How It Works
The Facebook Ads Library Scraper operates using advanced automation and intelligent data extraction:
- Initialize Search β Accept keyword-based queries and search parameters.
- Headless Browsing β Use Playwright for fast, automated browsing without visual overhead.
- Smart Scrolling β Intelligently scroll through Facebook Ads Library to load more ad results.
- Data Extraction β Parse HTML and extract ad metadata including CTA, page info, and media assets.
- Deduplication β Automatically identify and remove duplicate ad entries.
- Export Results β Compile and export data in structured JSON format.
- Media Processing β Download and organize associated images and videos.
Key Processing Features:
- Asynchronous processing for faster execution
- Error handling with automatic retries
- Proxy rotation for reliability
- Memory-efficient processing of large datasets
- Real-time progress tracking
π₯ Input
The scraper accepts the following input parameters:
| Field | Type | Default | Description |
|---|---|---|---|
keywords | string | required | Search keywords or queries (comma-separated or as list, e.g., "Nike,Coca Cola,Apple"). |
maxScrolls | integer | 10 | Maximum number of scrolls for deeper data collection (1-50). |
countries | array | ["US"] | Countries to search (e.g., ["US", "UK", "CA"]). |
adTypes | array | ["all"] | Ad types to filter (e.g., ["video", "image", "carousel"]). |
useProxy | boolean | true | Enable proxy rotation for reliability. |
downloadMedia | boolean | true | Download images and videos from ads. |
Example input JSON:
{"keywords": "Nike,Coca Cola,Apple","maxScrolls": 15,"countries": ["US", "UK", "Canada"],"adTypes": ["video", "image"],"useProxy": true,"downloadMedia": true}
π€ Output
The scraper outputs comprehensive Facebook Ads Library data in structured JSON format. Each ad record includes:
| Field | Type | Description |
|---|---|---|
archiveId | string | Unique archive ID for the ad. |
adName | string | Name/title of the ad. |
pageId | string | ID of the page running the ad. |
pageName | string | Name of the page running the ad. |
pageUrl | string | URL to the advertiser's page. |
ctaText | string | Call-to-action text (e.g., "Learn More"). |
adText | string | Main ad copy/body text. |
headline | string | Ad headline. |
mediaType | string | Type of media (image, video, carousel). |
mediaUrl | string | URL to media asset. |
mediaDownloaded | boolean | Whether media was successfully downloaded. |
startDate | string | Ad campaign start date. |
endDate | string | Ad campaign end date. |
keyword | string | Keyword used for search. |
country | string | Country where ad was found. |
adType | string | Type of ad (video, image, carousel, etc.). |
scrapedAt | string | ISO timestamp of scrape. |
Example output for a Facebook Ad:
{"archiveId": "10158234567890123","adName": "Nike Summer Campaign","pageId": "123456789","pageName": "Nike Official","pageUrl": "https://facebook.com/nike","ctaText": "Shop Now","adText": "Discover the latest Nike collection with up to 50% off. Limited time offer!","headline": "Summer Sale - Nike Official","mediaType": "image","mediaUrl": "https://example.com/ad-image.jpg","mediaDownloaded": true,"startDate": "2025-01-15","endDate": "2025-02-15","keyword": "Nike","country": "US","adType": "image","scrapedAt": "2025-02-14T12:00:00Z"}
Example summary record:
{"summary": true,"keywords_processed": 3,"total_ads_found": 156,"unique_ads": 145,"duplicates_removed": 11,"media_downloaded": 128,"countries_searched": 3,"average_scrolls": 12,"completed_at": "2025-02-14T12:35:00Z"}
π§° Technical Stack
- Browser Automation: Playwright β Fast, headless browser automation
- Data Processing: pandas, BeautifulSoup β HTML parsing and data organization
- Async Engine: asyncio β Concurrent processing for efficiency
- Proxy Support: Rotation mechanism with error handling
- Storage: JSON export with organized folder structure for media assets
- Platform: Apify Actor β serverless, scalable, integrated with Dataset and KeyβValue Store
- Deployment: Oneβclick run on Apify Console or via REST API
π― Use Cases
- Competitive Analysis β Analyze competitor ad strategies and messaging.
- Market Research β Research industry trends through ad campaigns.
- Ad Performance Research β Understand what makes successful ads.
- Brand Monitoring β Track your own brand ads across Facebook.
- Industry Benchmarking β Compare ad approaches across competitors.
- Campaign Planning β Get inspiration from successful ad creatives.
- Pricing Intelligence β Research competitor pricing through ad copy.
- Product Research β Discover new products and features via ads.
- Message Testing β Analyze messaging patterns in successful campaigns.
- Visual Design Analysis β Study ad design trends and best practices.
- Audience Segmentation β Understand targeting based on ad variations.
- Trend Forecasting β Predict upcoming trends from ad campaigns.
- Academic Research β Study advertising practices and digital marketing.
- Content Strategy β Develop content strategy based on successful ads.
π Quick Start
- Open in Apify Console β visit the Actor page and click Try for free.
- Enter search keywords β provide keywords or brand names to search for (comma-separated).
- Set maximum scrolls β choose the depth of search (1-50 scrolls).
- Select countries β choose countries to search (optional, defaults to US).
- Click Start β the Actor will scrape Facebook Ads Library.
- View Results β check the dataset for extracted ad data.
- Download Media β access downloaded images and videos.
- Export β download the results as JSON, CSV, or Excel.
You can also call this Actor programmatically via Apify SDK or REST API β ideal for automated competitive analysis and market research pipelines.
π Why Use This Scraper?
| Feature | Benefit |
|---|---|
| β Comprehensive data | Get complete ad details including CTA and copy. |
| β Media extraction | Download actual ad images and videos. |
| β Fast processing | Asynchronous processing with Playwright for speed. |
| β Keyword search | Find specific ads relevant to your research. |
| β Multi-country | Search across different countries and regions. |
| β Deduplication | Automatic removal of duplicate entries. |
| β Reliable scraping | Proxy support and error handling. |
| β Real-time data | Current Facebook Ads Library information. |
π¦ Changelog
- Initial release of Facebook Ads Library Scraper
- Keyword-based ad search functionality
- Comprehensive data extraction from Ads Library
- Media asset downloading (images and videos)
- Asynchronous processing with Playwright
- Automatic deduplication of ad entries
- Multi-country and ad type filtering
- Proxy support for reliable scraping
- Real-time Facebook Ads Library data
- Summary statistics and analytics
- Error handling and retry mechanisms
- Full Apify Actor integration
π§βπ» Support & Feedback
- Issues & Ideas: Open a ticket on the Apify Actor issue tracker
- Contributions: Pull requests are welcome via the GitHub repository
- Documentation: Visit Apify Docs for comprehensive platform guides
- Community: Join the Apify community forum for discussions and support
- Bug Reports: Submit detailed bug reports through the issue tracker
- Feature Requests: Suggest new features to improve the scraper
π° Pricing
- Free for basic usage on Apify platform
- Paid plans available for higher limits and priority support
- Proxy credits consumed based on proxy usage
- Storage credits consumed for downloaded media assets
π Get Started Today
Begin extracting Facebook Ads data now!
Use Facebook Ads Library Scraper for:
- π Competitive Analysis
- π Market Research
- π‘ Creative Inspiration
- π Trend Analysis
- π± Ad Performance Research
Perfect for:
- Marketing Professionals
- Market Researchers
- Competitive Analysts
- Academic Researchers
- Business Strategists
Last Updated: February 2025
Version: 1.0.0
Status: Active Development
Support: 24/7 Customer Support Available
Platform: Apify
π Related Tools
For comprehensive social media and ad analysis, explore our full suite of tools:
- YouTube Analytics Scraper
- Instagram Analytics Scraper
- TikTok Analytics Extractor
- Google Ads Intelligence Tools
- Competitive Intelligence Suite
Your complete ad intelligence and market research solution! πβ¨