$ show mediago-dev/mediago
MediaGo is a cross-platform media download manager that enables users to download videos from a wide range of sources, including HLS/m3u8 streams, YouTube, Bilibili, TikTok, Douyin, Xiaohongshu, and direct URLs. It is built as a monorepo with a Go backend (REST API + SSE events), an Electron desktop shell, a web UI (React 19), a mobile player UI, and a Chrome MV3 browser extension. The backend manages a download task queue that orchestrates external binaries (yt-dlp, BBDown, ffmpeg, aria2c, N_m3u8DL-RE) via PTY/exec runners, provides real-time progress through SSE, and includes an MCP server for AI agent integration. The Electron app embeds a Chromium webview for media source sniffing and supports share intents, ad blocking, and device mode. The browser extension detects media resources on pages and dispatches them to the local or remote MediaGo server via HTTP or a custom protocol.
The LLM identified 8 files worth highlighting for reuse:
Canonical URL matching rules for media source detection (HLS, Bilibili, YouTube, etc.) used by both the Electron webview sniffer and the browser extension. Pure functions with no side effects – easily extractable for any project needing to classify media types from URLs.
Fully typed API client for the MediaGo Go backend, covering discovery, downloads, conversions, auth, config, and SSE streaming. Uses axios with response interceptor, supports abort signals. Can be reused as a template for any REST client SDK.
Platform-specific binary downloader with SHA-256 integrity verification, caching via version manifest, and automatic re-provisioning on drift. Handles win32/darwin/linux and multiple CPU architectures. A reusable pattern for any CLI tool that needs to manage external dependencies.
Generic typed config store with dot-notation access, deep merge, change listeners, and atomic file writes via temp file + rename. Unopinionated and decoupled from the application – can be extracted as a standalone Go configuration library.
Cross-platform command runner with graceful stop, fallback from Windows ConPTY to anonymous pipe. Captures stdout/stderr for progress parsing. The interface is clean and could serve as a base for any Go project needing subprocess control with progress monitoring.
Atomic bundle environment transaction that injects sentinel secrets into build artifacts, verifies they are not leaked, and rolls back on failure. Includes file-based state machine with recovery. A novel pattern for ensuring environment variable isolation during CI/CD.
MCP (Model Context Protocol) server implementation exposing download and discovery tools as Streamable HTTP endpoints. Token-authenticated, with clean separation between tool registration and HTTP serving. A reusable reference for adding MCP support to any Go service.
Cached compilation of EasyList filter lists for Electron webviews with stale-while-revalidate pattern, timeout-guarded fetch, and atomic file replacement. The caching strategy is generic and applicable to any resource that needs periodic refresh with fallback to stale data.