Black-Friday Black-Friday
logo

Facebook Ads Data Scraper - Scrape Facebook Advertising Data

RealdataAPI / facebook-ads-scraper

Easily Scrape advertising data from one or multiple Facebook Pages with the Facebook Ads Data Scraper. Obtain page details, reach estimates, publisher platforms, report count, number of impressions, ad IDs, timestamps, and other helpful information. The data can be downloaded in JSON, CSV, and Excel formats for use in various applications, spreadsheets, and reports. This tool is available in several countries, including Australia, Canada, Germany, France, Singapore, the USA, the UK, the UAE, and India.

What is Facebook Ads Data Extractor?

It is a powerful and straightforward actor that allows you to extract Facebook ads data like reach estimates, page information, publisher platform, report analytics, and more. To collect that data, place the page link and click on the save and start option.

Why extract Facebook ads data?

It will help you in market research, trend monitoring, competitor intelligence, social media study, brand sentiment, etc.

How to use Facebook Ads Scraper?

We've designed this scraper to collect Facebook ads data to quickly start the process even if you are beginning to scrape the data. Here is the process to scrape information using this API.

  • Create a free Real Data API account with your email.
  • Open Facebook ads data scraper on our platform.
  • Place multiple URLs of Facebook pages to scrape ad data.
  • Click the Start button and allow some time for the scraper to get you the required data.
  • Export the data in any usable format of your choice.

Note that this actor shows the scraped outputs only at the end of execution. While running, the scraper won't update outputs. You can allow the scraper to finish the execution to see the output.

Input

It would help if you fed the input to this scraper as below.

  • URL of the page like https://www.facebook.com/drive4quantix/
  • Or the URL of the advertisement, like https://www.facebook.com/ads/library/?active_status=all&ad_type=all&coun try=ALL&q=%7B%7D&sort_data[direction]=desc&sort_data[mode]=relevan cy_monthly_grouped&start_date[min]=2022-10- 12&start_date[max]=&search_type=keyword_unordered&media_type=vid You can get a longer URL in the ads library of Facebook. Before pasting the link, mention filters, settings, and amounts per page.
  • Keep in mind that zero scrolls reflect the first few ad sets. Every scroll can deliver 30 advertisements. Facebook restricted the maximum number of ads shown per page, so you may not see all the ads.

Open the input tab to see the JSON example.

{
  "startUrls": [
    { "url": "https://www.facebook.com/AndrejBabis" }
  ],
  "scrollsAmount": 4
}
Output

This mini-actor will give you dataset outputs. You can select any format to download them, like Excel, CSV, HTML, JSON, etc. To get a JSON dataset, follow the above input parameters.

