How avi12/youtube-downloader works
YouTube Downloader is a cross-browser extension that turns video or playlist selections into downloadable media. Users choose formats and tracks in YouTube’s injected controls; requests are captured and routed through the background download pipeline, which retrieves streams, assembles media in an offscreen processing context, and reports progress to the page and popup. The popup also exposes settings, active and recent downloads, and format changes. The README documents these capabilities; detailed internal wiring is shown only where supported by the sampled source.
Main entry points: background.ts Content message handlers · pipeline-handlers.ts Pipeline handlers · main.ts Download worker · index.ts Mux and output pipeline
Components 23
YouTube interface
- YouTube content entry
src/layers/youtube/entrypoints/youtube-main.content/index.ts - Download controls
src/layers/youtube/components/download-options-panel/DownloadOptionsPanel.svelte - Request builder
src/layers/youtube/entrypoints/youtube-main.content/video/download-request-builder.ts - YouTube stream metadata
src/layers/youtube/entrypoints/youtube-main.content/video/youtube-api.ts - Content message handlers
src/layers/youtube/entrypoints/youtube.content/handlers/background.ts - Playlist downloader
src/layers/youtube/components/playlist-downloader/PlaylistDownloader.svelte
Download coordination
- Background entry
src/layers/background/main.ts - Download handlers
src/layers/background/handlers/download-handlers.ts - Pipeline handlers
src/layers/background/handlers/pipeline-handlers.ts - Download worker
src/layers/processing/entrypoints/download-worker/main.ts - SABR and CDN retrieval
src/layers/background/download/sabr-downloader.ts - Progress and queue state
src/lib/storage/storage.ts
Media processing
- Offscreen processing host
src/layers/processing/entrypoints/offscreen/main.ts - Mux and output pipeline
src/lib/download-pipeline/index.ts - FFmpeg mux worker
src/layers/processing/entrypoints/mux-worker/index.ts - Temporary media files
src/layers/processing/entrypoints/mux-worker/opfs-output-fs.ts
Download management
- Popup download manager
src/layers/popup/entrypoints/popup/App.svelte - Recent downloads
src/lib/storage/recent-downloads-db.ts - Download settings
src/layers/popup/entrypoints/popup/settings/SettingsTab.svelte
Other components
- User
- YouTube page
- YouTube services
- Browser download manager
Connections 24
- User → Download controls: selects format
- YouTube page → YouTube content entry: hosts controls
- YouTube content entry → Download controls: renders
- Download controls → Request builder: builds request
- YouTube stream metadata → YouTube services: fetches metadata
- Request builder → Content message handlers: sends request
- Content message handlers → Download handlers: messages
- Background entry → Download handlers: registers
- Background entry → Pipeline handlers: registers
- Download handlers → Download worker: starts download
- Download worker → SABR and CDN retrieval: retrieves streams
- SABR and CDN retrieval → YouTube services: requests media
- Download worker → Offscreen processing host: transfers chunks
- Offscreen processing host → Mux and output pipeline: dispatches processing
- Mux and output pipeline → FFmpeg mux worker: runs mux jobs
- FFmpeg mux worker → Temporary media files: writes output
- Mux and output pipeline → Browser download manager: saves media
- Pipeline handlers → Progress and queue state: updates progress
- Pipeline handlers → Content message handlers: forwards progress
- Popup download manager → Progress and queue state: reads download state
- Popup download manager → Recent downloads: shows history
- User → Playlist downloader: selects playlist
- Playlist downloader → Content message handlers: queues downloads
- User → Download settings: configures options