Download YouTube Music audio with metadata.
Before using MuGet, make sure the following tools are installed and available in your PATH:
- Python
- FFmpeg
- Deno
pip install mugetThe first time MuGet runs, it automatically creates a configuration file:
• Linux:
~/muget.json
• Windows:
C:\Users\<username>\muget.json
• Default configuration:
"audio_itag": "251",
"output_directory": "YouTube Music",
"delay_between_downloads": 1,
"embed_cover": true,
"skip_existing": true,
"cookies_path": null,
"po_token": null,
"replaygain": false #Do not enable. It corrupts data.Edit this file if you want to customize MuGet.
• Configuration Options:
| Option | Description |
|---|---|
audio_itag |
Audio format to download. |
output_directory |
Directory where downloaded music is stored. |
delay_between_downloads |
Delay in seconds between downloads. |
embed_cover |
Embed album artwork into audio files. |
skip_existing |
Skip tracks that already exist. |
cookies_path |
Path to a cookies.txt file for authenticated downloads. |
po_token |
YouTube PO token used by yt-dlp. |
replaygain |
Calculate ReplayGain tags after downloading albums. |
• Avaible Audio Formats:
Available values for audio_itag:
| Itag | Quality | Codec | Container | Account |
|---|---|---|---|---|
249 |
48kbps |
opus |
ogg |
free |
250 |
64kbps |
opus |
ogg |
free |
251 |
128kbps |
opus |
ogg |
free |
774 |
256kbps |
opus |
ogg |
premium |
139 |
48kbps |
aac |
m4a |
free |
140 |
128kbps |
aac |
m4a |
free |
141 |
256kbps |
aac |
m4a |
premium |
• Examples:
Specify the output directory (By default, it is saved in the directory where you are running the “muget” command):
"output_directory": "/home/user/Music",Download AAC instead of Opus:
"audio_itag": "140",Use browser cookies:
"cookies_path": "/home/user/cookies.txt",Run MuGet with the following command:
muget "YOUR_URL"• Supported URL types:
- Song
- Album
- Public playlist
Songs that are not “Official” (regular YouTube videos) are excluded by this program. To ensure you get valid links, use YouTube Music to search and enable the filter for songs or albums.
• Examples:
-
Download a song:
muget https://music.youtube.com/watch?v=EfjIqEGHmDI -
Download an album:
muget https://music.youtube.com/playlist?list=OLAK5uy_keZv-_VVAJ8GQ3gEx9c3a3araWrT0En0Y -
Download an public playlist:
muget https://music.youtube.com/playlist?list=RDCLAK5uy_mzE-hKfgQBgAY_ZN4O85nOo_H9U0P47Mc
Downloaded files are organized automatically:
YouTube Music/
└── Album Artist/
└── Album/
├── 01 - Song.opus
├── 02 - Song.opus
└── 03 - Song.opus
MuGet automatically writes:
- Title
- Artist
- Album
- Album Artist
- Track Number
- Total Tracks
- Release Year
- Cover Art
- Lyrics (when available)
- Song Credits (when available)