Facebook ad library scraper avatar
Facebook ad library scraper
Try for free

3 days trial then $30.00/month - No credit card required now

View all Actors
Facebook ad library scraper

Facebook ad library scraper

curious_coder/facebook-ads-library-scraper
Try for free

3 days trial then $30.00/month - No credit card required now

Scrape facebook ads search and ads run by facebook pages - Fast and lightweight

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "urls": [
11        {
12            "url": "https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=IN&q=linkedin&search_type=keyword_unordered&media_type=all"
13        },
14        {
15            "url": "https://www.facebook.com/ZapierApp"
16        }
17    ],
18    "scrapePageAds.activeStatus": "all",
19    "count": 100,
20    "proxy": {
21        "useApifyProxy": true,
22        "apifyProxyGroups": [
23            "RESIDENTIAL"
24        ]
25    }
26};
27
28(async () => {
29    // Run the Actor and wait for it to finish
30    const run = await client.actor("curious_coder/facebook-ads-library-scraper").call(input);
31
32    // Fetch and print Actor results from the run's dataset (if any)
33    console.log('Results from dataset');
34    console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
35    const { items } = await client.dataset(run.defaultDatasetId).listItems();
36    items.forEach((item) => {
37        console.dir(item);
38    });
39})();
40
41// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Developer
Maintained by Community
Actor metrics
  • 284 monthly users
  • 13 stars
  • 97.0% runs succeeded
  • 3.1 days response time
  • Created in Aug 2023
  • Modified 10 days ago