A simple and efficient command-line tool for downloading media from various platforms. Currently supports YouTube with plans for additional platforms.
- 🎥 Video Downloads: Download videos in MP4 format
- 🎵 Audio Extraction: Download audio-only content in MP3 format
- 📊 Progress Tracking: Real-time download progress bars
- 🏠 Organized Storage: Automatically saves downloads to
~/mget-downloads - 🔗 Multiple URL Formats: Supports various YouTube URL formats (youtube.com, youtu.be, m.youtube.com)
- Go 1.25.4 or later
git clone https://github.com/renato3x/mget.git
cd mget
go build -o mget ./cmd/mgetInstall directly from GitHub:
go install github.com/renato3x/mget/cmd/mget@latestOr install from a local clone:
go install ./cmd/mgetMake sure your $GOPATH/bin or $GOBIN is in your $PATH.
Download a video from YouTube:
mget https://www.youtube.com/watch?v=VIDEO_IDDownload only the audio track (MP3):
mget --audio https://www.youtube.com/watch?v=VIDEO_ID
# or use the short flag
mget -a https://www.youtube.com/watch?v=VIDEO_IDThe tool accepts various YouTube URL formats:
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://m.youtube.com/watch?v=VIDEO_ID
The project is organized into several packages:
cmd/mget: Main entry point that handles CLI argument parsing and orchestrates the download processinternal/cli: Command-line interface handling, including flag parsinginternal/mget: Core download logic and platform-specific implementations
- URL Validation: The tool validates and identifies the platform from the provided URL
- Platform Detection: Currently supports YouTube
- Format Selection: Automatically selects the best available format matching the requested media type (video or audio)
- Download: Streams the media content with progress tracking
- File Storage: Saves the file with a UUID-based filename to
~/mget-downloads
- Downloads video in MP4 format
- Extracts audio in MP3 format
- Automatically selects formats with audio channels
- Uses the
kkdai/youtube/v2library for YouTube API interaction
All downloads are saved to:
~/mget-downloads/
Files are named using UUIDs to avoid conflicts. The directory is automatically created if it doesn't exist.
$ mget https://www.youtube.com/watch?v=dQw4w9WgXcQ
Downloading media from YouTube...
████████████████████████████████████████ 100%
Media "Rick Astley - Never Gonna Give You Up" downloaded to /Users/username/mget-downloads/550e8400-e29b-41d4-a716-446655440000.mp4$ mget -a https://www.youtube.com/watch?v=dQw4w9WgXcQ
Downloading media from YouTube...
████████████████████████████████████████ 100%
Media "Rick Astley - Never Gonna Give You Up" downloaded to /Users/username/mget-downloads/550e8400-e29b-41d4-a716-446655440000.mp3The tool provides clear error messages for common issues:
- Invalid or missing URL
- Unsupported platform
- Network errors
- Format selection failures
- File system errors
github.com/kkdai/youtube/v2: YouTube video downloadinggithub.com/schollz/progressbar/v3: Progress bar displaygithub.com/google/uuid: UUID generation for filenames
See LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Custom output directory option
- Quality/format selection
- Playlist support
- Additional platform support