scrape-ads

Scrape Meta Ad Library ad metadata and media to CSV.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/clenisa/optimal-cli --skill scrape-ads
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scrape-ads
Source: https://github.com/clenisa/optimal-cli/tree/main/skills/scrape-ads
Command: npx skills add https://github.com/clenisa/optimal-cli --skill scrape-ads

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides an automated way to collect competitor ad data from the Facebook/Meta Ad Library so teams can analyze ad copy, spend, impressions, and creative metadata without manual browsing and copying.

Core Features & Use Cases

  • Headless Chromium scraping with anti-detection arguments and realistic user agent to reduce bot detection.
  • Batched processing with per-batch browser contexts and inter-company delays to mitigate rate limiting.
  • Two-stage extraction: DOM-based Library ID parsing with a fallback full-page text split to maximize data recovery.
  • Landing page URL resolution by extracting l.facebook.com redirect links and associating them with ads.
  • Outputs structured CSV rows per ad for competitor intelligence, ad spend monitoring, and marketing research workflows.
  • Use Case: Run a company list to harvest ad copy, start dates, status, impressions, spend, and landing URLs for competitive analysis dashboards.

Quick Start

Scrape the Meta Ad Library for State Farm and Allstate and save the results to ./ads.csv.

Frequently Asked Questions about scrape-ads

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scrape competitor ads from the Meta Ad Library at scale?

Scrape competitor ads from the Meta Ad Library at scale using a headless Chromium scraper applied to lists of companies. It extracts ad metadata, media, and landing page URLs using batched processing with delays to mitigate rate limiting and outputs structured CSV rows.

What data fields can I extract from the Facebook Ad Library for competitive research?

Extracted data fields from the Facebook Ad Library include ad copy, start dates, status, impressions, spend, and landing page URLs. The scraper resolves l.facebook.com redirect links and outputs structured CSV rows per ad for competitive analysis dashboards.

Do I need Playwright installed to scrape the Meta Ad Library?

Yes, you need Playwright with Chromium installed to scrape the Meta Ad Library. The scraper uses headless Chromium with anti-detection browser arguments and a realistic user agent to reduce bot detection during automated ad intelligence collection.

How does the scraper handle bot detection when extracting Facebook ad data?

The scraper handles bot detection when extracting Facebook ad data by using headless Chromium with anti-detection browser arguments, a realistic user agent, batched processing with per-batch browser contexts, and inter-company delays to mitigate rate limiting.

What happens if DOM parsing fails when scraping the Meta Ad Library?

If DOM parsing fails when scraping the Meta Ad Library, the scraper uses a two-stage extraction process with a fallback full-page text split to maximize data recovery and ensure ad metadata is still captured for CSV output.

Can I monitor competitor ad spend and impressions automatically with a web scraper?

Yes, you can monitor competitor ad spend and impressions automatically by running a web scraper against company lists. It harvests spend, impressions, and creative metadata from the Meta Ad Library and outputs structured CSV rows for ad spend monitoring workflows.