Facebook Ads Library Scraper avatar

Facebook Ads Library Scraper

Pricing

$10.00/month + usage

Go to Apify Store
Facebook Ads Library Scraper

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

Data Pilot

Maintained by Community

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:

  1. Initialize Search – Accept keyword-based queries and search parameters.
  2. Headless Browsing – Use Playwright for fast, automated browsing without visual overhead.
  3. Smart Scrolling – Intelligently scroll through Facebook Ads Library to load more ad results.
  4. Data Extraction – Parse HTML and extract ad metadata including CTA, page info, and media assets.
  5. Deduplication – Automatically identify and remove duplicate ad entries.
  6. Export Results – Compile and export data in structured JSON format.
  7. 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:

FieldTypeDefaultDescription
keywordsstringrequiredSearch keywords or queries (comma-separated or as list, e.g., "Nike,Coca Cola,Apple").
maxScrollsinteger10Maximum number of scrolls for deeper data collection (1-50).
countriesarray["US"]Countries to search (e.g., ["US", "UK", "CA"]).
adTypesarray["all"]Ad types to filter (e.g., ["video", "image", "carousel"]).
useProxybooleantrueEnable proxy rotation for reliability.
downloadMediabooleantrueDownload 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:

FieldTypeDescription
archiveIdstringUnique archive ID for the ad.
adNamestringName/title of the ad.
pageIdstringID of the page running the ad.
pageNamestringName of the page running the ad.
pageUrlstringURL to the advertiser's page.
ctaTextstringCall-to-action text (e.g., "Learn More").
adTextstringMain ad copy/body text.
headlinestringAd headline.
mediaTypestringType of media (image, video, carousel).
mediaUrlstringURL to media asset.
mediaDownloadedbooleanWhether media was successfully downloaded.
startDatestringAd campaign start date.
endDatestringAd campaign end date.
keywordstringKeyword used for search.
countrystringCountry where ad was found.
adTypestringType of ad (video, image, carousel, etc.).
scrapedAtstringISO 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

  1. Open in Apify Console – visit the Actor page and click Try for free.
  2. Enter search keywords – provide keywords or brand names to search for (comma-separated).
  3. Set maximum scrolls – choose the depth of search (1-50 scrolls).
  4. Select countries – choose countries to search (optional, defaults to US).
  5. Click Start – the Actor will scrape Facebook Ads Library.
  6. View Results – check the dataset for extracted ad data.
  7. Download Media – access downloaded images and videos.
  8. 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?

FeatureBenefit
βœ… Comprehensive dataGet complete ad details including CTA and copy.
βœ… Media extractionDownload actual ad images and videos.
βœ… Fast processingAsynchronous processing with Playwright for speed.
βœ… Keyword searchFind specific ads relevant to your research.
βœ… Multi-countrySearch across different countries and regions.
βœ… DeduplicationAutomatic removal of duplicate entries.
βœ… Reliable scrapingProxy support and error handling.
βœ… Real-time dataCurrent 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


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! πŸš€βœ¨