Facebook Ad Library Scraper avatar

Facebook Ad Library Scraper

Pricing

from $1.90 / 1,000 results

Go to Apify Store
Facebook Ad Library Scraper

Facebook Ad Library Scraper

Find Facebook Ad Library ad and advertiser IDs for a keyword through Google Images results, without opening facebook.com. Returns the ad archive ID or Page ID and the Ad Library URL. No ad text, creatives, advertiser names, dates or impressions.

Pricing

from $1.90 / 1,000 results

Rating

0.0

(0)

Developer

ScrapeAI

ScrapeAI

Maintained by Community

Actor stats

0

Bookmarked

4

Total users

1

Monthly active users

9 days ago

Last modified

Features

Limited permissions

Share

Facebook Ad Library Scraper

Status (2026-11-14): works in the default Google Images mode; the optional Google web mode stays limited. Images mode returns Facebook Ad Library pages (individual ads and advertiser pages) with the ad archive ID or Facebook Page ID and the URL, but no advertiser name, ad text, creative or dates: Google's image results for these pages are only titled "Ad Library". It does not open facebook.com, and it returns far less than the Ad Library itself offers (see Limits).

Result sources (resultSource)

images (default)web (opt-in)
Google page readGoogle Images results of site:facebook.com/ads/library <words>Google web results of the same query
How the Ad Library URL is foundGoogle writes it in plain text next to every image result, so rows come back reliablyGoogle often writes it as an opaque redirect link (/goto?url=<token>), which this Actor never opens, so those results are skipped and a run can return few rows or none
Fields per rowad archive ID or Page ID, resultType, URL (advertiser rows also advertiser.pageId)the same, plus the advertiser name (from the title Ad Library - <name>) and Google's text snippet
Rows per Google requestone page lists 7 to about 35 Ad Library pages, depending on the query10 results, many of them skipped
dataOrigin of the rowgoogle-serp-imagesgoogle-serp

