pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://apify.com/shahzeb-king/facebook-ads-scraper

sOVJ5MnlaMWlNZFRsSWFNeTFway9yczpmaWxsOjMyOjMyL2NiOjEvYUhSMGNITTZMeTloY0dsbWVTMXBiV0ZuWlMxMWNHeHZZV1J6TFhCeWIyUXVjek11ZFhNdFpXRnpkQzB4TG1GdFlYcHZibUYzY3k1amIyMHZhM1pMT1dsV1NtTlFiMlpKVkVNd1UzZ3ZhbWhuTUUxaVprdFlOekEzY0ZKdk1Fd3RiRzluYnkxamIyeHZjaTV3Ym1jLnBuZw.webp"/>Lightning-fast Facebook Ads Library scraper Β· Apify
Facebook Ads Scraper avatar
Facebook Ads Scraper

Pricing

$0.70 / 1,000 results

Go to Apify Store
Facebook Ads Scraper

Facebook Ads Scraper

Developed by

Shahzeb Naveed

Shahzeb Naveed

Maintained by Community

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

5

67

21

Issues response

18 days

Last modified

4 months 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

  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

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy