Meta Ad Library Scraper

Scrape competitor ads from Meta's Ad Library (Facebook, Instagram, Messenger, Threads, WhatsApp).

How to use it

  1. Hit Copy the whole skill.
  2. Claude: ⋯ → Download .md, then Customize → Skills → Add → Upload skill.
    ChatGPT: make a Project and paste it into Instructions.
    Neither? Paste it at the top of a new chat — it works for that chat.
  3. Describe your job in plain words. The AI follows the skill from there.
Claude Code — installs the whole folder, not just SKILL.md
npx degit gooseworks-ai/goose-skills/skills/ads/capabilities/meta-ad-scraper#main ~/.claude/skills/meta-ad-scraper

For one project only, change the path to .claude/skills/meta-ad-scraper.

Not working?
  • Check which app you pasted it into — the steps above name the right one.
  • Some skills need the paid tier of Claude or ChatGPT.
Step-by-step guide with screenshots · Ask in the forum

Paste into Claude, ChatGPT or Cursor.

Show the full text137 lines
meta-ad-scraper/SKILL.md137 lines4.7 KBpushed 96d agoRawView on GitHub

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 

Discussion

Alternatives

Also in Posting & scheduling
Linkedin comment drafterDraft a LinkedIn comment on someone else's post from its URL, or reshare (repost) it to your feed with optional commentary. Use when the user pastes a post URL and asks to comment, engage, be first commenter, or repost with their thoughts. Produces 1-3 variants in the user's voice, picks a reaction, and publishes via Publora on approval. Not for replying to existing comments (use linkedin-reply-handler).Marketing · MITLinkedin content plannerGenerate a 7-day LinkedIn content plan from a theme, audience, and pillars. Produces per-day post pillar, format, hook type, CTA, posting time, daily comment targets, and a weekly inbound-readiness check. Use when the user wants to plan a week or month of content, not draft a single post (use linkedin-post-writer).Marketing · MITLinkedin employee advocacyStand up and run a LinkedIn employee advocacy program for a marketing or sales team. Covers 14-day launch playbook, brand-guideline governance, per-post time budget, cadence benchmarks, and team ROI (reach, engagement, pipeline). Triggers on "employee advocacy", "get the team posting", "scale LinkedIn across team", "advocacy ROI". Not for planning one person's own calendar (use linkedin-content-planner).Marketing · MITInstagram Audience InsightsRead your Instagram niche and profile from real data via Apify, no login. Scan a hashtag for the posts traveling now (likes, comments, owner) to see the format and hook that works. Pull profile stats for any handle, yours or a competitor's: followers, posts, bio, category. Instagram hides who liked or commented on other accounts, so this is discovery plus profiles, not engagers. Triggers on "what works in my niche", "scan the hashtag", "competitor stats". Not for writing captions (use ig-caption-writer).Marketing · MIT