π Open Source β’ Vibe Coded β’ Community Driven
This project is built through iterative debugging, real-world testing, and community feedback. Every fix comes from actual Facebook DOM quirks discovered in the wild!
Export your Facebook comments and visualize them beautifully with our interactive thread viewer!
π Load your export at facebook-thread-viewer.lovable.app
β¨ Features:
- π¨ Beautiful nested comment visualization
- π Search and filter threads
- π Thread analytics and insights
- πΎ Load JSON exports directly in your browser
- π± Mobile-friendly responsive design
Simply export your comments using this scraper, then upload the JSON file to the viewer for a stunning visual representation!
- Install Extension: Tampermonkey (Chrome/Edge) or Greasemonkey (Firefox)
- Install Script: Click here to install the userscript
- Open any Facebook post with comments
- Click "Start Scraping" in the floating panel (top-right corner)
- Watch it work - automatically expands replies, detects nesting depth, highlights comments
- Auto-Export - JSON file downloads automatically when complete (no prompts!)
- π Visualize (optional) - Upload your JSON export to facebook-thread-viewer.lovable.app for beautiful interactive visualization!
That's it! π― The scraper handles nested replies, multi-level threads, and automatically downloads JSON - no clicking export buttons!
The Facebook Comment Scraper is a powerful userscript that enables you to scrape and export comments from Facebook posts, including full support for nested replies and hierarchical comment threads. It adds a floating interface to Facebook pages with automatic comment collection, depth detection, and export to both CSV and JSON formats.
- Automatic Comment Scraping: Automatically scrolls through and collects comments from Facebook posts
- Nested Reply Support: Full support for multi-level comment threads (replies to replies to replies...)
- Depth Detection: Multiple strategies to detect comment nesting depth
- Configurable Limit: Set a maximum number of comments to scrape (0 for unlimited)
- Real-time Statistics: Shows progress including main comments, replies, and depth distribution
- Auto-Download JSON: Automatically downloads JSON when scraping completes (no prompts!)
- Hierarchical Structure: JSON export preserves full parent-child relationships and thread nesting
- CSV Available: Manual CSV export option via browser console if needed
- Rich Data: Includes author name, profile URL, profile image, timestamp, likes, comment text, depth level, detection method
- Color-Coded Highlighting: Comments are highlighted by depth (red=main, orange=level 1, yellow=level 2, green=level 3+)
- Real-time Progress: Live updates showing extraction progress and data quality stats
- User-friendly Interface: Clean floating UI with easy-to-use controls
- Multiple Detection Strategies:
- DOM Hierarchy (nested article elements)
- Aria-label Pattern Matching ("Antwoord van..." / "Reply from...")
- Author Mention Links
- Visual Indentation
- Container Grouping
- Robust Author Extraction: Multiple fallback approaches to extract author names from various Facebook DOM structures
- Debug Mode: Built-in diagnostic logging for troubleshooting
- A browser with userscript support:
- Chrome/Edge: Install Tampermonkey
- Firefox: Install Greasemonkey or Tampermonkey
Click the button below to install the Facebook Comment Scraper:
- Install Tampermonkey or Greasemonkey for your browser
- Navigate to the raw userscript file
- Your userscript manager will prompt you to install it
- Click "Install" to add the script
- Navigate to any Facebook post (works on both www.facebook.com and m.facebook.com)
- You'll see a floating panel in the top-right corner of the page
- Set the maximum number of comments to scrape (or 0 for unlimited)
- Click "Start Scraping" to begin collecting comments
- The script will automatically:
- Expand comment sections
- Load more comments
- Expand replies (including nested replies)
- Detect comment depth and hierarchy
- Collect comprehensive comment data
- Download JSON export when complete (no additional clicks needed!)
- Watch the real-time statistics showing main comments, replies, and depth distribution
- The JSON file (
fb_modal_YYYY-MM-DD.json) downloads automatically to your browser's download folder - Check the browser console (F12) for detailed statistics and logs
The exported files include:
- Author Name: Commenter's display name
- Profile URL: Link to commenter's Facebook profile
- Profile Image: URL to profile picture
- Comment Text: Full comment content
- Timestamp: When the comment was posted
- Likes: Number of reactions
- Depth: Nesting level (0=main comment, 1=direct reply, 2=reply to reply, etc.)
- Detection Method: How the depth was determined
- Hierarchical Structure: Nested replies under parent comments
- Parent ID: Reference to parent comment
- Reply To Author: Name of the author being replied to
- π Auto-download JSON export - No more confirmation dialogs! JSON downloads automatically when scraping completes
- β Stats logged to console instead of alert dialogs
- β Cleaner UX - no interruptions, just automatic export
- π Initial public release on GitHub!
- β Multi-level nested reply detection (DOM hierarchy + aria-label patterns)
- β Dual export formats: CSV (flat) and JSON (hierarchical)
- β Color-coded depth visualization
- β Robust author extraction with multiple fallback strategies
- β Profile link handling (supports query parameters)
- β Smart name filtering (handles Dutch/English, timestamps, special characters)
- β Support for both "Opmerking" (Comment) and "Antwoord" (Reply) aria-labels
- β Real-time scraping statistics and progress tracking
- β Debug mode for troubleshooting
- β Automatic depth detection using 5 different strategies
- Requires comments to be loaded in the Facebook modal/dialog
- Facebook's dynamic DOM structure may require periodic updates
- Very large comment threads (1000+ comments) may take time to process
- Facebook rate limiting may affect scraping speed
Enable debug mode by setting window.DEPTH_DEBUG = true in the browser console before scraping. This will output detailed logs about:
- Depth detection strategies used
- Author extraction attempts
- DOM structure analysis
- Parent-child relationship matching
The userscript includes automatic update checks. Your userscript manager will notify you when a new version is available.
Found a bug? Facebook changed their DOM structure again?
This is an opensource, vibe-coded project - every fix comes from real-world testing! Feel free to:
- Report issues with specific Facebook posts
- Share console output for debugging
- Submit fixes for edge cases
- Suggest improvements
Rick - r.bouma@disrex.nl
Current version: 1.1
Open Source - Built with community feedback and iterative debugging! π