Skip to content

mattveraldi/videodownloader-chrome-extension

Repository files navigation

Video Download Helper

A Chrome extension that intercepts and downloads videos from websites, with special support for DASH streaming (separate audio+video) and automatic quality selection.


Frontend technologies

TypeScript React TailwindCSS

Code quality

ESLint Prettier Husky

Video processing tool

FFmpeg

Build powered by

Webpack 5 AI Assist

Demo

demo

✨ Features

  • HTTP Video Interception: Automatically detects video requests in the background
  • DASH Streaming Support: Merges separate audio and video streams using FFmpeg
  • Quality Selection: Automatically selects the highest quality available
  • Video Preview: Shows thumbnail and duration for each video
  • Filesize Display: Shows actual file size before downloading
  • Search & Filter: Search by filename, duration, or filesize
  • Sort by Size: Videos automatically sorted by filesize (largest first)
  • Download Progress: Real-time progress for downloads with merge operations
  • State Persistence: Videos persist across service worker restarts
  • Auto-Cleanup: Automatically clears videos when navigating or reloading pages

🎯 Supported Formats

βœ… Full Support

The extension works with websites using:

  • DASH Streaming: Automatic audio+video merge with quality selection
  • Progressive MP4: Direct download with metadata extraction

⚠️ Limitations

  • DRM-Protected Content: Cannot download protected content (Netflix, Disney+, etc.)
  • Sites with aggressive CORS: Preview/duration extraction may fail (download still works)
  • Platform Restrictions: Many platforms (YouTube, major social networks) have Terms of Service that prohibit video downloading

πŸ“‹ Requirements

  • Chrome 88+ or Edge 88+
  • No special permissions required from websites
  • ~30MB disk space (includes FFmpeg WebAssembly)

πŸš€ Installation

From Source

# Clone repository
git clone https://github.com/mattveraldi/downloadhelper.git
cd downloadhelper

# Install dependencies
npm install

# Build extension
npm run build

# Create distribution package
npm run package

# Code quality checks (optional)
npm run lint        # Check for linting errors
npm run lint:fix    # Auto-fix linting issues
npm run format      # Format code with Prettier

Load in Chrome

  1. Open chrome://extensions/
  2. Enable "Developer mode" (toggle in top-right)
  3. Click "Load unpacked"
  4. Select the dist/ folder

πŸ“– Usage

Basic Usage

  1. Navigate to a website with videos
  2. Click the extension icon in the toolbar
  3. Videos appear in the popup as they're detected
  4. Click "Scarica" (Download) to save a video

DASH Videos

Videos with a red "DASH" badge have separate audio and video:

  • Click download β†’ Extension automatically:
    1. Loads FFmpeg (~30MB, first time only)
    2. Downloads video stream
    3. Downloads audio stream
    4. Merges them into a single MP4 file
    5. Triggers browser download

Progress is shown in real-time: "Loading FFmpeg..." β†’ "Downloading..." β†’ "Merging..."

Quality Badges

Videos show quality badges when detected:

  • Green badge: 1080p, 720p, 480p, 360p - Standard resolution
  • Green badge: FHD, HD, SD - Alternative quality labels

The extension automatically selects the highest quality available.

Search & Filter

Use the search box to filter videos by:

  • Filename: Type part of the video name
  • Duration: Type 10:30 to find 10-minute videos
  • Filesize: Type 150 to find videos around 150MB

Videos are automatically sorted by filesize (largest first) to help identify high-quality downloads.

βš–οΈ Trade-offs & Limitations

Pros

βœ… Automatic Quality Selection: No manual selection needed, always gets best quality
βœ… Browser-Based Merge: No external software required
βœ… Privacy-Focused: All processing happens locally, no data sent to servers
βœ… Universal Detection: Works on any website with compatible video formats
βœ… Real-time Detection: Videos appear as you browse, no page refresh needed

Cons

❌ Large Bundle Size: ~30MB due to FFmpeg WebAssembly (downloaded once)
❌ DASH Merge Speed: Merging takes time for large videos (5-30 seconds)
❌ Memory Usage: Processing large videos (>500MB) requires significant RAM
❌ CORS Limitations: Some sites block preview/duration extraction
❌ DRM Content: Cannot download protected content (Netflix, Disney+, etc.)

Performance Notes

  • First DASH Download: Takes longer (~30s) to load FFmpeg WebAssembly
  • Subsequent Downloads: Faster as FFmpeg is cached in memory
  • Large Files: Videos over 1GB may cause browser slowdown during merge
  • Background Processing: Service Worker may pause if inactive (Chrome limitation)

