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(), "\"");