glomatico / gytmdl

A Python CLI app for downloading YouTube Music songs with tags from YouTube Music.
109 stars 13 forks source link
downloader itunes m4a music youtube youtube-music youtubemusic yt-dlp yt-music

Glomatico's YouTube Music Downloader

A Python CLI app for downloading YouTube Music songs with tags from YouTube Music.

Discord Server: https://discord.gg/aBjMEZ9tnq

Why not just use yt-dlp directly?

While this project uses yt-dlp internally, it has the advantage of using YouTube Music's API to get the metadata for songs, which includes the proper high-resolution square cover, lyrics, track number, total tracks, etc.

Prerequisites

Installation

Install the package gytmdl using pip:

pip install gytmdl

Usage

gytmdl [OPTIONS] URLS...

Examples

Songs that are not part of album (standard YouTube videos) are not supported. To make sure you get valid links, use YouTube Music for searching and enable filtering by songs, albums or artists.

Interactive prompt controls

Configuration

gytmdl can be configured by using the command line arguments or the config file.

The config file is created automatically when you run gytmdl for the first time at ~/.gytmdl/config.json on Linux and %USERPROFILE%\.gytmdl\config.json on Windows.

Config file values can be overridden using command line arguments. Command line argument / Config file key Description Default value
--save-cover, -s / save_cover Save cover as a separate file. false
--overwrite / overwrite Overwrite existing files. false
--read-urls-as-txt, -r / - Interpret URLs as paths to text files containing URLs separated by newlines. false
--config-path / - Path to config file. <home>/.gytmdl/config.json
--log-level / log_level Log level. INFO
--print-exceptions / print_exceptions Print exceptions. false
--output-path, -o / output_path Path to output directory. ./YouTube Music
--temp-path / temp_path Path to temporary directory. ./temp
--cookies-path, -c / cookies_path Path to .txt cookies file. null
--ffmpeg-path / ffmpeg_path Path to FFmpeg binary. ffmpeg
--aria2c-path / aria2c_path Path to aria2c binary. aria2c
--download-mode / download_mode Download mode. ytdlp
--itag, -i / itag Itag (audio codec/quality). 140
--cover-size / cover_size Cover size. 1200
--cover-format / cover_format Cover format. jpg
--cover-quality / cover_quality Cover JPEG quality. 94
--template-folder / template_folder Template of the album folders as a format string. {album_artist}/{album}
--template-file / template_file Template of the song files as a format string. {track:02d} {title}
--template-date / template_date Date tag template. %Y-%m-%dT%H:%M:%SZ
--exclude-tags, -e / exclude_tags Comma-separated tags to exclude. null
--truncate / truncate Maximum length of the file/folder names. null
--no-config-file, -n / - Don't load the config file. false

Tag variables

The following variables can be used in the template folder/file and/or in the exclude_tags list:

Itags (audio codec/quality)

The following free itags are available:

The following premium itags are available if provided a cookies file with an active subscription:

Download modes

The following modes are available:

Cover formats

The following cover formats are available: