Facebook Ads Library Scraper

Facebook Ads Library Scraper

by taupe_thrush

This Apify Actor scrapes ads from Facebook's Ad Library based on the provided URL. It will extract ad data, including ad content, page information, an...

377 runs
89 users
Try This Actor

Opens on Apify.com

About Facebook Ads Library Scraper

This Apify Actor scrapes ads from Facebook's Ad Library based on the provided URL. It will extract ad data, including ad content, page information, and targeting details. It automates the browsing process, handles dynamic content loading, and provides structured data output.

What does this actor do?

Facebook Ads Library 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

  1. Click "Try This Actor" to open it on Apify
  2. Create a free Apify account if you don't have one
  3. Configure the input parameters as needed
  4. Run the actor and download your results

Documentation

Facebook Ad Library Scraper This Apify Actor scrapes ads from Facebook's Ad Library based on provided URL. It will extract comprehensive ad data including ad content, page information, and targeting details. It automates the browsing process, handles dynamic content loading, and provides structured data output. ## Features - Complete Ad Extraction: Extracts all ads from Facebook Ad Library pages, not just the first few - Dynamic Content Loading: Automatically scrolls and loads additional ads through GraphQL responses - Deduplication: Prevents duplicate ads using persistent storage across runs - Comprehensive Data: Extracts ad content, page details, timestamps, and targeting information - Flexible Input: Configure the scraper using Facebook Ad Library URLs or page URLs - Structured Output: Provides results in clean, machine-readable JSON format ## Input Schema The actor is configured using a JSON object with the following properties. ### URLs (Required) You must provide Facebook Ad Library URLs or Facebook page URLs to scrape. json { "startUrls": [ { "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=123456789", "method": "GET" }, { "url": "https://www.facebook.com/examplepage/", "method": "GET" } ] } ### Input Parameters json { "startUrls": [ { "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=123456789", "method": "GET" } ], "maxScrolls": 10, "waitTime": 5000 } #### Input Fields - startUrls (array, required): List of Facebook Ad Library URLs or Facebook page URLs to scrape - maxScrolls (integer, optional): Maximum number of scroll attempts to load more ads (default: unlimited) - waitTime (integer, optional): Wait time in milliseconds between actions (default: 5000) ### Supported URL Types 1. Facebook Ad Library URLs: Direct links from Facebook's Ad Library with search parameters - Example: https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=123456789 2. Facebook Page URLs: Direct Facebook page URLs that will be converted to Ad Library searches - Example: https://www.facebook.com/examplepage/ ## Output The actor returns a dataset where each item represents a scraped Facebook ad. ### Example Ad Output Item json { "ad_archive_id": "123456789012345", "page_id": "987654321098765", "snapshot": { "body": { "text": "Discover our latest collection! Limited time offer." }, "caption": "shop.example.com", "ctaText": "Shop Now", "ctaType": "SHOP_NOW", "linkUrl": "https://shop.example.com/collection", "title": "Summer Collection 2024", "images": [ "https://scontent.example.com/image1.jpg" ], "videos": [], "pageId": "987654321098765", "pageName": "Example Store" } } ### Output Fields The actor extracts the following fields for each ad: - Ad Identification: ad_archive_id, page_id - Ad Content: snapshot.body.text, snapshot.title, snapshot.caption - Call-to-Action: snapshot.ctaText, snapshot.ctaType, snapshot.linkUrl - Media: snapshot.images, snapshot.videos - Page Information: snapshot.pageId, snapshot.pageName ## How It Works 1. Page Loading: The scraper loads Facebook Ad Library pages or converts page URLs to Ad Library searches 2. Initial Extraction: Extracts ads from initial page scripts containing ad_library_main data 3. Dynamic Loading: Scrolls through the page to trigger GraphQL requests for additional ads 4. Deduplication: Uses persistent storage to prevent duplicate ads across runs 5. Data Processing: Processes each ad's collated results and snapshot data 6. Output: Saves each unique ad as a separate item in the dataset ## Why Scrape Facebook Ads? 💪 Competition Intelligence: Analyze competitor advertising strategies and messaging 🕵️ Market Research: Understand industry trends and advertising patterns 📈 Brand Monitoring: Track how brands present themselves across different campaigns 🤳 Creative Analysis: Study ad creative elements and copywriting approaches 📊 Performance Insights: Gather data for advertising strategy optimization ## Usage 1. Navigate to the Actor page on the Apify platform 2. Click "Try actor" 3. Enter your input configuration in the JSON editor with Facebook Ad Library URLs or page URLs 4. Configure optional parameters like maxScrolls and waitTime if needed 5. Click "Start" to run the actor 6. Once the run is complete, view and download the results from the "Dataset" tab ## Technical Notes - The scraper handles dynamic content loading through GraphQL responses - Deduplication is implemented using persistent KeyValue storage - Each ad is saved as a separate dataset item for easier analysis - The scraper respects Facebook's rate limits and includes appropriate delays - Supports both initial page script extraction and dynamic content loading ## Legal and Ethical Considerations This scraper only extracts publicly available advertising data from Facebook's Ad Library. It does not: - Extract private user information - Bypass Facebook's intended public access mechanisms - Violate Facebook's terms of service for public ad data The Facebook Ad Library is designed for transparency and public access to advertising content. However, you should: - Respect rate limits and avoid overwhelming Facebook's servers - Use the data responsibly and in compliance with applicable laws - Consider Facebook's Terms of Service and robots.txt guidelines ## Limitations - The scraper may not capture ads that are heavily restricted by geographic or demographic targeting - Some ads may have limited visibility based on Facebook's algorithmic decisions - Performance may vary based on page size and ad volume - Dynamic content loading depends on Facebook's current implementation

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 Library Scraper now on Apify. Free tier available with no credit card required.

Start Free Trial

Actor Information

Developer
taupe_thrush
Pricing
Paid
Total Runs
377
Active Users
89
Apify Platform

Apify provides a cloud platform for web scraping, data extraction, and automation. Build and run web scrapers in the cloud.

Learn more about Apify

Need Professional Help?

Couldn't solve your problem? Hire a verified specialist on Fiverr to get it done quickly and professionally.

Find a Specialist

Trusted by millions | Money-back guarantee | 24/7 Support