Skip to main content

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

Project description

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

  • Download a song:
    gytmdl "https://music.youtube.com/watch?v=3BFTio5296w"
    
  • Download an album:
    gytmdl "https://music.youtube.com/playlist?list=OLAK5uy_lvpL_Gr_aVEq-LaivwJaSK5EbFd4HeamM"
    
  • Choose which albums or singles to download from an artist:
    gytmdl "https://music.youtube.com/channel/UCwZEU0wAwIyZb4x5G_KJp2w"
    

Songs that are not part of an 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

  • Arrow keys - Move selection
  • Space - Toggle selection
  • Ctrl + A - Select all
  • Enter - Confirm selection

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
--no-exceptions / no_exceptions Don't 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
--no-synced-lyrics / no_synced_lyrics Don't save synced lyrics. false
--synced-lyrics-only / synced_lyrics_only Skip track download and only save synced lyrics. false
--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:

  • album
  • album_artist
  • artist
  • cover
  • date
  • lyrics
  • media_type
  • rating
  • title
  • track
  • track_total
  • url

Itags (audio codec/quality)

The following free itags are available:

  • 140 (AAC 128kbps)
  • 139 (AAC 48kbps)
  • 251 (Opus 128kbps)
  • 250 (Opus 64kbps)
  • 249 (Opus 48kbps)

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

  • 141 (AAC 256kbps)
  • 774 (Opus 256kbps)

Download modes

The following modes are available:

Cover formats

The following cover formats are available:

  • jpg
  • png
  • raw
    • This format gets the raw cover without any processing.
    • Note that when using this format, the cover image will not be embedded within the files. To address this, you can enable the save_cover option to save the cover as a separate file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gytmdl-2.1.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gytmdl-2.1.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file gytmdl-2.1.1.tar.gz.

File metadata

  • Download URL: gytmdl-2.1.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for gytmdl-2.1.1.tar.gz
Algorithm Hash digest
SHA256 bf8de352fd70400c28c6d00e0c4e15453aa3b51f3417d78f9b8e434116a8f6e2
MD5 077022d54c1a19289207119cde617b72
BLAKE2b-256 d89c1f24e076474f6e9b669da33e3b5aa7e9ca953f949f5c3e54d34a212fe143

See more details on using hashes here.

File details

Details for the file gytmdl-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: gytmdl-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for gytmdl-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e955113b3703591c877cc3e0a42f171fb8396853b6f834a837c25550e0c2ceb9
MD5 ddbef226398edfd7107d3851550155ff
BLAKE2b-256 82fbffd8b4ec9da44e870a0ee510b93733d1cd9940f10c59919b3a52f46a7cf8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page