diff --git a/SpotifyKeyDumper/Utils.cpp b/SpotifyKeyDumper/Utils.cpp index 6c8f2a1..5ccde29 100644 --- a/SpotifyKeyDumper/Utils.cpp +++ b/SpotifyKeyDumper/Utils.cpp @@ -140,7 +140,13 @@ void Utils::DownloadSong(std::string fileId, std::string trackUri, std::string k std::string srStr = DownloadSpotifyUrl("spclient.wg.spotify.com", "/storage-resolve/files/audio/interactive_prefetch/" + fileId + "?product=0", authToken); - if (srStr.length() > 5 && srStr.substr(0, 5).compare("Error") == 0) + if (srStr.length() <= 5) + { + std::cout << "Error: Couldn't fetch storage resolve!" << std::endl; + return; + } + + if (srStr.substr(0, 5).compare("Error") == 0) { std::cout << srStr << std::endl; return; @@ -174,13 +180,13 @@ void Utils::DownloadSong(std::string fileId, std::string trackUri, std::string k // Download encrypted song data from Spotify std::string songStr = DownloadSpotifyUrl(songHost, songPath, ""); - if (songStr.empty()) + if (songStr.length() <= 6) { - std::cout << "Error: Could not download audio" << std::endl; + std::cout << "Error: Could not download audio!" << std::endl; return; } - if (songStr.length() > 6 && songStr.substr(0, 6).compare("") == 0) + if (songStr.substr(0, 6).compare("") == 0) { std::cout << "Error: " + songStr << std::endl; return;