Package: gamdl
gamdl - Glomatico's Apple Music DownloaderA Python script to download Apple Music songs/music videos/albums/playlists. This is a rework ofhttps://github.com/loveyoursupport/AppleMusic-Downloader/tree/661a274d62586b521feec5a7de6bee0e230fdb7d.FeaturesDownload songs in 256kbps AAC or in 64kbps HE-AACDownload music videos up to 4KDownload synced lyricsChoose between FFmpeg and MP4Box for remuxingChoose between yt-dlp and N_m3u8DL-RE for downloadingHighly customizableInstallationInstall Python 3.7 or higherAddFFmpegandmp4decryptto PATHmp4decrypt is only needed if you want to download music videosPlace your cookies in the same folder that you will run gamdl ascookies.txtYou can export your cookies by using this Google Chrome extension on Apple Music website:https://chrome.google.com/webstore/detail/open-cookiestxt/gdocmgbfkjnnpapoeobnolbbkoibbcif. Make sure to be logged in.Place your .wvd file in the same folder that you will run gamdl asdevice.wvdTo get a .wvd file, you can usedumperto dump a L3 CDM from an Android device. Once you have the L3 CDM, use pywidevine to create the .wvd file from it.Install pywidevine with pippipinstallpywidevinepyyamlCreate the .wvd filepywidevinecreate-device-tANDROID-l3-kprivate_key.pem-cclient_id.bin-o.Install gamdl using pippipinstallgamdlExamplesDownload a songgamdl"https://music.apple.com/us/album/never-gonna-give-you-up-2022-remaster/1626265761?i=1626265765"Download an albumgamdl"https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1626265761"ConfigurationYou can configure gamdl by using the command line arguments or the config file. The config file is created automatically when you run gamdl for the first time at~/.gamdl/config.jsonon Linux and%USERPROFILE%\.gamdl\config.jsonon Windows. Config file values can be overridden using command line arguments.Command line argument / Config file keyDescriptionDefault value-f,--final-path/final_pathPath where the downloaded files will be saved../Apple Music-t,--temp-path/temp_pathPath where the temporary files will be saved../temp-c,--cookies-location/cookies_locationLocation of the cookies file../cookies.txt-w,--wvd-location/wvd_locationLocation of the .wvd file../device.wvd--ffmpeg-location/ffmpeg_locationLocation of the FFmpeg binary.ffmpeg--mp4box-location/mp4box_locationLocation of the MP4Box binary.MP4Box--mp4decrypt-location/mp4decrypt_locationLocation of the mp4decrypt binary.mp4decrypt--nm3u8dlre-location/nm3u8dlre_locationLocation of the N_m3u8DL-RE binary.N_m3u8DL-RE--config-location/ -Location of the config file.<home_folder>/.gamdl/config.json--template-folder-album/template_folder_albumTemplate of the album folders as a format string.{album_artist}/{album}--template-folder-compilation/template_folder_compilationTemplate of the compilation album folders as a format string.Compilations/{album}--template-file-single-disc/template_file_single_discTemplate of the track files for single-disc albums as a format string.{track:02d} {title}--template-file-multi-disc/template_file_multi_discTemplate of the track files for multi-disc albums as a format string.{disc}-{track:02d} {title}--template-folder-music-video/template_folder_music_videoTemplate of the music video folders as a format string.{artist}/Unknown Album--template-file-music-video/template_file_music_videoTemplate of the music video files as a format string.{title}--cover-size/cover_sizeSize of the cover.1200--template-date/template_dateTemplate of the tagged date as a string with format codes.%Y-%m-%dT%H:%M:%SZ--cover-format/cover_formatFormat of the cover.jpg--remux-mode/remux_modeRemux mode.ffmpeg--download-mode/download_modeDownload mode.ytdlp-e,--exclude-tags/exclude_tagsList of tags to exclude from file tagging separated by commas.null--truncate/truncateMaximum length of the file/folder names.40-l,--log-level/log_levelLog level.INFO--prefer-hevc/prefer_hevcPrefer HEVC over AVC when downloading music videos.false--prefer-account-language/prefer_account_languagePrefer the language associated with the account rather than English.false--ask-video-format/ask_video_formatAsk for the video format when downloading music videos.false--disable-music-video-skip/disable_music_video_skipDon't skip downloading music videos in albums/playlists.false-l,--lrc-only/lrc_onlyDownload only the synced lyrics.false-n,--no-lrc/no_lrcDon't download the synced lyrics.false-s,--save-cover/save_coverSave cover as a separate file.false--songs-heaac/songs_heaacDownload songs in HE-AAC 64kbps.false-o,--overwrite/overwriteOverwrite existing files.false--print-exceptions/print_exceptionsPrint exceptions.false-u,--url-txt/ -Read URLs as location of text files containing URLs.false-n,--no-config-file/ -Don't use the config file.falseTags variablesThe following variables can be used in the template folders/files and/or in theexclude_tagslist:albumalbum_artistalbum_idalbum_sortartistartist_idartist_sortcommentcompilationcomposercomposer_idcomposer_sortcopyrightcoverdatediscdisc_totalgaplessgenregenre_idlyricsmedia_typeratingstorefronttitletitle_idtitle_sorttracktrack_totalxidRemux modeThe following remux modes are available:ffmpegCan decrypt and remux songs but can't decrypt music videos by itselfDecryption may not work on older versions of FFmpegmp4boxRequires mp4decryptDoesn't convert closed captions in music videos that have themCan be obtained from here:https://gpac.wp.imt.fr/downloadsDownload modeThe following download modes are available:ytdlpnm3u8dlreFaster thanytdlpRequires FFmpegCan be obtained from here:https://github.com/nilaoda/N_m3u8DL-RE/releasesMusic videos qualityMusic videos will be downloaded in the highest quality available by default. The available qualities are:AVC 1080p 10mbps, AAC 256kbpsAVC 1080p 6.5mbps, AAC 256kbpsAVC 720p 4mbps, AAC 256kbpsAVC 576p 2mbps, AAC 256kbpsAVC 480p 1.5mbps, AAC 256kbpsAVC 360p 1mbps, AAC 256kbpsBy enabling theprefer_hevcoption, music videos will be downloaded in the highest HEVC quality available. The available qualities are:HEVC 4K 20mbps, AAC 256kbpsHEVC 4K 12mbps, AAC 256kbpsEnableask_video_formatto select a custom audio/video format.