Skip to main content

MuGet

Downloads music from YouTube Music: songs, albums, and public playlists.

Features:

  • MuGet automatically embeds metadata into audio files:

    • title

    • artist

    • album

    • albumartist

    • track

    • totaltracks

    • date

    • cover art

    • lyrics (when available)

    • credits (when available)

      **Example:**
      Input #0, ogg, from '05 - Uma Thurman.opus':
      Duration: 00:03:31.58, start: 0.000000, bitrate: 147 kb/s
      Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
        Metadata:
          encoder         : Lavf63.3.100
          title           : Uma Thurman
          artist          : Fall Out Boy
          album_artist    : Fall Out Boy
          album           : American Beauty/American Psycho
          track           : 5
          tracktotal      : 11
          date            : 2015
          comment         : https://music.youtube.com/watch?v=r1AZQKsXKTY
          lyrics          : [00:00.08]I can move mountains
                          : [00:02.58]I can work a miracle, work a miracle
                          : [00:05.45]Oh, oh, keep you like an oath
                          : [00:09.24]May nothing but death do us part
                          : [00:13.43]♪
                          : [00:26.59]She wants to dance like Uma Thurman
                          : [00:29.11]Bury me till I confess
                          : [00:31.86]She wants to dance like Uma Thurman
                          : [00:35.37]And I can't get you out of my head
                          : [00:38.49]The stench, the stench, of summer sex
                          : [00:41.43]And CK eternity, oh hell yes
                          : [00:44.89]Divide me down to the smallest I can be
                          : [00:48.03]Put your, put your venom in me
                          : [00:51.33]I can move mountains
                          : [00:53.70]I can work a miracle, work a miracle
                          : [00:56.71]Oh, oh, I keep you like an oath
                          : [00:59.96]May nothing but death do us part
                          : [01:04.41]♪
                          : [01:16.93]She wants to dance like Uma Thurman
                          : [01:20.44]Bury me till I confess
                          : [01:23.09]She wants to dance like Uma Thurman
                          : [01:26.50]And I can't get you out of my head
                          : [01:29.47]The blood, the blood, the blood of the lamb
                          : [01:32.75]It's worth two lions, but here I am
                          : [01:35.81]And I slept in last night's clothes and tomorrow's dreams
                          : [01:40.06]But they're not quite what they seem
                          : [01:42.63]I can move mountains
                          : [01:44.90]I can work a miracle, work a miracle
                          : [01:47.91]Oh, oh, I keep you like an oath
                          : [01:51.09]May nothing but death do us part
                          : [01:55.66]♪
                          : [02:08.03]You'll find your way  
                          : [02:10.62]And may death find you alive
                          : [02:13.98]Take me down the line
                          : [02:16.88]In Gem City we turn the tide
                          : [02:20.64]You'll find your way
                          : [02:23.29]And may death find you alive
                          : [02:27.37]Take me down the line
                          : [02:29.75]In Gem City we turn the tide
                          : [02:33.38]She wants to dance like Uma Thurman
                          : [02:37.05]Bury me till I confess
                          : [02:39.62]She wants to dance like Uma Thurman
                          : [02:43.08]And I can't get you out of my head
                          : [02:45.95]I can move mountains
                          : [02:48.69]I can work a miracle, work a miracle
                          : [02:52.08]Oh, oh, I keep you like an oath
                          : [02:54.87]May nothing but death do us part
                          : [02:59.52]I can move mountains
                          : [03:01.44]I can work a miracle, work a miracle
                          : [03:04.85]Oh, oh, I keep you like an oath
                          : [03:07.92]May nothing but death do us part
          performer       : Fall Out Boy
          composer        : Jake Sinclair; Andy Hurley; Pete Wentz; Joe Trohman; Waqaas Hashmi; Jarrel Young; Liam O'Donnell; Bob Mosher; Patrick Stump; Jack Marshall
          producer        : Jake Sinclair
          copyright       : Island Records
      Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1400x1400 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn (attached pic)
          Metadata:
            comment         : Cover (front)
      
  • Downloaded files are organized automatically:

    output_directory/
    └── Album Artist/
        └── Album/
            ├── 01 - Song.opus
            ├── 02 - Song.opus
            ├── 03 - Song.opus
            └── Cover.jpg
    

Prerequisites:

  • Before proceeding with the installation, make sure the following tools are installed and available in your system's PATH:

    • Optional dependencies:

      The following tools are optional but required for specific features. Add them to your system's PATH.

      • rsgain: Required for replaygain metadata.
      • aria2: Required for aria2c download mode.

Installation:

  • In your terminal type:

    pip install muget
    

Configuration:

