From e6279779d58c667c79444d7f7c6bac6c4c2da1eb Mon Sep 17 00:00:00 2001 From: _ <🐱> Date: Thu, 3 Dec 2020 16:57:54 -0700 Subject: [PATCH] Fix song title parsing --- SpotifyKeyDumper/Utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SpotifyKeyDumper/Utils.cpp b/SpotifyKeyDumper/Utils.cpp index 83f6f57..70fc47d 100644 --- a/SpotifyKeyDumper/Utils.cpp +++ b/SpotifyKeyDumper/Utils.cpp @@ -368,7 +368,9 @@ void Utils::DownloadSong(std::string fileId, std::string uri, std::string key, s std::string metadata = DownloadSpotifyUrl("api.spotify.com", "/v1/tracks/" + uri.substr(uri.find("spotify:track:") + 14), authToken); - songInfo->title = strtok((char*)(metadata.substr(metadata.find("is_local\" :") + 55)).c_str(), "\""); + size_t isLocalOff = metadata.find("is_local\" :"); + + songInfo->title = strtok((char*)(metadata.substr(metadata.find("name\" :", isLocalOff) + 9)).c_str(), "\""); songInfo->artist = strtok((char*)(metadata.substr(metadata.find("name\" :") + 9)).c_str(), "\""); songInfo->album = strtok((char*)(metadata.substr(metadata.find(albumSearchPattern) + 404)).c_str(), "\""); songInfo->coverUrl = strtok((char*)(metadata.substr(metadata.find("height\" :") + 30)).c_str(), "\"");