Curatenie referinte pre-livrare: - inlocuit IP intern 10.11.10.18 cu hostname didi.integrare.local (extensie, docker-compose, .env.example) - inlocuit domeniu vechi didi365.eu cu didi.integrare.local (scripturi build/audit) - redenumit identificatorul aplicatiei Android eu.didi365.mobile -> didi.mobile Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| auth.js | ||
| background.js | ||
| build.sh | ||
| config.js | ||
| content.css | ||
| content.js | ||
| generate_icons.html | ||
| generate_icons.py | ||
| history.css | ||
| history.html | ||
| history.js | ||
| icon.svg | ||
| icon16.png | ||
| icon32.png | ||
| icon48.png | ||
| icon128.png | ||
| manifest.json | ||
| popup.css | ||
| popup.html | ||
| popup.js | ||
| README.md | ||
| render.js | ||
| SNIPPING_TOOL_GUIDE.md | ||
| TESTING.md | ||
DIDI Content Extractor - Browser Extension
Professional browser extension for extracting structured content from social media posts.
🎯 Features
Platform-Specific Extraction
- Facebook: Clean extraction with intelligent text filtering and primary image detection
- Twitter/X: Tweet-specific extraction with proper content identification
- LinkedIn: Coming soon
- Custom Websites: Future OCR-based extraction
Smart Content Detection
- Post Container Detection: Walks DOM tree to find exact post boundaries
- Author Extraction: Multiple selector patterns for reliable author identification
- Text Filtering: Removes UI noise (Like, Comment, Share buttons, etc.)
- Primary Image: Extracts main image only (200x200px minimum, excludes icons/emojis/profile pics)
- Metadata: Timestamp and post URL extraction
Content Types
text- Text only postsimage- Image only poststext+image- Combined content poststext+video- Coming soonvideo- Coming soon
📦 Installation
- Open Chrome/Edge and navigate to
chrome://extensions - Enable Developer mode (top right toggle)
- Click Load unpacked
- Select the
browser-extensionfolder - Extension installed!
🚀 Usage
Facebook Extraction
- Navigate to Facebook
- Click extension icon
- Click "Activate Selection Mode" under Facebook tab
- Hover over any post (entire post highlighted with blue border)
- Click to extract content
- View extracted content in popup
- Click "💾 Save" to store for later
Twitter/X Extraction
- Navigate to Twitter/X
- Click extension icon
- Click "Activate Selection Mode" under X/Twitter tab
- Hover over any tweet (entire tweet highlighted)
- Click to extract content
- View and save as above
Saved Extractions
- Switch to "Saved" tab to view all saved content
- "👁️ View" - View full details
- "📋 Copy" - Copy JSON to clipboard
- "🗑️ Delete" - Delete individual item
- "Clear All" - Remove all saved extractions
📊 Data Structure
{
platform: 'facebook' | 'twitter',
type: 'text' | 'image' | 'text+image',
author: 'Author Name',
text: 'Post content...',
image: {
url: 'https://...',
width: 1200,
height: 800,
alt: 'Description'
},
timestamp: '2024-01-15T10:30:00',
postUrl: 'https://facebook.com/...',
extractedAt: '2024-01-15T10:35:00.000Z'
}
🏗️ Architecture
Platform Extractors
FacebookExtractor
- Post Detection:
[role="article"]containers - Author:
h2 a[role="link"],h3 a[role="link"] - Text:
div[dir="auto"][style*="text-align"]with UI noise filtering - Image: Primary image detection (excludes icons/emoji/profiles)
- Metadata: Timestamp from
a[aria-label*="ago"], URL from permalinks
TwitterExtractor
- Tweet Detection:
article[data-testid="tweet"]containers - Author:
[data-testid="User-Name"] span - Text:
[data-testid="tweetText"] - Image:
[data-testid="tweetPhoto"] img - Metadata: Timestamp from
<time>element
Extractor Interface
All extractors follow this interface:
class PlatformExtractor {
findPostContainer(element) // Locate post container
extractAuthor(container) // Get author name
extractText(container) // Get clean text
extractPrimaryImage(container) // Get main image
extractTimestamp(container) // Get post time
extractPostUrl(container) // Get permalink
extract(element) // Main extraction method
}
📁 File Structure
browser-extension/
├── manifest.json # Extension configuration
├── popup.html # Extension popup UI
├── popup.css # DIDI-themed styling
├── popup.js # Popup logic and state management
├── content.js # Content script with extractors
├── content.css # Selection box and notification styles
├── background.js # Background service worker
├── extractors/ # Platform-specific extractors (standalone files)
│ ├── facebook.js
│ └── twitter.js
└── README.md # This file
🎨 Design System
Uses DIDI's design system:
- Colors:
- Trust Blue:
#0052CC - Honest Teal:
#00BFCC - Caution Red:
#E63946 - Background:
#0A0E27
- Trust Blue:
- Font: Plus Jakarta Sans (with fallbacks)
- Effects: Gradient transitions, smooth animations
🔒 Permissions
activeTab- Access current tab contentstorage- Local storage for saved extractionsclipboardWrite- Copy to clipboard functionality- Host permissions for supported platforms
🐛 Troubleshooting
Extension won't load
- Check if all files are present
- Verify manifest.json is valid JSON
- Try removing and re-adding the extension
No extraction happening
- Refresh the page after installing extension
- Check browser console (F12) for errors
- Verify you're on a supported platform
Selection box not appearing
- Click "Activate Selection Mode" again
- Hover directly over post content
- Check if posts are using expected DOM structure
🚀 Future Enhancements
- LinkedIn extraction
- Custom website extraction with OCR
- Video content extraction
- Export to various formats (CSV, JSON, Markdown)
- Cloud sync with main DIDI app
- Keycloak authentication integration
- Batch extraction mode
- Advanced filtering options
📝 Development Notes
- Extension uses Manifest V3 (latest Chrome standard)
- Platform extractors embedded in
content.js(Chrome doesn't support ES modules in content scripts) - Standalone extractor files in
extractors/folder for code organization - All extraction logic uses defensive programming (checks for null/undefined)
- Extensive console logging with prefixes:
[FB],[Twitter],[DIDI]
🔗 Integration with DIDI App
Future integration will allow:
- Direct content send to Analysis tab
- Authentication via Keycloak
- Saved extractions sync across devices
- Export to DIDI's content database