New: Earn 20% as an AgentAlley affiliate. Share your link and earn on every sale you refer. Join now New: Earn 20% as an affiliate. Join now

Scrape competitor ads from Meta's Ad Library

Meta Ad Library Scraper

by gooseworks-ai · MIT license · ★ 1,220 on GitHub · updated Sep 21

Meta Ad Library Scraper cover

Scrape competitor ads from Meta's Ad Library (Facebook, Instagram, Messenger, Threads, WhatsApp). Search by company name, Facebook Page URL, or keyword.

---
name: meta-ad-scraper
description: Scrape competitor ads from Meta's Ad Library (Facebook, Instagram, Messenger, Threads, WhatsApp). Search by company name, Facebook Page URL, or keyword. Returns ad creatives, spend estimates, reach, impressions, and campaign details. Use for competitive ad research, messaging analysis, and creative inspiration.
---

# Meta Ad Library Scraper

Scrape ads from Meta's Ad Library using the Apify `apify/facebook-ads-scraper` actor. Covers Facebook, Instagram, Messenger, Threads, and WhatsApp.

## Quick Start

Requires `APIFY_API_TOKEN` env var (or `--token` flag). Install dependency: `pip install requests`.

```bash
# Search ads by company name
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "Nike"

Overview

Scrape ads from Meta's Ad Library using the Apify apify/facebook-ads-scraper actor. Covers Facebook, Instagram, Messenger, Threads, and WhatsApp.

Manual install (npx, ZIP)
Claude Codenpx skills add gooseworks-ai/goose-skills --skill meta-ad-scraper -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/gooseworks-ai/goose-skills/tar.gz/615c685f34f8 \ | tar -xz -C ~/.claude/skills --strip-components=4 goose-skills-615c685f34f8/skills/ads/capabilities/meta-ad-scraper
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/737669060d04a0a2b9f0/meta-ad-scraper.zip" -OutFile "$env:TEMP\meta-ad-scraper.zip"; Expand-Archive "$env:TEMP\meta-ad-scraper.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md4.7 KB
  • skill.meta.json248 B
  • scripts/1 file · 8.1 KB
Read the files here
gooseworks-ai/615c6853 files
Shared references1SKILL.md reads these from elsewhere in the repo. Not in the ZIP.Get them on GitHub ↗
SKILL.md
Show the full text137 lines

Meta Ad Library Scraper

Scrape ads from Meta's Ad Library using the Apify apify/facebook-ads-scraper actor. Covers Facebook, Instagram, Messenger, Threads, and WhatsApp.

Quick Start

Requires APIFY_API_TOKEN env var (or --token flag). Install dependency: pip install requests.

# Search ads by company name
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "Nike"

# Search with country filter
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "Shopify" --country US

# Search by keyword (broader than company name)
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "project management software"

# Limit results
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "HubSpot" --max-ads 20

# Search by Facebook Page URL directly
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --page-url "https://www.facebook.com/nike"

# Only active ads (default), or all ads
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "Salesforce" --ad-status all

# Human-readable summary
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "Stripe" --output summary

How It Works

  1. Takes a company name, keyword, or Facebook Page URL
  2. Constructs a Meta Ad Library URL with the search query and filters
  3. Calls the Apify apify/facebook-ads-scraper actor via REST API
  4. Polls until the run completes, then fetches the dataset
  5. Parses and outputs ad data as JSON or human-readable summary

Resolving Company Name → Ads

The script handles the advertiser lookup automatically:

  • Company name: Constructs a search URL like facebook.com/ads/library/?q=CompanyName — the Apify actor searches Meta's Ad Library for matching advertisers
  • Page URL: If you have the Facebook Page URL, pass it via --page-url for exact matching
  • Domain: You can also pass a domain and the script will search for it

No need to manually find Page IDs. The Apify actor resolves the search internally.

CLI Reference

Flag Default Description
--company required* Company name or keyword to search
--page-url none Facebook Page URL for exact advertiser match
--country ALL 2-letter country code (US, GB, DE, etc.) or ALL
--ad-status active active or all (includes inactive)
--max-ads 50 Maximum number of ads to return
--output json Output format: json or summary
--token env var Apify token (prefer APIFY_API_TOKEN env var)
--timeout 300 Max seconds to wait for the Apify run

*Either --company or --page-url is required.

Output Fields

Each ad in the output contains:

{
  "ad_id": "123456789",
  "page_name": "Nike",
  "page_id": "123456789",
  "ad_text": "Just Do It. Shop the latest...",
  "ad_creative_link_title": "Nike.com",
  "ad_creative_link_description": "Free shipping on orders...",
  "ad_creative_link_url": "https://nike.com/...",
  "image_url": "https://...",
  "video_url": "https://...",
  "ad_delivery_start_time": "2026-01-15",
  "ad_delivery_stop_time": null,
  "currency": "USD",
  "spend_lower": 100,
  "spend_upper": 499,
  "impressions_lower": 1000,
  "impressions_upper": 4999,
  "platforms": ["facebook", "instagram"],
  "status": "ACTIVE"
}

Cost

~$5 per 1,000 ads scraped on Apify Free plan. Paid plans are cheaper ($3.40-$5/1K).

Common Workflows

1. Competitor Ad Research
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "Competitor Name" --country US --max-ads 100 --output summary
2. Industry Ad Landscape
# Search by keyword to see all advertisers in a space
python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
  --company "CRM software" --max-ads 50
3. Compare Multiple Competitors

Run the script multiple times for each competitor and compare creative approaches, messaging, and spend ranges.

Important Notes

  • EU/UK ads are most complete: Meta archives all ads shown in EU/UK. For US-only ads, coverage may be limited to political/issue ads.
  • Active vs All: By default only active ads are returned. Use --ad-status all to include historical ads.
  • Rate limits: Apify handles rate limiting internally. For large scrapes, increase --timeout.

Configuration

See references/apify-config.md for detailed API configuration, token setup, and rate limits.

1---
2name: meta-ad-scraper
3description: Scrape competitor ads from Meta's Ad Library (Facebook, Instagram, Messenger, Threads, WhatsApp). Search by company name, Facebook Page URL, or keyword. Returns ad creatives, spend estimates, reach, impressions, and campaign details. Use for competitive ad research, messaging analysis, and creative inspiration.
4---
5 
6# Meta Ad Library Scraper
7 
8Scrape ads from Meta's Ad Library using the Apify `apify/facebook-ads-scraper` actor. Covers Facebook, Instagram, Messenger, Threads, and WhatsApp.
9 
10## Quick Start
11 
12Requires `APIFY_API_TOKEN` env var (or `--token` flag). Install dependency: `pip install requests`.
13 
14```bash
15# Search ads by company name
16python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
17 --company "Nike"
18 
19# Search with country filter
20python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
21 --company "Shopify" --country US
22 
23# Search by keyword (broader than company name)
24python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
25 --company "project management software"
26 
27# Limit results
28python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
29 --company "HubSpot" --max-ads 20
30 
31# Search by Facebook Page URL directly
32python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
33 --page-url "https://www.facebook.com/nike"
34 
35# Only active ads (default), or all ads
36python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
37 --company "Salesforce" --ad-status all
38 
39# Human-readable summary
40python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
41 --company "Stripe" --output summary
42```
43 
44## How It Works
45 
461. Takes a company name, keyword, or Facebook Page URL
472. Constructs a Meta Ad Library URL with the search query and filters
483. Calls the Apify `apify/facebook-ads-scraper` actor via REST API
494. Polls until the run completes, then fetches the dataset
505. Parses and outputs ad data as JSON or human-readable summary
51 
52## Resolving Company Name → Ads
53 
54The script handles the advertiser lookup automatically:
55- **Company name**: Constructs a search URL like `facebook.com/ads/library/?q=CompanyName` — the Apify actor searches Meta's Ad Library for matching advertisers
56- **Page URL**: If you have the Facebook Page URL, pass it via `--page-url` for exact matching
57- **Domain**: You can also pass a domain and the script will search for it
58 
59No need to manually find Page IDs. The Apify actor resolves the search internally.
60 
61## CLI Reference
62 
63| Flag | Default | Description |
64|------|---------|-------------|
65| `--company` | *required** | Company name or keyword to search |
66| `--page-url` | none | Facebook Page URL for exact advertiser match |
67| `--country` | ALL | 2-letter country code (US, GB, DE, etc.) or ALL |
68| `--ad-status` | active | `active` or `all` (includes inactive) |
69| `--max-ads` | 50 | Maximum number of ads to return |
70| `--output` | json | Output format: `json` or `summary` |
71| `--token` | env var | Apify token (prefer `APIFY_API_TOKEN` env var) |
72| `--timeout` | 300 | Max seconds to wait for the Apify run |
73 
74*Either `--company` or `--page-url` is required.
75 
76## Output Fields
77 
78Each ad in the output contains:
79 
80```json
81{
82 "ad_id": "123456789",
83 "page_name": "Nike",
84 "page_id": "123456789",
85 "ad_text": "Just Do It. Shop the latest...",
86 "ad_creative_link_title": "Nike.com",
87 "ad_creative_link_description": "Free shipping on orders...",
88 "ad_creative_link_url": "https://nike.com/...",
89 "image_url": "https://...",
90 "video_url": "https://...",
91 "ad_delivery_start_time": "2026-01-15",
92 "ad_delivery_stop_time": null,
93 "currency": "USD",
94 "spend_lower": 100,
95 "spend_upper": 499,
96 "impressions_lower": 1000,
97 "impressions_upper": 4999,
98 "platforms": ["facebook", "instagram"],
99 "status": "ACTIVE"
100}
101```
102 
103## Cost
104 
105~$5 per 1,000 ads scraped on Apify Free plan. Paid plans are cheaper ($3.40-$5/1K).
106 
107## Common Workflows
108 
109### 1. Competitor Ad Research
110 
111```bash
112python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
113 --company "Competitor Name" --country US --max-ads 100 --output summary
114```
115 
116### 2. Industry Ad Landscape
117 
118```bash
119# Search by keyword to see all advertisers in a space
120python3 skills/meta-ad-scraper/scripts/search_meta_ads.py \
121 --company "CRM software" --max-ads 50
122```
123 
124### 3. Compare Multiple Competitors
125 
126Run the script multiple times for each competitor and compare creative approaches, messaging, and spend ranges.
127 
128## Important Notes
129 
130- **EU/UK ads are most complete**: Meta archives all ads shown in EU/UK. For US-only ads, coverage may be limited to political/issue ads.
131- **Active vs All**: By default only active ads are returned. Use `--ad-status all` to include historical ads.
132- **Rate limits**: Apify handles rate limiting internally. For large scrapes, increase `--timeout`.
133 
134## Configuration
135 
136See `references/apify-config.md` for detailed API configuration, token setup, and rate limits.
137 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 1,220
Checked
Source
gooseworks-ai/goose-skills ↗
Creator
gooseworks-ai · 206 listings
View creator

Made with meta-ad-scraper

Meta Ad Library Scraper — CleanShot 2026-07-13 at 20 16 54@2x (from the gooseworks-ai/goose-skills README)
Meta Ad Library Scraper — CleanShot 2026-07-13 at 20 16 54@2x (from the gooseworks-ai/goose-skills README)

by gooseworks-ai

Similar skills

See all →
SkillResearch what people actually say about any topicSTEP 0: STALE-CLONE SELF-CHECK — RUN BEFORE READING BELOWmvanhorn/last30days-skill · by mvanhornResearch what people actually say about any topic in the last 30 days. Pulls posts and engagement from Reddit, X, YouTube, TikTok, Hacker News, Polymarket, GitHub, and the web. Includes a doctor health check to diagnose broken or missing sources.★ 63.5k GitHub starsSkillScrapes social platforms, business dataApifydanielmiessler/LifeOS · by danielmiesslerScrapes social platforms, business data, and e-commerce via Apify actors — Instagram, LinkedIn, TikTok, YouTube, Facebook, Google Maps, Amazon, and web crawls — filtering in code. USE WHEN scrape Instagram, scrape LinkedIn, scrape TikTok, scrape YouTube, scrape Facebook, Google Maps leads, Amazon reviews, business intelligence, multi-platform social listening, competitive analysis, lead generation, social monitoring, Apify actors, web crawl, extract contacts. NOT FOR X/Twitter account operations like posting, threads, or bookmarks (those need a dedicated X API client), 4-tier progressive scraping with proxy escalation (use BrightData), or real-Chrome bot bypass and computer use (use Interceptor).★ 19.3k GitHub starsSkill微信公众号长文增长闭环 ——tsingyuai/growth-lab · by tsingyuai微信公众号长文增长闭环 —— 从读者问题与复刻锚选题、写出可验证的公众号长文、预览与合规检查、同步微信草稿、三重确认下受控发布,到回收阅读与转化数据并复盘。用户要求写公众号、把内容改成公众号、同步或发布微信草稿、查看公众号数据或复盘时使用。★ 2k GitHub starsSkillSearch and retrieve content from Twitter/XTwitter/X SkillReScienceLab/opc-skills · by ReScienceLabSearch and retrieve content from Twitter/X. Get user info, tweets, replies, followers, communities, spaces, and trends via twitterapi.io. Use when user mentions Twitter, X, or tweets.★ 1.8k GitHub starsSkillSays 'YouTube script', 'video script'🎬 YouTube Script: Writing retention-optimized video script...cwinvestments/memstack · by cwinvestmentsUse this skill when the user says 'YouTube script', 'video script', 'write script for YouTube', 'YouTube video outline', or is creating scripted content for a YouTube video with hooks, chapters, and CTAs. Do NOT use for TikTok/Reels short-form scripts or webinar presentations.★ 423 GitHub starsSkillAgent Reach — 互联网能力路由器Ootto-AI/claude-content-skills · by Ootto-AIMUST USE when user wants to 调研/research/搜索/search/查/找/look up anything on the internet — e.g. 全网调研 X / 帮我调研一下 X / 查一下 X / 搜搜 X / 看看大家怎么评价 X / X 上有什么讨论 / research this topic。 Also MUST USE when user mentions any platform or shares any URL/链接: 小红书/xiaohongshu/xhs, Twitter/推特/X, B站/bilibili, Reddit, V2EX, LinkedIn/领英/招聘/求职/jobs, YouTube, GitHub code search, 小宇宙播客, 雪球/股票行情, RSS feeds, or any web URL. 13 platforms, multi-backend routing (OpenCLI / per-platform CLIs / APIs). Zero config for 6 channels. Run `agent-reach doctor --json` to see which backend serves each platform right now. NOT for: 写报告/数据分析/翻译等内容加工(本 skill 只负责从互联网获取内容); 发帖/评论/点赞等写操作;已有专门 skill 的平台(先用专门 skill)。 【路由方式】SKILL.md 包含路由表和常用命令,复杂场景需按需阅读对应分类的 references/*.md。 分类:search / social (小红书/推特/B站/V2EX/Reddit) / career(LinkedIn) / dev(github) / web(网页/文章/RSS) / video(YouTube/B站/播客)。★ 139 GitHub stars

More from gooseworks-ai

SkillMine the highest-converting ad angles from customer reviewsAd angle minergooseworks-ai/goose-skills · by gooseworks-aiMine the highest-converting ad angles from customer reviews, Reddit complaints, support tickets, and competitor ads. Extracts actual pain language, competitor weaknesses, and outcome phrases that real buyers use. Outputs a ranked angle bank with proof quotes and recommended ad formats per angle.★ 1.2k GitHub starsSkillAnalyze ad campaign performance data to identify what'sAd campaign analyzergooseworks-ai/goose-skills · by gooseworks-aiAnalyze ad campaign performance data (Google, Meta, LinkedIn) to identify what's working, what's wasting budget, and specific cut/scale/test recommendations. Runs statistical analysis, funnel diagnostics, and multi-channel budget reallocation with specific dollar-amount shift recommendations and scenario modeling.★ 1.2k GitHub starsSkillFor paid lead-gen and participant-recruitment adsAd lead quality analyzergooseworks-ai/goose-skills · by gooseworks-aiFor paid lead-gen and participant-recruitment ads, replaces vanity CPA with true CAC per qualified lead by joining ad-platform data with downstream funnel events, surfaces tracking gaps, and classifies every creative into Scale / Keep / Investigate / Cut.★ 1.2k GitHub starsSkillAnalyze the message match between your ads and landing pagesAd to landing page auditorgooseworks-ai/goose-skills · by gooseworks-aiAnalyze the message match between your ads and landing pages. Checks if the promise in the ad copy carries through to the landing page headline, body, and CTA. Flags disconnects that kill conversion rates. Works with Google, Meta, and LinkedIn ads.★ 1.2k GitHub starsSkillCheck and improve your brand's visibility across AI searchAeogooseworks-ai/goose-skills · by gooseworks-aiCheck and improve your brand's visibility across AI search engines (ChatGPT, Perplexity, Gemini, Grok, Claude, DeepSeek). Set up tracking, run visibility analyses, audit your website for AI readability, and get actionable recommendations. Uses the npx goose-aeo@latest CLI.★ 1.2k GitHub starsSkillSearch Amazon products - find items, compare pricesAmazon Product Searchgooseworks-ai/goose-skills · by gooseworks-aiSearch Amazon products - find items, compare prices, read reviews★ 1.2k GitHub stars