← Resources

Tools

Facebook ad library scraper

Build it, buy it, or live without it. The real options for scraping the Facebook Ad Library, what breaks, what's legal, and why most teams stop building their own.

Updated

Scraping the Facebook Ad Library is the path every performance marketer eventually considers and most quietly abandon. The official Meta Ad Library API ships commercial-ad data only for the EU and Brazil, which leaves the rest of the world with a structural gap that scraping appears to solve. In practice the scraping path is harder, more fragile, and legally muddier than it looks - Meta rotates the DOM aggressively, adds CAPTCHA challenges to any unauthenticated automation, and pursues terms-of-service breach claims against commercial scrapers at scale. This guide walks the real options: building your own scraper (don't), using open-source projects (mostly broken), and paying for third-party tools that maintain the scrape layer professionally (the right answer for most teams).

DOM change cadence

Roughly every 3-6 weeks

Open-source scraper half-life

8-12 weeks before breakage

Paid third-party tools

$50-500/mo per seat

Walkthrough

How to use it, step by step

  1. 1

    First, check if the official API covers your use case

    Before going down the scraping path, confirm the official Meta Ad Library API at facebook.com/ads/library/api/ doesn't solve your problem. The API ships full commercial-ad data for the EU and Brazil; if your competitors run ads there, you can query their data through sanctioned channels without scraping. The API is free, requires business verification, and has a 200-call/hour rate limit. If your competitors run ads only in non-covered regions (US, UK, Canada, Australia, most of APAC), the API won't help and you'll need to choose between building or buying scraping infrastructure.

    Multinational brands often run in EU markets even if their primary market is US. Query their EU-targeted ads through the API and use them as a proxy for global creative strategy - imperfect but sanctioned.
  2. 2

    Survey the open-source scraper landscape

    There's a long tail of open-source Facebook Ad Library scrapers on GitHub - typically Python or Node.js projects using Selenium, Playwright, or direct HTTP requests against the library's internal endpoints. They mostly work for 6-12 weeks after their last commit, then break on a DOM change or a new CAPTCHA challenge. Stars on GitHub are not a reliable freshness signal; check the issues tab for recent breakage reports before depending on any open-source project. Most popular projects have abandonment timelines you can read from the commit history.

    Search GitHub for 'facebook ad library' and sort by 'Recently updated' rather than 'Most stars'. The recently-updated projects are the ones still working today; the most-starred projects are often historical successes that have since broken.
  3. 3

    Evaluate the build-vs-buy math honestly

    Building your own scraper means: writing the initial scraper (1-2 engineering weeks), handling Meta's DOM changes (~1-3 days per change, every 3-6 weeks), maintaining proxy rotation to avoid IP blocks (ongoing), solving CAPTCHA challenges (~$0.001-0.003 per solve via 2Captcha or similar), and absorbing the legal exposure of operating against Meta's terms of service. Buying a tool means: $50-500/mo for tools like Foreplay, Atria, Motion, AdSpy, or Minea that maintain the scraping infrastructure professionally and resell access. For most teams the buy decision is obvious once they cost out the maintenance burden of building.

    If you're a vendor building a product that itself depends on Facebook Ad Library data, scraping infrastructure becomes a core competency and the build case is stronger. If you're an in-house marketing team using the data for competitive research, buy.
  4. 4

    Pick the right paid scraper based on your use case

    Foreplay is the most popular swipe-file tool - strong UI, AI-assisted hook tagging, $99-499/mo. Atria is a Foreplay competitor with similar coverage and slightly different tagging taxonomy, $79-399/mo. Motion focuses on creative analytics and performance attribution alongside scraping, $300+/mo. AdSpy is older, more enterprise-tier, $149/mo+, with deep historical archive. Minea is European-headquartered and strong on EU coverage, €49-299/mo. Pick based on coverage geography, tagging quality, and integration needs (most tools have CSV export; some have API access).

    Free trials at Foreplay and Atria let you test coverage on your specific competitors before committing. Run a 7-day trial against your top 5 competitors and confirm the tool has all their ads before signing the annual contract.
  5. 5

    If you must build - use Playwright with proxy rotation

    If the build case actually makes sense for your team, start with Playwright (better than Selenium for modern JavaScript-heavy sites like the Ad Library), residential proxy rotation (Smartproxy, Bright Data, or Oxylabs), and a CAPTCHA-solving service (2Captcha or Anti-Captcha). Plan for: a scraper module that renders the search results page, paginates through results, extracts ad metadata, follows the snapshot URL to extract media, and stores everything in your data layer. Budget 1-2 engineering weeks for v1 and a recurring 1-3 days per Meta DOM change.

    Run scrapers in concurrent batches across multiple proxies and accounts to spread the IP-block risk. Single-IP scrapers get blocked within hours; distributed scrapers can run for weeks before any one IP gets flagged.
  6. 6

    Handle Meta's anti-automation defenses

    Meta has three layers of defense against scrapers: CAPTCHA challenges on any unusual access pattern (high request rate, repeat requests from same IP, headless browser fingerprints); IP blocks at the network level (typical block duration: 24-72 hours per IP); and DOM obfuscation (the result-page DOM structure changes every 3-6 weeks, breaking selectors). To survive all three: rotate IPs aggressively, randomize request timing, use undetected browser configurations (undetected-chromedriver or stealth Playwright plugins), and write resilient selectors that depend on stable patterns rather than fragile DOM paths.

  7. 7

    Manage the legal exposure

    Scraping the Facebook Ad Library violates Meta's terms of service. There is established case law - notably *hiQ Labs v. LinkedIn* (Ninth Circuit, 2022) - supporting that scraping publicly accessible data is not a CFAA violation in the US. But Meta can and does pursue terms-of-service breach claims against commercial scrapers, send cease-and-desist letters, and IP-block at scale. The exposure is real but manageable for low-volume internal research; it's substantial for vendors building commercial products on scraped data. If you're a vendor, get legal advice before commercializing.

    Foreplay, Atria, Motion, and similar paid tools have all received and weathered cease-and-desist activity from Meta - the industry exists despite the legal friction. They've engineered around the operational risks (proxy diversity, distributed infrastructure, etc.); replicating that engineering is the unstated cost of self-built scraping.

Cheatsheet

Filters that matter

FilterWhat it doesWhen to use
Country (in scraper queries)Restricts scraped results to a single country's library partition.Always set - the library partitions by country, and unspecified queries default unreliably.
Page ID anchoringScrapes only ads from a specific Facebook Page ID rather than broad keyword search.Default for competitive monitoring - far cleaner than keyword-based scraping.
Active status filterLimits to currently-delivering ads vs paused or stopped.Set Active for benchmarking; Inactive for historical archive building.
Media type filterNarrows to Image / Video / Carousel.Filter at scrape time rather than post-process - cuts scrape volume and rate-limit pressure.
Date range filterLimits to ads started in a specific date window.Incremental scrapes - 'ads started in the last 24 hours' rather than full re-scrapes daily.
Snapshot URL extractionPulls the snapshot URL from each ad to enable media capture from the rendered page.Always include - the snapshot URL is your jumping-off point for capturing the actual creative.

What it won't tell you

The gaps

  • Meta DOM changes break scrapers every 3-6 weeks

    The library's DOM structure rotates aggressively. Selectors that worked yesterday break today; ad-card layouts, pagination structure, and filter parameters all change without notice. Open-source scrapers typically have an 8-12 week half-life before requiring significant rework. Paid tools maintain dedicated engineering teams to absorb this churn; self-built scrapers absorb it directly into your roadmap.

  • CAPTCHA challenges escalate with volume

    Low-volume scraping (a few hundred ads per day from a single IP) often runs without CAPTCHA. Higher volume triggers escalating challenges - text CAPTCHA at first, then image-recognition, then audio CAPTCHA. Solving services like 2Captcha cost $0.001-0.003 per solve and add latency. At meaningful scale CAPTCHA solving becomes a real cost line.

  • IP blocks are aggressive

    Single-IP scrapers get blocked within hours of detection. Even residential proxy rotation requires ongoing diversity - if you rotate among the same 100 IPs for months, the entire pool eventually gets fingerprinted. Premium residential proxy services (Smartproxy, Bright Data, Oxylabs) run $300-2000/mo for the IP diversity needed to survive sustained scraping.

  • Media capture requires snapshot-page rendering

    The Ad Library doesn't expose direct URLs for ad images and videos in its data layer. To capture actual creative you have to render the snapshot page (a separate page per ad), extract the embedded media URL, and download. Rendering pages is slow (1-3 seconds per ad) and bandwidth-intensive. Most paid tools cache the media; self-built scrapers need their own caching layer to avoid re-rendering.

Shuttergen

Skip the scraper maintenance - audit competitors directly.

Shuttergen sweeps the Facebook Ad Library for your competitor set without you maintaining proxy infrastructure, CAPTCHA solvers, or DOM-change updates. The scraping layer is our problem.

Why scraping looks attractive and isn't

Every performance marketer who works with the Facebook Ad Library hits the same wall. The manual UI is slow (30-50 ads per session before fatigue). The official API doesn't cover commercial ads outside the EU and Brazil. Paid third-party tools cost $50-500/mo per seat and feel expensive when you're starting out. Scraping looks like the obvious middle path - free, programmatic, covers any geography, surely a weekend project.

The reality is closer to a part-time job. Meta's anti-automation defenses are extensive: DOM rotation every 3-6 weeks, CAPTCHA escalation at volume, IP blocks at the network layer, browser-fingerprinting detection that breaks naive headless setups. A scraper that ships on Monday works for the rest of the week, slows down across the next month, and is broken by the second DOM rotation. Maintaining it costs roughly 1-3 days of engineering time per cycle, every 3-6 weeks, indefinitely.

The legal layer is real but manageable. *hiQ Labs v. LinkedIn* (Ninth Circuit, 2022) established that scraping publicly accessible data does not violate the Computer Fraud and Abuse Act in the US. But Meta can and does pursue separate terms-of-service breach claims, send cease-and-desists, and block IPs aggressively. For low-volume internal research the exposure is manageable. For vendors building commercial products on scraped data, the legal cost is non-trivial and worth getting actual legal advice on before launch.

The paid third-party tool market

There's a mature ecosystem of paid tools that maintain Facebook Ad Library scrapers professionally and resell access. The top tier in 2026: Foreplay ($99-499/mo) is the most popular swipe-file tool with strong UI and AI-assisted hook tagging. Atria ($79-399/mo) is a Foreplay competitor with similar coverage and a different tagging taxonomy. Motion ($300+/mo) combines scraping with creative analytics and performance attribution. AdSpy ($149/mo+) is older, enterprise-tier, with the deepest historical archive. Minea (€49-299/mo) is European-headquartered with strong EU coverage.

All of these tools have weathered cease-and-desist activity from Meta. They've engineered around the operational risks: distributed proxy infrastructure, paid CAPTCHA-solving services, dedicated engineering teams handling DOM changes, and a layer of resilience that takes years to build. Replicating that infrastructure internally is genuinely expensive - probably 2-4 engineering FTE-equivalents in maintenance alone for a serious commercial scraper.

The economic math: a tool subscription at $200-400/mo pays for itself almost immediately if it saves 4-8 hours of marketer time per month versus manual UI review. Building your own is rarely cheaper unless you're a vendor whose product itself depends on the scraped data as core infrastructure.

Skip the scraper maintenance - audit competitors directly. Shuttergen sweeps the Facebook Ad Library for your competitor set without you maintaining proxy infrastructure, CAPTCHA solvers, or DOM-change updates. The scraping layer is our problem.

Audit competitors free

When building your own scraper actually makes sense

Three scenarios where the build case is genuinely strong. Vendor product infrastructure: if you're building a SaaS product whose core value proposition includes Facebook Ad Library data, the scraping layer is core infrastructure and you can't reliably outsource it - you need control over coverage, latency, and data shape that third-party tools won't give you. Custom data shape requirements: if your use case needs data the paid tools don't surface (specific metadata extraction, unusual filtering combinations, integration into a custom data pipeline), building gives you the flexibility paid tools lack. Hostile geography coverage: if your competitive landscape sits in markets the paid tools don't cover well (some APAC and African markets are underserved), you may need to extend coverage yourself.

Two scenarios where the build case looks attractive but isn't. Cost optimization for internal use: the $200-400/mo paid tool cost is almost always cheaper than the engineering time of maintaining a self-built scraper. Avoiding terms-of-service exposure: building your own scraper does not reduce ToS exposure - if anything it concentrates it on your team rather than distributing it across a paid vendor's customer base. The hiQ Labs precedent applies to both paths.

If you're going to build, start with Playwright (better than Selenium for modern JavaScript-heavy sites), residential proxy rotation, a CAPTCHA-solving service, and budget 1-2 engineering weeks for v1 plus 1-3 recurring days per Meta DOM change. Plan for the ongoing maintenance as a fixed cost line, not a one-time investment.

How scraping is changing in 2026

Two trends worth tracking. First, Meta's anti-automation defenses have gotten meaningfully stronger since mid-2024. The DOM rotation cadence accelerated from roughly quarterly to every 3-6 weeks. CAPTCHA challenges now appear at lower request volumes than they did in 2023. Browser fingerprinting detection catches naive headless setups that used to slip through. The build-it-yourself path has gotten harder, not easier, year over year.

Second, the paid tool market has consolidated and matured. Foreplay raised growth-stage funding in 2024 and expanded coverage significantly. Atria did the same in 2025. Motion launched a self-serve tier that opened the lower end of the market. AdSpy was acquired by a larger martech conglomerate in late 2025. The result: better products at a wider price range, easier evaluation flows, and meaningfully lower friction to buying than three years ago. The pragmatic recommendation has shifted further toward buy-don't-build over the past two years.

Looking forward, expect Meta's defenses to keep accelerating - the company has both compliance reasons (preventing abuse of regulatory data) and competitive reasons (limiting third-party intelligence on Meta-resident advertisers) to invest in anti-scraping infrastructure. The official API will probably remain narrow in commercial coverage. The paid tool ecosystem will remain the de facto path for serious users.

Internal: Foreplay deep dive, Atria deep dive, Motion deep dive cover the leading paid scrapers in detail.

FAQ

Frequently asked

Is scraping the Facebook Ad Library legal?
Scraping publicly accessible data does not violate the US Computer Fraud and Abuse Act per the hiQ Labs v. LinkedIn precedent (Ninth Circuit, 2022). But it violates Meta's terms of service. Meta can pursue ToS breach claims, send cease-and-desists, and IP-block scrapers. Low-volume internal research has manageable exposure; commercial products built on scraped data should get legal advice first.
What's the best Facebook Ad Library scraper in 2026?
For most teams, a paid third-party tool: Foreplay ($99-499/mo) for swipe files and AI hook tagging; Atria ($79-399/mo) as a Foreplay competitor; Motion ($300+/mo) for scraping plus performance analytics; AdSpy ($149+/mo) for enterprise-tier historical archive. Building your own is rarely worth the maintenance burden unless you're a vendor whose product depends on the scraped data as core infrastructure.
Can I scrape the Facebook Ad Library for free?
Technically yes via open-source projects on GitHub, but most have an 8-12 week half-life before breaking on a Meta DOM change. Maintaining a free scraper means absorbing 1-3 days of dev time per Meta update cycle, every 3-6 weeks. The $50-200/mo entry-tier paid tools are almost always cheaper than the labor cost of maintaining a free scraper.
How does the Facebook Ad Library API compare to scraping?
The API is sanctioned, free, and rate-limited at 200 calls/hour/token. Its big limitation is that commercial-ad coverage is only available for the EU and Brazil; outside those regions you get political ads only. Scraping covers any geography but exposes you to ToS violations, DOM rotation, CAPTCHA challenges, and IP blocks. Use the API where it covers you; scrape (or use paid tools) elsewhere.
Does Meta sue Facebook Ad Library scrapers?
Meta has sent cease-and-desist letters to commercial scrapers and pursued ToS breach claims against high-volume offenders. Outright lawsuits are rare but have happened - Meta sued Bright Data in 2023 for scraping Facebook and Instagram. The pattern is escalating cease-and-desists rather than immediate litigation, but the legal exposure for commercial scrapers is real.
What's the best programming language for building a Facebook Ad Library scraper?
Python with Playwright is the most common modern stack. Node.js with Playwright is comparable. Selenium-based scrapers work but lose to Playwright on modern JavaScript-heavy sites. Direct HTTP scraping against internal endpoints is fragile - Meta rotates internal endpoints faster than rendered DOM. Plan for the headless-browser path.
How often does Meta change the Facebook Ad Library DOM?
Every 3-6 weeks on average, with smaller changes monthly. The cadence accelerated from roughly quarterly to every 3-6 weeks since mid-2024. Self-built scrapers need to budget 1-3 days of engineering time per cycle for selector updates. Paid tools absorb this maintenance directly.

Related

Keep reading

Sources

Skip the scraper maintenance - audit competitors directly.

Shuttergen sweeps the Facebook Ad Library for your competitor set without you maintaining proxy infrastructure, CAPTCHA solvers, or DOM-change updates. The scraping layer is our problem.