The first time MuGet runs, it automatically creates a configuration file:

  • Linux:

    ~/muget/muget.json
    
  • Windows:

    C:\Users\<username>\muget\muget.json
    

    Default configuration:

    {
        "audio_itag": "140",
        "output_directory": "YouTube Music",
        "delay_between_downloads": 1,
        "embed_cover": true,
        "cover_size": 1400,
        "cover_quality": 90,
        "save_cover": true,
        "skip_existing": true,
        "cookies_path": null,
        "po_token": null,
        "replaygain": false,
        "use_aria2c": false,
        "log_level": "INFO"
    }
    

    Tip: Edit this file to customize MuGet's behavior.

Configuration Options

Usage: muget [OPTIONS] [URL...]

  MuGet — YouTube Music Downloader.

  Downloads music from YouTube Music: songs, albums, and public playlists. Includes metadata,
  cover art, and optional ReplayGain support.

  CONFIGURATION:
    By default, settings are loaded from muget.json.
    Use -n to ignore the config file and use built-in defaults.
    Use --config-path to specify a different config file location.

  AUTHENTICATION (Premium):
    To download premium formats (itags 141, 774), provide:
      --cookies FILE    Netscape-format cookies file
      --po-token TOKEN  PoToken value

  EXAMPLES:
    muget "https://music.youtube.com/watch?v=..."
    muget -o ~/Music --audio-itag 251 "URL"
    muget --cookies cookies.txt --audio-itag 774 "URL"

Options:
  -v, --version                   Show the version and exit.
  --audio-itag ITAG               Audio quality itag
  -o, --output-dir DIR            Output directory for downloaded music
  --delay SECS                    Delay between downloads to avoid rate limiting
  --embed-cover / --no-embed-cover
                                  Embed cover art into audio files
  --cover-size PX                 Cover art resolution in pixels
  --cover-quality 1-100           Cover art JPEG quality (1-100)
  --save-cover / --no-save-cover  Save cover.jpg as separate file in album folder
  --skip-existing / --no-skip-existing
                                  Skip files that already exist
  --replaygain / --no-replaygain  Apply ReplayGain to albums (requires rsgain)
  --use-aria2c / --no-use-aria2c  Use aria2c for faster downloads
  --cookies FILE                  Netscape cookies file for YTM Premium formats
  --po-token TOKEN                PoToken for YTM Premium formats
  -l, --log-level [DEBUG|INFO]    Logging verbosity level
  --config-path FILE              Path to configuration file
  -n, --no-config-file            Ignore config file, use built-in defaults
  -h, --help                      Show this message and exit.

Available 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

Tip: To download using the 774 or 141 itags, you must have an active YouTube Music Premium subscription and provide a valid cookies_file.


Configuration Examples (muget.json)

Specify a custom output directory:

"output_directory": "/home/user/Music"

Download songs in Opus 128kbps (free):

"audio_itag": "251"

Download songs in Opus 256kbps (premium):

"audio_itag": "774"

Use browser cookies for authenticated downloads:

"cookies_path": "/home/user/cookies.txt"

Usage

Run MuGet with the following command:

 muget "OPTIONS" "URL..."

Supported URL types:

  • Song
  • Album
  • Public playlist

Tip: 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.

Command Lines 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 a public playlist:

muget "https://music.youtube.com/playlist?list=RDCLAK5uy_mzE-hKfgQBgAY_ZN4O85nOo_H9U0P47Mc"

Download using a cookies file:

muget --cookies "/storage/emulated/0/cookies.txt" "https://music.youtube.com/watch?v=EfjIqEGHmDI"

Acknowledgements

This project is based on gytmdl and built on top of ytmusicapi. Thanks to the maintainers and contributors of both projects.

Metadata

Release files for muget 4.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for muget 4.0.3
File Size Uploaded
muget-4.0.3.tar.gz 20.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for muget 4.0.3
File Interpreter ABI Platform
muget-4.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 38.4 kB

Release files / muget-4.0.3.tar.gz

Download URL muget-4.0.3.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1afe6646cdee0a1e3b7b359ca09480f9a27a258dbccd01c7640ae1f500a08ac7
BLAKE2b-256 checksum
How to use checksums
91b1803bde91298597475a58ac47b2912767eaacac168d669fa6569f96711bd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / muget-4.0.3-py3-none-any.whl

Download URL muget-4.0.3-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7136b911f93ef481026f2a5bfa57441231ecd38055fa40a98c2fe134518620d9
BLAKE2b-256 checksum
How to use checksums
7585ad32017fbe23dd0bb99aaf2aca092c0af0d04cd61d36a98a7b8b6793c840
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

4.0.3 This release

2 release files

4.0.2

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page