Facebook Ads Scraper 2022: How to Scrape Facebook Ads Library

Are you looking for the best web scrapers to use to scrape Facebook Ads? Then you are on the right page as we would be providing you recommendations on Thebes Facebook ads scrapers in the market and a guide on how to develop a custom Facebook scraper if you are a coder.

best Facebook Ads web scraper

Facebook Ads is one of the most popular paid marketing channels businesses, politicians, and ideology sellers use to reach their audience and as far as the statistic suggest, Facebook Ad is a success. One thing you will come to like about Facebook Ad is that it is transparent in nature in the sense that there is a centralized library where you can search for all of the ads that have been shown on Facebook and their information.

This library known as the Facebook Ad Library is the one-stop hub for all of the ads on Facebook and as such, if you need to extract Facebook ads of your competitors for competitive analysis, or even study ads that are performing, then this is the best hub for it.

While this library exists, Facebook does not provide an easy-to-use free API that you can use to filter and download only the ads you need – the library is meant to be used online for most people and not furnish you with data. So if you must extract the data, you must do that on your own.

Unfortunately, trying to manually extract data from tens and even hundreds of ads can be tasking, inefficient, and error-prone. But with the help of Facebook ads scraping, it becomes efficient and easy. In this article, we would be recommending some of the best Facebook ads scrapers in the market and also guide you on how to create your own.

Facebook Ads Scraping – an Overview

Facebook Ads Scraping Overview

Facebook Ads scraping is the process of using computer bots known as web scrapers or more specifically, Facebook Ads scrapers to automatically extract Facebook ads from the Facebook Ad Library. The method is simple – the web scraper visits the page, masquerading as a web browser to query the search tool for the specific ads it needs to scrape after which it extracts them and saves them.

One thing you will come to like about this method is that because it is carried out by a bot in an automated manner, it is very fast and can scrape thousands of ads in minutes. It is also the best method you can collect Facebook Ads since there is no free API that you can use for such.

One thing you will need to know is that Facebook does not support the use of web scrapers on its platform. If you are caught using a web scraper, then you will get blocked – and if you are logged into your account, then the account might get suspended. So, you will need to carry out your scraping task in a stealthy way that you will not be identified as using a web scraper.

There are methods that web scrapers integrate to make themselves undetectable to the Facebook anti-spam system which you can integrate into your own web scraper. The good thing about scraping Facebook Ads is that even though Facebook does not support it, it is generally considered legal.

How to Scrape Facebook Ads Using Python and Selenium

Scrape Facebook Ads Using Python and Selenium

This section has been written for those with programming skills. If you know you cannot code, then move to the next section and make a choice from the list of web scrapers you can use for scraping the Facebook ad Library without writing a single line of code.

Coding a Facebook Ads scraper is not a difficult thing to do provided you know how to code. All you need to deal with is the automation aspect and then the anti-block features to integrate to avoid getting blocked while carrying out the scraping task. In this guide, we would be making use of the Python programming language as it is the easiest you can use to scrape Facebook Ads.

Unlike scraping regular Facebook content that you can do without having Javascript enabled and as such, can use the duo of Requests and Beautifulsoup, you will need to have Javascript enabled to be able to access the Facebook Ad Library as it requires Javascript execution and rendering. For that reason, a framework or library for rendering Javascript is the tool for the job.

For Python programmers, the Selenium web driver is the framework for the job as it has been developed to automate web browsers – and you can use such power for scraping data from modern web pages that act as applications because of their Javascript-rich features. You can visit the official Selenium website for its documentation and guidance on how to use it.

To avoid blocks, you need to integrate certain measures. Facebook uses IP tracking to detect an unusual number of requests coming from a single IP in other to block such IP addresses. To bypass this, all you need is to use high-quality residential proxies. I will recommend you use proxies from either Bright Data or Smartproxy as they are some of the best at remaining undetectable to the Facebook anti-spam system since the system can detect and block proxies.

If you are going to be sending many requests then I would advise you set random delays between requests, switch user agent string, and use the referer header too. You will also need a captcha solver if you start getting blocked by captchas too.

  • Sample Code for Scraping Facebook Ads

We would be showing you a sample code for scraping Facebook ads from the Facebook Ad Library. The code will use the selenium web driver which is not included in the python standard library. You will have to use the pip install selenium code to install selenium. The browser we would be automating is Google Chrome and as such, we need to download and place the driver for Chrome in the same folder as our script. You can download the driver for your Chrome version here. Unzip it and place it in the same folder as your script for it to work. To better understand how to use Selenium, read the Selenium documentation here.

import time

from selenium import webdriver

class FBAdsScraper:

def __init__(self, country, keyword):

self.country = country

self.keyword = keyword

self.ads = []

self.driver = webdriver.Safari()

def scrape_ads(self):




ads = self.driver.find_element_by_class_name("_9cb_").find_elements_by_tag_name("div")

for ad in ads[:2]:

title = ad.find_element_by_class_name("dgpf1xc5").text

status = ad.find_elements_by_class_name("qku1pbnj")[0].text

