Muzlib
Muzlib is a Python script that allows you to create your own music library. Music is downloaded from YouTube, and music tags are constructed using data from YouTube, Lrclib, NetEase.
🖥️🖱️ For GUI install muzlib-desktop
Instalation
Arch Linux [AUR]
You can install python-muzlib from AUR using your favorite AUR helper, for example:
yay -S python-muzlib
From PyPI
Ensure that you have installed FFmpeg.
Using uv
You can run muzlib without installation directly from the command line using uvx, which will handle dependencies and virtual environments for you:
uvx --from muzlib muzlib-cli
Using pip
You can install muzlib using pip in a virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install muzlib
Usage
Muzlib can be run directly from the command line. When launched without arguments, it starts an interactive prompt guiding you through the download process. You can also pass arguments to skip prompts entirely.
muzlib-cli [-h] [-l LIBRARY_PATH] [-d {album,artist,song}]
[--artist ARTIST] [--album ALBUM] [--song SONG]
[--non_interactive]
Arguments
| Argument | Short | Description |
|---|---|---|
--help |
-h |
Show help message and exit. |
--library_path PATH |
-l |
Root directory to save downloaded music. Defaults to your OS standard Music folder. |
--download_type {album,artist,song} |
-d |
Scope of the download: artist (full discography), album (specific release), or song (single track). |
--artist ARTIST |
Target artist's name. Highly recommended for all download types to ensure accurate search results. | |
--album ALBUM |
Target album's title. Use alongside --artist when --download_type is album. |
|
--song SONG |
Target song's title. Use alongside --artist when --download_type is song. |
|
--non_interactive |
Bypass all user prompts and automatically download the top search result. Requires --download_type to be set. |
Examples
Interactive mode
launches a menu to guide you through the download
muzlib-cli
Download an artist's full discography non-interactively
muzlib-cli -d artist --artist "Ludwig Göransson" --non_interactive
Download a specific album
muzlib-cli -d album --artist "Ludwig Göransson" --album "Oppenheimer" --non_interactive
Download a single song into a custom library folder
muzlib-cli -l ~/Music -d song --artist "Ludwig Göransson" --song "Can You Hear The Music" --non_interactive
[!NOTE]
--non_interactiverequires--download_typeto be specified, otherwise muzlib will exit with an error.
Available classes
There is only one (for now) class that can be used:
Muzlib(library_path: str, skip_downloaded=False): library class that uses YouTube Music metadata
Available methods
Backup library
Muzlib.backup_library() -> str
This function creates backup of library (even with user-changed tags).
Creates file .muzlib/muzlib_backup_***.json and returns path to it.
Restore library
This function downloads track and set metadata from bacup file.
Muzlib.backup_library(backup_filepath: str)
backup_filepath: path of the file created byMuzlib.backup_library().
Troubleshooting
[!WARNING] If you encounter issues with yt-dlp, you can replace default cookies at
assets/cookies.txtas described at this guide.
Metadata
Release files for muzlib 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| muzlib-0.4.1.tar.gz | 46.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| muzlib-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 88.9 kB
Release files / muzlib-0.4.1.tar.gz
| Download URL | muzlib-0.4.1.tar.gz |
|---|---|
| Size | 46.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c81e239276436afdc3243bd87e8c9ba7f00055f4a43edde8e81a434e82707d8
|
|
BLAKE2b-256 checksum How to use checksums |
ee33591ba21dc6df4ce6a4be1b20e295e4b02539d8c650293fd80718adcb721a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 3, 2026.
Transparency logRelease files / muzlib-0.4.1-py3-none-any.whl
| Download URL | muzlib-0.4.1-py3-none-any.whl |
|---|---|
| Size | 42.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
425de34d04543064b25cecca504c2ffe211d72cb125cb873f94503babc715d6c
|
|
BLAKE2b-256 checksum How to use checksums |
a411bbe2929a4a10ef83f7a65f131b2398a3997ae7e84f86f588235740cc9776
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 3, 2026.
Transparency log