redlib
redlib copied to clipboard
feat(video): add RedGifs video support with proxy
Add support for RedGifs videos embedded in Reddit posts. Videos are proxied through redlib for privacy, similar to v.redd.it handling.
Features:
- Detect RedGifs posts and proxy videos through /redgifs/ endpoint
- Two-step flow: video ID lookup via API, then proxy video file
- Token caching with 24h expiry for RedGifs API authentication
- Prefer HD quality, fallback to SD automatically
- Lazy loading with preload="metadata" to save bandwidth
Security:
- Strict domain validation (only legitimate redgifs.com domains)
- File extension validation (only .mp4 files)
- Query parameter stripping from video IDs
- Pattern matching for all versioned CDN subdomains (v1, v2, etc.)
Implementation:
- New redgifs module with API integration
- Reuses existing proxy infrastructure
- Domain validation helper for consistent security checks
Fixes #20