$ show aandrew-me/ytDownloader
ytDownloader is a cross-platform desktop application built with Electron that provides a graphical interface for downloading videos and audio from YouTube and hundreds of other sites using yt-dlp as the backend download engine. It features a comprehensive download manager supporting single downloads, playlists, and YouTube search, with options for format selection, quality, subtitles, compression, and output templates. The application manages its own yt-dlp and ffmpeg binaries, supports auto-updates, and includes a download history with JSON/CSV export, theming, internationalization (23+ languages), system tray integration, and a global hotkey for quick URL pasting. Architecture: The application follows a standard Electron architecture with a main process (main.js) handling window management, IPC handlers, auto-updater, system tray, and global hotkey. A preload script (preload.js) sets up a context bridge (electronAPI) that exposes filesystem operations, process spawning, clipboard access, and other OS services to the renderer. The renderer process consists of several JavaScript modules (src/index.js, src/playlist.js, src/compressor.js, src/preferences.js, src/history_ui.js, src/common.js) that handle specific views. Communication between renderer and main process occurs via Electron's IPC mechanism (ipcRenderer/ipcMain). User preferences are stored in localStorage and a JSON config file, while download history is persisted as JSON. Key entry points: main.js (Electron main process), preload.js (context bridge), html/index.html (single-page UI shell), src/renderer.js (main renderer logic with YtDownloaderApp class), src/index.js (homepage downloader), src/playlist.js (playlist downloader), src/compressor.js (video compressor), src/preferences.js (settings), src/history_ui.js (history view). External dependencies include yt-dlp (download engine), ffmpeg/ffprobe (media processing), Electron (framework), electron-builder (packaging), electron-updater (auto-updates), systeminformation (GPU detection), and SlimSelect (custom dropdowns). The application bundles these binaries or uses system-installed versions, with fallback mechanisms.
The LLM identified 5 files worth highlighting for reuse:
Provides a collection of self-contained utility functions (getId, formatBytes, findFfmpeg, formatVideoCodec, buildCodecFilter) that are used across the application. These functions are generic and could be extracted into a standalone helper library for any Node.js project needing similar operations (e.g., byte formatting, codec filtering, binary path resolution).
Implements a DownloadHistory class that manages a capped (800 items) JSON-backed history store with filtering, statistics, and export to JSON/CSV. The class is self-contained and follows a clean repository pattern, making it reusable in any application that needs a persistent, filterable history with export capabilities.
Defines an I18n class that handles locale detection, translation loading, fallback to default language, and data-translate attribute replacement. It is fully self-contained and can be reused in other Electron or web projects to add multi-language support with minimal adaptation.
A test helper that launches the Electron application with mocked yt-dlp and ffmpeg subprocesses, enabling end-to-end testing without external binaries. It demonstrates a clean pattern for integration testing of Electron apps that depend on external command-line tools, and can be adapted for other projects needing similar mocking.
Sets up the electronAPI context bridge that exposes filesystem operations, process spawning, clipboard access, and other OS services to the renderer process. This pattern isolates all OS interactions behind a single bridge, making the renderer code testable and the bridge itself reusable across different Electron applications.