Facebook Ads Scraper avatar
Facebook Ads Scraper

Pricing

$5.00 / 1,000 Campaigns

Go to Store
Facebook Ads Scraper

Facebook Ads Scraper

apify/facebook-ads-scraper

Developed by

Apify

Maintained by Apify

Extract advertising data from one or multiple Facebook Pages. Get page details, reach estimates, publisher platforms, report count, number of impressions, ad IDs, timestamps, and more. Download Facebook ads data in JSON, CSV, and Excel and use it in apps, spreadsheets, and reports.

4.5 (11)

Pricing

$5.00 / 1,000 Campaigns

108

Monthly users

605

Runs succeeded

>99%

Response time

3.7 days

Last modified

15 hours ago

HN

Cannot get only a number of ads for certain period

Closed
hankeypoo opened this issue
10 days ago

I have a list of sites I want to scrap in Facebook Ads Library. The task is to get the amount of ads for certain period for certain site. I used this JSON for input:

{ "onlyTotal": true, "startUrls": [ { "url": "https://www.facebook.com/drmartens", "startDateFormatted": "2024-03-01T07:00:00.000Z", "endDateFormatted": "2024-08-31T07:00:00.000Z" } ], "resultsLimit": 99999, "activeStatus": "" }

But with it I receive only the whole amount of ads for all periods possible. Is it possible to convert the json input for my request? If so, how to fix it?

alexey avatar

Hi!

You need to compose direct URL like https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&is_targeted_country=false&media_type=all&search_type=page&start_date[min]=2025-03-01&start_date[max]&view_all_page_id=110998592305221

The actor should be able to mimic all filters applied on Ad LIB UI, so we will not re-add the same support as separate input options

You will need view_all_page_id before getting the ads per page, 110998592305221 for https://www.facebook.com/drmartens available either from the Facebook Pages actor or from this actor.

So you will need two steps:

  1. Run(s) to get the page ID from the page name or URL
  2. Crafted URL(s) with modified start_date[min]=2025-03-01&start_date[max]&view_all_page_id=110998592305221

I will close the issue now, but if there is anything else we can help with, please let us know.

HN

hankeypoo

8 days ago

Hi! Thank you for an advice! I've tried this way using Facebook Pages actor. Unfortunately, I cannot receive right id. For example, for https://www.facebook.com/drmartens parameter "pageId" i receive value 100070208630156 instead of 110998592305221. I've searched for other parameters indicating 110998592305221 value, but did not find anything. Could you please advice where to find 110998592305221? Maybe I missed something in my input request or simply doing something wrong with my output?

alexey avatar

Hi!

Run https://console.apify.com/view/runs/bcyFV8AQLiiSAXbRE In the dataset https://api.apify.com/v2/datasets/AZJDEJcRBUeqMtF1s/items?clean=true&format=json

1"pageAdLibrary": {
2    "is_business_page_active": false,
3    "id": "110998592305221"
4  }

Pricing

Pricing model

Pay per result 

This Actor is paid per result. You are not charged for the Apify platform usage, but only a fixed price for each dataset of 1,000 items in the Actor outputs.

Price per 1,000 items

$5.00