end_date = ad.find_elements_by_class_name("qku1pbnj")[1].text

ad_details = {"title": title,

"status": status,

"end_date": end_date,





x = FBAdsScraper("US", " web scraping")


Best Facebook Ads Scrapers in the Market

The above is for coders. However, not all coders would want to reinvent the wheel or even have what it takes. If you are looking for a Facebook Ads scraper to use then this section is for you. We would be recommending both Facebook scrapers you can use if you are a non-coder as well as the scrapers for coders. The first web scraper (Apify) is for coders while the remaining 4 are for non-coders.

Apify Facebook Ads Scraper

Apify Logo

  • Pricing: Starts at $49 per month for 100 Actor compute units
  • Free Trials: Starter plan comes with 10 Actor compute units
  • Data Output Format: JSON
  • Supported OS: Cloud-based – accessed via API

APify Facebook Ads Scraper

One of the easiest ways to scrape Facebook Ads as a coder is to use the Apify Facebook Ads scraper. With this tool, all you need to worry about is just making sure you are using proxies that are undetectable to Facebook which from the above, we recommended Bright Data and Smartproxy as the providers of choice. This Facebook scraper is an already-made scraper for Facebook Ads built on top of the Apify platform using the Apify SDK.

You can run it locally or on the Apify platform. With this actor, you can scrape data from the Facebook Ads global database. It has support for extracting ads ID, end date, advertiser, and many other details. It supports filtering by advertiser, country, and even keywords, among others.

PhantomBuster Facebook Ads Library Scraper

Phantom Buster

  • Pricing: Starts from $30 monthly – 1 hour daily – 5 Phantom slots
  • Free Trials: Freemium plan
  • Data Output Format: CSV, JSON,
  • Supported Platform: Cloud, Desktop

Phantom Buster Facebook Ads Library Scraper

The Phantombuster platform providers code-free automation and data extraction for everyone. They have got support for a good number of websites and services including scraping of Facebook Ads. The scraper is known as the Facebook Ads Library scraper which you can use to scrape the ads published by a Facebook page. With this, you can keep an eye on your competitor and know what they are doing.

This web scraper is available as a browser extension. It has support for both Chrome and Firefox. It is via either of these extensions that you will connect to Facebook, provide the information for the Facebook page, and get the required data scraped for you without writing a single line of code.


Octoparse Logo

  • Pricing: Starts at $75 per month
  • Free Trials: 14 days of free trial with limitations
  • Data Output Format: CSV, Excel, JSON, MySQL, SQLServer
  • Supported Platform: Cloud, Desktop 

Octoparse Best Scrapers

Octoparse is one of the popular web scrapers among non-coders because of its visual scraping tool. What this tool does is that it provide you with a point and click interface to identify some of the data of interest and then it automatically identify similar elements. This web scraper can be used to scrape Facebook ads and with just a few clicks, you can convert a good number of Facebook Ads into a structured spreadsheet.

Aside from Facebook, you can use Octoparse to scrape all kinds of websites as it can deal with infinite scrolling, AJAX, login, and drop-downs, among others. The Facebook ads it scrapes can be downloaded as either CSV, Excel, JSON, or saved to a database online.


Parsehub Logo

  • Pricing: Free with a paid plan
  • Free Trials: Free – advance features come at an extra cost
  • Data Output Format: Excel, JSON,
  • Supported Platform: Cloud, Desktop

Parsehub Homepage

ParseHub is the web scraper to use for scraping Facebook ads if you do not have a budget for a scraper. Yes, ParseHub is a free web scraper that comes with basic scraping features for you to use. If you want access to its advanced features, you will need to opt-in for their paid plan. Even though it is a free tool, it is one of the best web scrapers out there.

Just like Octoparse, it is also a visual scraping tool. With this web scraper installed on your computer, all you need to scrape any web page is to open the web page, click on an element to select the data you want to scrape, and then download the result.


WebHarvy Best Scrapers Logo

  • Pricing: Freemium
  • Free Trials: Freemium
  • Data Output Format: CSV, XLSX, and JSON
  • Supported Platform: Browser extension (Chrome and Firefox)

WebHarvy Best Scrapers

The WebHarvy web scraping tool is last on our list of recommended web scrapers for scraping Facebook Ad Library. It is a generic web scraper that you can use to scrape any website. With this web scraper, you can scrape text, HTML, images, URLs, and even emails from any website. Being a generic web scraper, it has support for scraping Facebook ads.

It even comes with a built-in scheduler which you can use to monitor the Ad Library if a new ad has been published by the Facebook page you are watching. One thing you will come to like about this tool is its advanced features which include Javascript support, image scraping, regular expression, and even automating web tasks which make it the perfect web scraper for Facebook ads.


Without the Facebook Ad Library, it would have been difficult for us to keep a tab on Facebook ads published by certain publishers or marketers. But having access to the library is not enough, you need a tool that can help you extract ads in an efficient manner and Facebook ads scrapers are the tool for the job.

From the above, you can see that there are a good number of options available to you if what you want is an already-made web scraper you can use out of the box.


Popular Proxy Resources