Where the data comes from

  • Each row is one Ad Library page that Google lists for a query such as site:facebook.com/ads/library delivery.
  • The Google pages are fetched through the Apify Proxy group GOOGLE_SERP, which serves Google Search results only. The only URL requested is http://www.google.com/search?... with default headers; no other Google path and no other website is ever requested.
  • Images mode reads two things from each image result: the landing page URL (Google's plain data-lpage attribute) and the image title (alt text, always just Ad Library, so no advertiser name is available). A URL with ?id=<number> is an ad (resultType: ad, adArchiveId); a URL with view_all_page_id=<number> is an advertiser page (resultType: advertiser, pageId). Other Ad Library pages (the API page, the report page, keyword searches) are skipped. The Google click-through links in the same markup are never read or followed.
  • The Ad Library URL is kept as Google lists it, because its filters (country, status, date range) decide what the page shows.
  • Every row says where it came from: dataOrigin is google-serp-images or google-serp.

Measured results

Measured on 2026-11-14 through GOOGLE_SERP (hl=en, gl=us), one request per page:

Query and pageResult
site:facebook.com/ads/library delivery, first page38 image results, 34 different Ad Library URLs: 32 single-ad or advertiser pages, plus the Ad Library API page and the report page, which are skipped
site:facebook.com/ads/library gym, first page8 image results, 7 different Ad Library URLs
the same query with start=20 and start=30no image results ("It looks like there aren't any Images matches"); start=10 got no answer within 90 seconds

Platform test run on 2026-11-14 (first Images-mode build 1.1.8, default input): coffee returned 17 rows (11 ads and 6 advertiser pages, all with different IDs) from the first Google page. That build then asked for a second page, which timed out twice (40 seconds each), and the run ended with the 17 rows.

Platform test runs on 2026-11-14 with the default input (build 1.1.9), each with one Google request:

KeywordRowsGoogle's page
pizza10 (6 ads, 4 advertiser pages)13 image results, 10 different Ad Library URLs
shoes35 (25 ads, 10 advertiser pages)41 image results, 35 different URLs
delivery32 (18 ads, 14 advertiser pages)38 image results, 34 different URLs (the API page and the report page were skipped)
furniture27 (18 ads, 9 advertiser pages)27 image results and URLs

For Argos and Booking.com the same kind of Google Images request returned further images for start=10 and start=20 with irregular overlap, and nothing after about 3 pages; a page with fewer than 100 image results was always the last one. Images mode therefore asks for the next page (start=10, then 20, ...) only while fewer than maxItems rows were found, the previous page was full (100 image results) and it still brought pages that had not been listed; it never repeats a request and never requests further pages after a short one. Ad Library queries return far fewer than 100 image results, so their first page is the only page; the timeout above is why a short page now ends the paging.

The web mode result on 2026-11-13 (three keywords): one returned 10 rows and two failed. On 2026-11-14 (build 1.1.9, gym, one page) all 10 results had opaque links and the run failed with a message that says so. Images mode replaced it as the default for that reason.

Why not facebook.com itself?

  • https://www.facebook.com/robots.txt disallows every path for generic crawlers (User-agent: *, Disallow: /) and states that collecting data from Facebook by automated means needs written permission. This was read once through the Apify datacenter proxy on 2026-11-13. Fetching Ad Library pages would therefore break the robots rules, whatever proxy is used.
  • Earlier runs of this Actor that requested the Ad Library page directly received HTTP 403.
  • The official Ad Library API needs an access token, which this Actor does not use.

Input

FieldMeaning
queryKeywords or an advertiser name, searched as site:facebook.com/ads/library <words>. Default delivery. Put several words in double quotes to require the exact phrase.
startUrlsOptional Ad Library search URLs. They are not requested; only their q= keyword becomes a Google query and replaces query.
resultSourceimages (default) or web, see the table above.
maxItems1 to 50 rows.
maxSearchPagesMost Google pages to read per query (every page is one billed GOOGLE_SERP request). Images mode reads a further page only while fewer than maxItems rows were found.
country, languageGoogle gl and hl values (they do not filter the Ad Library country). Default us and en.
proxyConfigurationMust use the Apify Proxy group GOOGLE_SERP (the default).

Output

One dataset item per Ad Library ad or advertiser page. Top level: dataOrigin, sourceUrl, itemUrl, id (ad archive ID or Page ID), title (as Google shows it: Ad Library - <name> in web mode, Ad Library in images mode), searchQuery, searchRank (position in the Google results), statusCode (status of the Google page), scrapedAt; web mode adds description (the snippet).

Inside data:

  • Images mode: id, resultType, url, and adArchiveId (single-ad URLs, resultType: ad) or pageId plus advertiser.pageId (advertiser URLs, resultType: advertiser). There is no advertiser name and no snippet.
  • Web mode: the same, plus advertiser.name and snippet when Google's result shows them.

Keyword-search URLs (?q=) have no ad or advertiser ID and are skipped. A value that Google does not show is absent, never estimated.

Limits

  • Only Ad Library pages that Google has indexed are returned, so a query returns a small, uneven sample of the library and two runs can differ. Some queries return only a handful of pages.
  • Not available: advertiser names (images mode), ad creatives (images and videos), ad text, start and end dates, platforms, impressions, spend ranges, targeting, page info beyond the Page ID, and any complete listing of an advertiser's ads.
  • The Store listing for this Actor describes the full Ad Library scraper; this version delivers only the Google-based subset described above.
  • Google may list fewer rows than requested; the run then returns what it found and fails only when nothing usable came back.
  • In web mode, results whose link is an opaque redirect are skipped, so the number of rows changes from run to run and can be zero. The Actor never requests a Google results page again to get a different link format: the only repeat is one retry after a timeout or connection error, and an HTTP error status or a verification page ends the run.
  • Google sometimes mixes other sites' pages into a site: query, and Ad Library keyword-search, API and report pages have no ad or advertiser ID. Those results are skipped (counted in RUN_SUMMARY).
  • Each Google page is billed by Apify Proxy, in addition to the per-result price.

Run locally

npm start

npm start reads this folder's input.json and needs APIFY_PROXY_PASSWORD for the GOOGLE_SERP group. Unit tests (parsing of saved Google pages, request rules, schema checks): npm test.