Download YouTube Music songs/albums/playlists with tags from YouTube Music in 256kbps AAC/128kbps Opus/128kbps AAC.
While this project uses yt-dlp under the hood to download songs from YouTube Music, it has the advantage of utilizing YouTube Music's API to get songs metadata, ensuring that you get the correct tags for your songs. This includes information such as track number, square cover, lyrics, year, etc.
- Install Python 3.8 or higher
- Install gytmdl with pip
pip install gytmdl
- Add FFMPEG to your PATH. You can get it from here: https://ffmpeg.org/download.html
- If you are on Windows you can move the
ffmpeg.exe
file to the same folder that you will run the script instead of adding it to your PATH.
- If you are on Windows you can move the
- (optional) Get your cookies.txt
- With cookies.txt, you can download age restricted tracks, private playlists and songs in 256kbps AAC using
--itag 141
argument if you are a premium user. You can export your cookies by using the following Google Chrome extension on YouTube Music website with your account logged in: https://chrome.google.com/webstore/detail/gdocmgbfkjnnpapoeobnolbbkoibbcif. Make sure to export it ascookies.txt
to the same folder that you will run the script.
- With cookies.txt, you can download age restricted tracks, private playlists and songs in 256kbps AAC using
usage: gytmdl [-h] [-u [URLS_TXT]] [-t TEMP_PATH] [-f FINAL_PATH] [-c COOKIES_LOCATION] [-i {141,251,140}] [-o]
[-s] [-e] [-v]
[<url> ...]
Download YouTube Music songs/albums/playlists with tags from YouTube Music
positional arguments:
<url> YouTube Music song/album/playlist URL(s) (default: None)
options:
-h, --help show this help message and exit
-u [URLS_TXT], --urls-txt [URLS_TXT]
Read URLs from a text file (default: None)
-t TEMP_PATH, --temp-path TEMP_PATH
Temp path (default: temp)
-f FINAL_PATH, --final-path FINAL_PATH
Final path (default: YouTube Music)
-c COOKIES_LOCATION, --cookies-location COOKIES_LOCATION
Cookies location (default: cookies.txt)
-i {141,251,140}, --itag {141,251,140}
itag (quality). Can be 141 (256kbps AAC, requires cookies), 251 (128kbps Opus) or 140 (128kbps
AAC) (default: 140)
-o, --overwrite Overwrite existing files (default: False)
-s, --skip-cleanup Skip cleanup (default: False)
-e, --print-exceptions
Print exceptions (default: False)
-v, --version show program's version number and exit