Technical Limitations

  1. HTTP-Only: Cannot intercept HTTPS traffic (Chrome security)
  2. Same-Origin: Cannot download cross-origin videos with strict CORS
  3. Ephemeral Storage: Video list clears when Service Worker restarts
  4. Quality Detection: Only works for platforms with quality metadata in URLs

πŸ› οΈ Development

Project Structure

src/
β”œβ”€β”€ core/            # Pure TypeScript business logic
β”‚   β”œβ”€β”€ types.ts     # Type definitions
β”‚   β”œβ”€β”€ utils.ts     # Utility functions
β”‚   β”œβ”€β”€ download.ts  # Download logic with FFmpeg
β”‚   β”œβ”€β”€ video-parser.ts  # URL parsing
β”‚   β”œβ”€β”€ video-store.ts   # State management
β”‚   └── chrome-api.ts    # Chrome API wrappers
β”‚
β”œβ”€β”€ hooks/           # React hooks for state management
β”‚   β”œβ”€β”€ useVideos.ts     # Video list management
β”‚   β”œβ”€β”€ useVideoMetadata.ts  # Metadata extraction
β”‚   └── useDownload.ts   # Download state
β”‚
β”œβ”€β”€ components/      # React components
β”‚   β”œβ”€β”€ VideoCard.tsx    # Single video display
β”‚   └── Metadata.tsx     # Metadata extraction
β”‚
β”œβ”€β”€ background.ts    # Service Worker - video detection
β”œβ”€β”€ popup.tsx        # Popup UI - video list
└── content.ts       # Content script - page detection

public/
β”œβ”€β”€ manifest.json    # Extension configuration
β”œβ”€β”€ *.html           # UI pages
β”œβ”€β”€ styles.css       # Styling
└── ffmpeg-core/     # FFmpeg WebAssembly (~30MB)

Tech Stack

  • TState Persistence: Service worker restores video list from chrome.storage.session on startup
  1. Auto-Cleanup: chrome.webNavigation.onCommitted clears videos on page reload/navigation
  2. Filesize Fetch: HEAD requests to get Content-Length before download
  3. Smart Merging: Popup preserves local metadata (preview/duration) when syncing with background
  4. Merge (DASH): FFmpeg merges streams: ffmpeg -i video.mp4 -i audio.m4a -c copy output.mp4
  5. Download: Uses chrome.downloads.download with Blob URL

Architecture

The project follows Clean Architecture principles with clear separation:

  • Core Layer: Pure TypeScript business logic (framework-agnostic)
  • Hooks Layer: React integration and state management
  • Components Layer: Presentational React components
  • Entrypoints: Thin glue for Chrome Extension + React

See ARCHITECTURE.md for detailed documentation.

  • Chrome Manifest V3: Latest extension standard

Build Commands

npm run build      # Production build
npm run dev        # Watch mode for development
npm run package    # Create distributable .zip

How It Works

  1. Detection: chrome.webRequest.onCompleted intercepts HTTP responses with video/* or audio/* MIME types
  2. DASH Grouping: Extracts video_id from URL parameters to group audio+video streams
  3. Quality Comparison: Compares bitrate values, keeps highest quality version
  4. Filesize Fetch: HEAD requests to get Content-Length before download
  5. Merge (DASH): FFmpeg merges streams: ffmpeg -i video.mp4 -i audio.m4a -c copy output.mp4
  6. Download: Uses chrome.downloads.download with Blob URL

🀝 Contributing

Contributions are welcome! Please read CONTRIBUTING.md for:

πŸ“„ License

MIT License - See LICENSE file for details

πŸ› Known Issues

  • Some platforms send multiple quality versions - extension picks highest bitrate
  • Sites with CORS restrictions may have preview extraction issues
  • Large DASH videos (>1GB) may cause browser slowdown during merge
  • Service Worker restart clears video list (Chrome Manifest V3 limitation)

βš–οΈ Legal Disclaimer

IMPORTANT: This tool was developed and tested exclusively for educational purposes using the developer's own video content on social media platforms. The tool has been tested on Facebook and Instagram solely for the purpose of studying video streaming technologies (DASH, HLS) and browser extension development.

The use of this extension on social media platforms (Facebook, Instagram, YouTube, TikTok, etc.) violates their Terms of Service and is strongly discouraged. These platforms explicitly prohibit downloading content without permission.

Use this tool only:

  • For downloading your own content from platforms where you hold the rights
  • On websites where downloading is explicitly permitted
  • For educational or archival purposes on content you own or have permission to download

The developers assume no responsibility for misuse of this tool. Users are solely responsible for ensuring their usage complies with applicable laws and platform Terms of Service.


Made with ❀️ by @mattveraldi

About

A Chrome extension to download videos

Topics

Resources

License

Contributing

Stars

Watchers

Forks