Facebook Ad Library Scraper (Playwright) avatar

Facebook Ad Library Scraper (Playwright)

Pricing

from $10.00 / 1,000 results

Go to Apify Store
Facebook Ad Library Scraper (Playwright)

Facebook Ad Library Scraper (Playwright)

Scrape ads from Meta Ad Library using Playwright. Intercepts GraphQL responses for structured data extraction. No API key or Facebook account required.

Pricing

from $10.00 / 1,000 results

Rating

0.0

(0)

Developer

Admo Solutions

Admo Solutions

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

6 days ago

Last modified

Categories

Share

Facebook Ad Library Scraper

Scrape ads from Meta's public Ad Library using Playwright. Supports two modes: keyword search and Facebook page scraping. Extracts comprehensive ad data including page IDs, URLs, CTA details, platforms, and carousel cards — no API key or Facebook account required.

Why use this Actor?

  • Two scraping modes — Search by keyword OR scrape ads from Facebook page URLs
  • No API key required — Uses the public Ad Library website
  • Relay cache extraction — Parses embedded GraphQL data from page source for complete field coverage
  • Residential proxy support — Built-in proxy rotation for reliable scraping
  • Deduplication — Automatically deduplicates by ad archive ID
  • Structured output — Clean JSON dataset with full ad metadata
  • Self-contained — No external Actor dependencies

How to use

Mode 1: Search by keyword

  1. Enter a search term (e.g., "skincare", "fitness coaching", "SaaS")
  2. Optionally set a country code (e.g., "US", "IN", "GB")
  3. Run the Actor

Mode 2: Scrape ads from Facebook pages

  1. Add Facebook page URLs to the "Facebook Page URLs" field
  2. Optionally set a country code
  3. Run the Actor

Supported URL formats:

  • https://www.facebook.com/ZapierApp
  • https://www.facebook.com/profile.php?id=123456
  • facebook.com/YourPage

Input

FieldDescriptionDefault
Search TermsKeywords to search in Ad Library (search mode)"skincare"
Page URLsFacebook page URLs to scrape ads from (page mode)[]
Country CodeISO 2-letter country code"US"
Ad TypeFilter by ad category"ALL"
Active StatusFilter by active/inactive"ACTIVE"
Max ItemsMaximum ads to extract100
Max ScrollsScroll iterations20
Scroll DelayDelay between scrolls (ms)2000

Output

Each ad contains:

FieldDescriptionSource
adArchiveIdUnique ad identifierRelay cache
pageIdFacebook page IDRelay cache
pageNameAdvertiser page nameRelay cache
pageUrlAdvertiser Facebook page URLRelay cache
bodyAd text contentRelay cache
titleAd headlineRelay cache
linkUrlCTA destination URLRelay cache
ctaTextCTA button text (e.g., "Learn more")Relay cache
ctaTypeCTA type (e.g., "LEARN_MORE", "SHOP_NOW")Relay cache
startDateWhen the ad started running (Unix timestamp)Relay cache
isActiveWhether the ad is currently activeRelay cache
platformsWhere the ad runs (Facebook, Instagram, etc.)Relay cache
mediaTypeAd format (image, video, carousel, text)Relay cache
snapshotAdditional metadata (categories, likes, cards)Relay cache

Output Example

{
"adArchiveId": "1591671712123479",
"pageId": "108268605296897",
"pageName": "TikTok - US",
"pageUrl": "https://www.facebook.com/100083860366075/",
"body": "Fun awaits, no delays.",
"title": "{{product.name}}",
"linkUrl": "http://play.google.com/store/apps/details?id=com.zhiliaoapp.musically",
"ctaText": "Learn more",
"ctaType": "LEARN_MORE",
"startDate": 1774508400,
"isActive": true,
"platforms": ["FACEBOOK", "INSTAGRAM", "AUDIENCE_NETWORK", "MESSENGER", "THREADS"],
"mediaType": "carousel",
"snapshot": {
"pageCategories": ["Entertainment website"],
"pageLikeCount": 157244,
"cards": [{"title": "Treat yourself on TikTok.", "linkUrl": "https://www.tiktok.com/"}]
}
}

How it works

This Actor uses Playwright to load the Meta Ad Library page, then extracts ad data from the embedded Relay cache (serialized GraphQL data in the page source):

  1. Navigation — Loads the Ad Library search results page
  2. Relay cache extraction — Parses the embedded ad_library_main.search_results_connection.edges JSON from the page source
  3. Scrolling — Scrolls to load more ads and re-extracts from updated page source
  4. DOM fallback — If Relay cache extraction fails, falls back to DOM-based text parsing
  5. Deduplication — Deduplicates by ad archive ID

Tips

  • Use residential proxy for best results (Facebook blocks datacenter IPs)
  • Higher scroll count = more results but longer runtime
  • Start with 100 items to test, then increase as needed
  • Deduplication happens automatically by ad archive ID

Cost Estimation

This Actor runs Playwright browser automation. Typical costs:

  • 100 ads: ~$0.05-0.15 compute
  • 1000 ads: ~$0.50-1.50 compute
  • Proxy costs depend on your plan

Known Limitations

  • Facebook may block requests without residential proxy
  • Ad Library page structure changes may require updates to the Relay cache parser
  • Image/video URLs may be empty for some ad formats (carousel cards often lack direct image URLs in the cache)

Disclaimer

Our Actors are ethical and do not extract any private user data. They only extract what has been chosen to share publicly on the Meta Ad Library. We therefore believe that our Actors, when used for ethical purposes by Apify users, are safe. However, you should be aware that your results could contain personal data. Personal data is protected by the GDPR in the European Union and by other regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you're unsure whether your reason is legitimate, consult your lawyers.

Support

  • Having trouble? Open an Issue on the Actor page.
  • For programmatic access, see the API tab.