Skip to content

AnsKM/facebook-ads-intelligence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Facebook Ads Intelligence Platform

Crawlee Intelligence Score Safety First MIT License

Professional-grade competitive intelligence from Facebook Ads Library

Extract complete ad copy, analyze emotional triggers, and visualize competitive strategies


πŸš€ Features

Scraper Capabilities

  • βœ… Complete Ad Copy Extraction - 967+ words captured with 9 extraction strategies
  • βœ… Emotional Intelligence Analysis - Detect fear, greed, urgency, social proof triggers
  • βœ… Strategic Positioning Detection - Identify premium, value, innovation positioning
  • βœ… Multi-Platform Support - Facebook, Instagram, Messenger, Audience Network
  • βœ… Anti-Detection System - Stealth mode, human behavior simulation, session management
  • βœ… Media Download - High-quality images and video thumbnails
  • βœ… Bulk Processing - Process multiple competitors efficiently

Web Dashboard Features

  • πŸ“Š Interactive Visualizations - Charts, timelines, and heatmaps
  • πŸ” Advanced Filtering - By date, platform, triggers, advertiser
  • πŸ“ˆ Competitive Analysis - Side-by-side comparisons
  • πŸ’‘ AI-Powered Insights - Pattern detection and recommendations
  • πŸ“± Responsive Design - Works on all devices
  • πŸ’Ύ Export Options - PDF reports, CSV data, JSON backups
  • πŸŒ™ Dark Mode - Easy on the eyes

πŸ“Έ Screenshots

View the live demo at: https://YOUR_USERNAME.github.io/facebook-ads-intelligence/demo.html

Screenshot coming soon - dashboard shows emotional trigger analysis, timeline charts, and ad gallery

πŸ› οΈ Installation

Prerequisites

  • Node.js 18+
  • Chrome/Chromium browser
  • 2GB+ RAM recommended

Quick Start

# Clone the repository
git clone https://github.com/AnsKM/facebook-ads-intelligence.git
cd facebook-ads-intelligence

# Install dependencies
cd scraper
npm install

# Set up environment
cp .env.example .env
# Edit .env with your preferences

# Run the scraper (safe mode)
npm run start:safe -- 105168211848225

# Launch the web dashboard
cd ../webapp

# Option 1: Auto-detect server
./start-server.sh

# Option 2: Node.js (no dependencies)
node server.js

# Option 3: Python
python3 server.py

# Option 4: Docker
docker-compose up

# Visit http://localhost:8080

πŸ–₯️ Running Locally

The webapp includes multiple server options with zero dependencies:

  1. Node.js Server (server.js) - Built-in modules only
  2. Python Server (server.py) - Standard library only
  3. Docker Container - Production-ready Nginx
  4. Auto-Selector (start-server.sh) - Picks best option

See webapp/README.md for detailed server documentation.

🎯 Usage

Scraping Competitors

# Basic usage - single competitor
node scraper/src/index.js <PAGE_ID>

# With URL
node scraper/src/index.js "https://www.facebook.com/ads/library/?view_all_page_id=123456"

# Test mode (10 ads max)
npm run start:test -- <PAGE_ID>

# Production mode with all safety features
npm run start:safe -- <PAGE_ID>

Finding Page IDs

  1. Visit competitor's Facebook page
  2. View Page Transparency β†’ See All
  3. Go to Ad Library
  4. The URL contains view_all_page_id=XXXXXXXXX

Web Dashboard

  1. Upload Data: Drag & drop JSON export or use file picker
  2. Explore: Browse ads with filters and search
  3. Analyze: View insights and competitive intelligence
  4. Export: Generate reports in PDF/CSV format

πŸ“Š Data Intelligence

What You Can Extract

Category Data Points Intelligence Value
Copy Headlines, body text, CTAs Messaging strategy
Emotional Fear, greed, urgency triggers Psychological tactics
Strategic Positioning, objectives Market approach
Creative Images, videos, formats Visual strategy
Performance Runtime, platforms Campaign insights
Funnel Landing pages, offers Conversion tactics

Emotional Trigger Detection

Triggers Analyzed:
- Fear: "miss out", "mistake", "fail"
- Greed: "save", "profit", "free"  
- Trust: "proven", "certified", "guaranteed"
- Urgency: "limited", "expires", "now"
- Social Proof: "million users", "everyone"

⚠️ Safety & Ethics

Rate Limiting

  • 3-8 second delays between requests
  • Maximum 30 requests per minute
  • Human-like scrolling and interaction

Detection Avoidance

  • Playwright with stealth plugin
  • Browser fingerprint randomization
  • Session persistence
  • Natural browsing patterns

Ethical Usage

  • βœ… Competitive research
  • βœ… Market analysis
  • βœ… Creative inspiration
  • ❌ Copying ads directly
  • ❌ Violating Terms of Service
  • ❌ Excessive scraping

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 β”‚     β”‚                  β”‚     β”‚                 β”‚
β”‚  Facebook Ads   │────▢│  Scraper Engine  │────▢│  JSON Export    β”‚
β”‚    Library      β”‚     β”‚  (Playwright)    β”‚     β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                           β”‚
                                                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 β”‚     β”‚                  β”‚     β”‚                 β”‚
β”‚  Web Dashboard  │◀────│  Analysis Engine │◀────│  Data Upload    β”‚
β”‚   (Browser)     β”‚     β”‚  (JavaScript)    β”‚     β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ˆ Performance

  • Success Rate: 95%+ data extraction
  • Speed: ~2-3 seconds per ad
  • Accuracy: 85% intelligence score
  • Safety: 0 bans with proper usage

🀝 Contributing

Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

Development Setup

# Install development dependencies
npm install --save-dev

# Run tests
npm test

# Lint code
npm run lint

# Build for production
npm run build

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

🚨 Disclaimer

This tool is for educational and research purposes only. Users are responsible for complying with Facebook's Terms of Service and applicable laws. The authors are not responsible for any misuse of this software.

πŸ“ž Support


Made with ❀️ for marketers and researchers

Star ⭐ this repo if you find it useful!

About

Professional-grade competitive intelligence from Facebook Ads Library

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors