Facebook Ads Scraper avatar

Facebook Ads Scraper

Try for free

Pay $5.00 for 1,000 Campaigns

Go to Store
Facebook Ads Scraper

Facebook Ads Scraper

apify/facebook-ads-scraper
Try for free

Pay $5.00 for 1,000 Campaigns

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.

Do you want to learn more about this Actor?

Get a demo
PN

The data was obtained repeatedly.

Closed

panpanpandas opened this issue
19 days ago

I used the following parameters to obtain the data, but found that the returned data is duplicated.

1{
2  "activeStatus": "active",
3  "isDetailsPerAd": false,
4  "onlyTotal": false,
5  "resultsLimit": 100,
6  "startUrls": [
7    {
8      "url": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&is_targeted_country=false&media_type=all&search_type=page&view_all_page_id=83353586320",
9      "method": "GET"
10    }
11  ]
12}

Here is the data report: https://api.apify.com/v2/datasets/A0jKtixo8Qqgddegr/items?clean=true&format=json&limit=1000

For example, the text "There’s a latte to love this holiday season with the delicious sweetness of Gramma Nutt Latte and Gramma Nutt Cold Brew with Hazlenut Cold Foam and salted toffee topping!" appears many times in the dataset, but in reality, there is only one instance of it.

alexey avatar

Hi!

I checked by adArchiveId and its different ads:

https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&id=1270134520709520&is_targeted_country=false&media_type=all&search_type=page&view_all_page_id=83353586320

https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=ALL&id=2795204787306704&is_targeted_country=false&media_type=all&search_type=page&view_all_page_id=83353586320

You can check the rest by replacing id=1270134520709520 with values of adArchiveId

For scraping the actor just follow internal Facebook logic - if there are ads with the same content (snapshot) but different id each ad will be saved as a separate dataset item

In the list https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&is_targeted_country=false&media_type=all&search_type=page&view_all_page_id=83353586320 its clearly expressed that "92 ads use this creative and text" so if you do not want all the ads please consider option to get only totals.

I´m going to close the issue now, but if there is anything else we could help with, please let us know.

PN

panpanpandas

16 days ago

Thank you!

I tried using the totalCount option, but it only returned 30 pieces of data. I want to get more data, and the effect should be consistent with the page, that is, no duplicate ads should appear. What should I do?

PN

panpanpandas

16 days ago

I tried using collationId for deduplication, and found that after deduplication, only 14 pieces of data remained out of 200. Is there any way to improve this situation?

alexey avatar

Hi!

Please try deduplication with the transform function https://console.apify.com/view/runs/6WnNrkIphpoQnPQ8U

(items) => items.map(x => ({ ...x, collationId: x.collationId || x.adArchiveID })) to keep snapshots with the same content as unique dataset items and not to lose single ads without collation id.

PN

panpanpandas

16 days ago

Sorry, I couldn't find where to use this function. Could you please provide a screenshot?

PN

panpanpandas

16 days ago

Do you mean to first use this actor to obtain the data, and then use another actor to filter the data?

PN

panpanpandas

16 days ago

Could you please add an option to return the filtered data directly?

alexey avatar

Hi!

Sorry for the confusion, I thought you already tried https://apify.com/lukaskrivka/dedup-datasets

Full JSON input for the shared run:

1{
2  "appendDatasetIds": false,
3  "batchSizeLoad": 50000,
4  "datasetIds": [
5    "A0jKtixo8Qqgddegr"
6  ],
7  "fields": [
8    "collationId"
9  ],
10  "nullAsUnique": false,
11  "output": "unique-items",
12  "parallelLoads": 10,
13  "parallelPushes": 5,
14  "preDedupTransformFunction": "(items) => items.map(x => ({ ...x, collationId: x.collationId || x.adArchiveID }))",
15  "uploadBatchSize": 500,
16  "verboseLog": false,
17  "mode": "dedup-after-load",
18  "outputTo": "dataset"
19}

Please paste it, then switch to visual input form and you will see when each input parameter appears.

Generally, we try not to add unique features if alternative actor-to-actor integration exists.

alexey avatar

Hi again, I'm going to close this issue for now, but if there's still anything unclear, please, let us know. We appreciate customer feedback!

Developer
Maintained by Apify

Actor Metrics

  • 319 monthly users

  • 75 stars

  • >99% runs succeeded

  • 2.4 days response time

  • Created in Apr 2023

  • Modified 6 days ago