[{
  "adid": "0",
  "adArchiveID": "686299683225424",
  "archiveTypes": [
    1
  ],
  "categories": [
    1
  ],
  "collationCount": 1,
  "collationID": 1794991554233513,
  "currency": "CZK",
  "endDate": 1673337600,
  "entityType": "regular_page",
  "fevInfo": {
    "authorized_entity_text": "This information was submitted by the advertiser.",
    "email": "prchal@anobudelip.cz",
    "phone": "+420602346701",
    "website": "http://www.anobudelip.cz/",
    "submitted_on": "Submitted May 3, 2019",
    "address": "Babická 2, Praha 4 14000, CZ",
    "fec_additional_info": null,
    "learn_more_content": {
      "help_center_text": "Visit the Help Center to learn about what we require from advertisers to run ads about social issues, elections or politics.",
      "help_center_url": "https://www.facebook.com/help/180607332665293?ref=infosheet",
      "learn_more_text": "Learn more"
    },
    "free_form_additional_info": {
      "committee_id": null,
      "cnpj_or_cpf": null,
      "director_name": null,
      "ec_certificates": [],
      "gst_number": null,
      "point_of_contact": null,
      "treasurer_name": null,
      "agent_name": null,
      "corporate_purpose": null,
      "promoter_name": null
    },
    "page_admin_additional_info": null,
    "page_name_additional_info": null
  },
  "gatedType": "eligible",
  "hasUserReported": false,
  "hiddenSafetyData": false,
  "hideDataStatus": "NONE",
  "impressionsWithIndex": {
    "impressionsText": "10K - 15K",
    "impressionsIndex": 10
  },
  "isActive": false,
  "isProfilePage": false,
  "pageID": "214827221987263",
  "pageInfo": null,
  "pageIsDeleted": false,
  "pageName": "Andrej Babiš",
  "politicalCountries": [
    "CZ"
  ],
  "reachEstimate": "500K - 1M people",
  "reportCount": null,
  "snapshot": {
    "ad_creative_id": "23853021782190015",
    "cards": [],
    "body_translations": {},
    "byline": "ANO",
    "caption": null,
    "cta_text": null,
    "dynamic_item_flags": {},
    "dynamic_versions": null,
    "edited_snapshots": [],
    "effective_authorization_category": "POLITICAL",
    "event": [],
    "extra_images": [],
    "extra_links": [],
    "extra_texts": [],
    "extra_videos": [],
    "instagram_shopping_products": [],
    "display_format": "text",
    "title": null,
    "link_description": null,
    "link_url": null,
    "page_welcome_message": null,
    "images": [],
    "videos": [],
    "creation_time": 1673253887,
    "page_id": 214827221987263,
    "page_name": "Andrej Babiš",
    "page_profile_picture_url": "https://scontent-atl3-2.xx.fbcdn.net/v/t39.35426-6/324236805_550621033654724_1514405251265970155_n.jpg?stp=dst-jpg_s60x60&_nc_cat=100&ccb=1-7&_nc_sid=cf96c8&_nc_ohc=jSU-CXHG9wkAX_A3nLA&_nc_ht=scontent-atl3-2.xx&oh=00_AfCw2tGNp6ndic-bGa4OBkE8bi1VRqGG1NnzzFJ0_lV2fw&oe=63C3C8BC",
    "page_categories": {
      "1700": "Politician"
    },
    "page_entity_type": "regular_page",
    "page_is_profile_page": false,
    "instagram_actor_name": "",
    "instagram_profile_pic_url": "",
    "instagram_url": "",
    "instagram_handle": "",
    "is_reshared": false,
    "version": 3,
    "body": {
      "context": {},
      "markup": {
        "__html": "NEVINEN! Jsem velmi rád, že máme nezávislou justici a soud potvrdil, co jsem od začátku tvrdil. Že jsem nevinný a nic nezákonného jsem neudělal."
      },
      "callerHash": "28f7aabaed78ac1e72dad4d68c033c9f"
    },
    "brazil_tax_id": "",
    "branded_content": null,
    "current_page_name": "Andrej Babiš",
    "disclaimer_label": 1,
    "page_like_count": 252691,
    "page_profile_uri": "https://www.facebook.com/AndrejBabis/",
    "page_is_deleted": false,
    "root_reshared_post": null,
    "cta_type": null,
    "additional_info": {
      "treasurer_name": null,
      "director_name": null,
      "point_of_contact": null,
      "committee_id": null,
      "phone_number": "+420602346701",
      "email": "prchal@anobudelip.cz",
      "website": "www.anobudelip.cz",
      "street_address_1": "Babická 2",
      "street_address_2": null,
      "city": "Praha 4",
      "state": null,
      "zipcode": "14000",
      "corporate_purpose": null
    },
    "ec_certificates": null,
    "country_iso_code": "CZ",
    "instagram_branded_content": null
  },
  "spend": "CZK900 - CZK999",
  "startDate": 1673251200,
  "stateMediaRunLabel": null,
  "publisherPlatform": [
    "facebook"
  ],
  "menuItems": [],
  "endDateFormatted": "2023-01-10T08:00:00.000Z",
  "startDateFormatted": "2023-01-09T08:00:00.000Z",
  "totalCount": 1070
},
...

Note: you'll see the start and end dates below in the ISO value format. startDateFormatted: "2022-10-12T07:00:00.000Z" and endDateFormatted: "2022- 10-12T07:00:00.000Z".

What is the cost of using a Facebook Ads scraper?

Suppose you use this scraper on the Real Data API platform for result-oriented Facebook data extraction. In that case, you need residential proxy servers in the monthly personal plan of Real Data API, which is around 50 USD per month.

To know more about how we offer pricing, proxies and usages, and platform credits, check the pricing page on our platform.

Do you want to collect Facebook groups or comments data?

If you want to collect detailed Facebook data, we've dedicated a scraper for them below.

  • Facebook Groups Scraper
  • Facebook Reviews Scraper
  • Facebook Comments Scraper
  • Facebook Photos Scraper
Facebook Ads scraper with Integrations

Lastly, you can connect this actor with any web application or cloud service with Real Data API integrations. You can connect with Slack, Zapier, GitHub, Make, Google Drives, Airbyte, Google Drive, etc.

You can also use Webhooks to commence the action at the time of the event, like getting an alert in the successful execution of this API.

Using Facebook Ads Scraper with the Real Data API

The Real Data API allows you to access actors programmatically. It also allows you to use datasets, track API performances, generate results, update and develop versions, etc. To use the actor in Python, use our client PyPl package, and to use in Node.js, use our client NPM package.

See the Real Data API actor reference document for details, or open the API tab for codes.

Can I extract Facebook Ads data legally?

We follow all the rules and regulations to maintain ethics and don't scrape any private data like location, gender, or email ids of personal accounts. But the scraped data may contain some personal information unintentionally, so be aware and don't scrape any personal data without genuine reason.

You can consult advocates if you are confused about whether your reason is legal.

Industries

Check out how industries are using Facebook Ads Scraper around the world.

E-Commerce-&-Retail

eCommerce & Retail

Marketing-Media

Marketing & Media

Fintech-Insurance

Fintech & Insurance

You should have a Real Data API account to execute the program examples. Replace <YOUR_API_TOKEN> in the program using the token of your actor. Read about the live APIs with Real Data API docs for more explanation.

import { RealdataAPIClient } from 'RealDataAPI-Client';

// Initialize the RealdataAPIClient with API token
const client = new RealdataAPIClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare actor input
const input = {
    "startUrls": [
        {
            "url": "https://www.facebook.com/drive4quantix/?ref=page_internal"
        }
    ],
    "scrollsAmount": 0,
    "proxyConfig": {
        "useRealdataAPIProxy": true,
        "RealdataAPIProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

(async () => {
    // Run the actor and wait for it to finish
    const run = await client.actor("RealdataAPI/facebook-page-ads").call(input);

    // Fetch and print actor results from the run's dataset (if any)
    console.log('Results from dataset');
    const { items } = await client.dataset(run.defaultDatasetId).listItems();
    items.forEach((item) => {
        console.dir(item);
    });
})();
from RealdataAPI_client import RealdataAPIClient

# Initialize the RealdataAPIClient with your API token
client = RealdataAPIClient("<YOUR_API_TOKEN>")

# Prepare the actor input
run_input = {
    "startUrls": [{ "url": "https://www.facebook.com/drive4quantix/?ref=page_internal" }],
    "scrollsAmount": 0,
    "proxyConfig": {
        "useRealdataAPIProxy": True,
        "RealdataAPIProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the actor and wait for it to finish
run = client.actor("RealdataAPI/facebook-page-ads").call(run_input=run_input)

# Fetch and print actor results from the run's dataset (if there are any)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
# Set API token
API_TOKEN=<YOUR_API_TOKEN>

# Prepare actor input
cat > input.json <<'EOF'
{
  "startUrls": [
    {
      "url": "https://www.facebook.com/drive4quantix/?ref=page_internal"
    }
  ],
  "scrollsAmount": 0,
  "proxyConfig": {
    "useRealdataAPIProxy": true,
    "RealdataAPIProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
EOF

# Run the actor
curl "https://api.RealdataAPI.com/v2/acts/RealdataAPI~facebook-page-ads/runs?token=$API_TOKEN" /
  -X POST /
  -d @input.json /
  -H 'Content-Type: application/json'

Which Facebook page or ads do you want to extract?

startUrls Required Array

Links for the API, to begin with- you should use these category or product

How many per page scrolls do you want?

scrollsAmount Optional Integer

Each page ads scroll must have 30 advertisements where the count starts with zero.

I want to scrape only the full ads count on every page.

onlyTotal Optional Boolean

If you use this feature, you'll get only the total count of scrolls per page, where you'll get a single dataset per page as your output.

Proxy configuration

proxyConfig Optional Object

It would help if you had a proxy server to execute this scraper. You can use our residential proxies or your servers.

Max retries

maxRequestRetries Optional Integer

When scraping fails, get maximum retries.

{
  "startUrls": [
    {
      "url": "https://www.facebook.com/drive4quantix/?ref=page_internal"
    }
  ],
  "scrollsAmount": 0,
  "proxyConfig": {
    "useRealdataAPIProxy": true,
    "RealdataAPIProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxRequestRetries": 2
}