This commit is contained in:
Sude 2018-01-11 09:58:39 +02:00
commit b90b7288d4
5 changed files with 550 additions and 611 deletions

View File

@ -83,16 +83,27 @@ int API::getAPIConfig()
std::string url = "https://api.gog.com/downloader2/status/stable/"; // Stable API
//std::string url = "https://api.gog.com/downloader2/status/beta/"; // Beta API
//std::string url = "https://api.gog.com/downloader2/status/e77989ed21758e78331b20e477fc5582/"; // Development API? Not sure because the downloader version number it reports is lower than beta.
int res = 0;
std::string json = this->getResponse(url);
if (!json.empty())
{
if (json.empty()) {
this->setError("Found nothing in " + url);
return 0;
}
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, root))
{
std::istringstream json_stream(json);
try {
json_stream >> root;
} catch (const Json::Exception& exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getAPIConfig)" << std::endl << json << std::endl;
#endif
this->setError(exc.what());
return 0;
}
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getAPIConfig)" << std::endl << root << std::endl;
#endif
@ -105,25 +116,7 @@ int API::getAPIConfig()
this->config.get_game_details = root["config"]["get_game_details"].asString() + "/";
this->config.get_extra_link = root["config"]["get_extra_link"].asString() + "/";
this->config.set_app_status = root["config"]["set_app_status"].asString() + "/";
res = 1;
}
else
{
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getAPIConfig)" << std::endl << json << std::endl;
#endif
this->setError(jsonparser->getFormattedErrorMessages());
res = 0;
}
delete jsonparser;
}
else
{
this->setError("Found nothing in " + url);
res = 0;
}
return res;
return 1;
}
int API::login(const std::string& email, const std::string& password)
@ -191,18 +184,29 @@ int API::login(const std::string& email, const std::string& password)
int API::getUserDetails()
{
int res = 0;
std::string url;
url = this->config.get_user_details;
std::string json = this->getResponseOAuth(url);
if (!json.empty())
{
if (json.empty()) {
this->setError("Found nothing in " + url);
return 0;
}
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, root))
{
std::istringstream json_stream(json);
try {
json_stream >> root;
} catch (const Json::Exception& exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getUserDetails)" << std::endl << json << std::endl;
#endif
this->setError(exc.what());
return 0;
}
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getUserDetails)" << std::endl << root << std::endl;
#endif
@ -214,25 +218,7 @@ int API::getUserDetails()
this->user.notifications_forum = root["user"]["notifications"]["forum"].isInt() ? root["user"]["notifications"]["forum"].asInt() : std::stoi(root["user"]["notifications"]["forum"].asString());
this->user.notifications_games = root["user"]["notifications"]["games"].isInt() ? root["user"]["notifications"]["games"].asInt() : std::stoi(root["user"]["notifications"]["games"].asString());
this->user.notifications_messages = root["user"]["notifications"]["messages"].isInt() ? root["user"]["notifications"]["messages"].asInt() : std::stoi(root["user"]["notifications"]["messages"].asString());
res = 1;
}
else
{
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getUserDetails)" << std::endl << json << std::endl;
#endif
this->setError(jsonparser->getFormattedErrorMessages());
res = 0;
}
delete jsonparser;
}
else
{
this->setError("Found nothing in " + url);
res = 0;
}
return res;
return 1;
}
@ -311,12 +297,24 @@ gameDetails API::getGameDetails(const std::string& game_name, const unsigned int
url = this->config.get_game_details + game_name + "/" + "installer_win_en"; // can't get game details without file id, any file id seems to return all details which is good for us
std::string json = this->getResponseOAuth(url);
if (!json.empty())
{
if (json.empty()) {
this->setError("Found nothing in " + url);
return game;
}
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, root))
{
std::istringstream json_stream(json);
try {
json_stream >> root;
} catch (Json::Exception exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getGameDetails)" << std::endl << json << std::endl;
#endif
this->setError(exc.what());
return game;
}
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getGameDetails)" << std::endl << root << std::endl;
#endif
@ -559,20 +557,6 @@ gameDetails API::getGameDetails(const std::string& game_name, const unsigned int
}
}
}
}
else
{
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getGameDetails)" << std::endl << json << std::endl;
#endif
this->setError(jsonparser->getFormattedErrorMessages());
}
delete jsonparser;
}
else
{
this->setError("Found nothing in " + url);
}
return game;
}
@ -584,32 +568,30 @@ std::string API::getInstallerLink(const std::string& game_name, const std::strin
url = this->config.get_installer_link + game_name + "/" + id + "/";
std::string json = this->getResponseOAuth(url);
if (!json.empty())
{
if (json.empty()) {
this->setError("Found nothing in " + url);
return link;
}
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, root))
{
std::istringstream json_stream(json);
try {
json_stream >> root;
} catch (const Json::Exception& exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getInstallerLink)" << std::endl << json << std::endl;
#endif
this->setError(exc.what());
return link;
}
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getInstallerLink)" << std::endl << root << std::endl;
#endif
int available = root["file"]["available"].isInt() ? root["file"]["available"].asInt() : std::stoi(root["file"]["available"].asString());
if (available)
link = root["file"]["link"].asString();
}
else
{
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getInstallerLink)" << std::endl << json << std::endl;
#endif
this->setError(jsonparser->getFormattedErrorMessages());
}
delete jsonparser;
}
else
{
this->setError("Found nothing in " + url);
}
return link;
}
@ -620,32 +602,30 @@ std::string API::getExtraLink(const std::string& game_name, const std::string& i
url = this->config.get_extra_link + game_name + "/" + id + "/";
std::string json = this->getResponseOAuth(url);
if (!json.empty())
{
if (json.empty()) {
this->setError("Found nothing in " + url);
return link;
}
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, root))
{
std::istringstream json_stream(json);
try {
json_stream >> root;
} catch (const Json::Exception& exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getExtraLink)" << std::endl << json << std::endl;
#endif
this->setError(exc.what());
return link;
}
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getExtraLink)" << std::endl << root << std::endl;
#endif
int available = root["file"]["available"].isInt() ? root["file"]["available"].asInt() : std::stoi(root["file"]["available"].asString());
if (available)
link = root["file"]["link"].asString();
}
else
{
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getExtraLink)" << std::endl << json << std::endl;
#endif
this->setError(jsonparser->getFormattedErrorMessages());
}
delete jsonparser;
}
else
{
this->setError("Found nothing in " + url);
}
return link;
}
@ -666,12 +646,16 @@ std::string API::getXML(const std::string& game_name, const std::string& id)
url = this->config.get_installer_link + game_name + "/" + id + "/crc/";
std::string json = this->getResponseOAuth(url);
if (!json.empty())
{
if (json.empty()) {
this->setError("Found nothing in " + url);
return XML;
}
try {
std::istringstream iss(json);
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, root))
{
iss >> root;
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getXML)" << std::endl << root << std::endl;
#endif
@ -681,19 +665,11 @@ std::string API::getXML(const std::string& game_name, const std::string& id)
url = root["file"]["link"].asString();
XML = this->getResponse(url);
}
}
else
{
} catch (const Json::Exception& exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (API::getXML)" << std::endl << json << std::endl;
#endif
this->setError(jsonparser->getFormattedErrorMessages());
}
delete jsonparser;
}
else
{
this->setError("Found nothing in " + url);
this->setError(exc.what());
}
return XML;

View File

@ -121,9 +121,8 @@ Downloader::Downloader()
{
std::ifstream ifs(Globals::galaxyConf.getFilepath(), std::ifstream::binary);
Json::Value json;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(ifs, json))
{
try {
ifs >> json;
if (!json.isMember("expires_at"))
{
std::time_t last_modified = boost::filesystem::last_write_time(Globals::galaxyConf.getFilepath());
@ -132,13 +131,10 @@ Downloader::Downloader()
}
Globals::galaxyConf.setJSON(json);
}
else
{
} catch (const Json::Exception& exc) {
std::cerr << "Failed to parse " << Globals::galaxyConf.getFilepath() << std::endl;
std::cerr << jsonparser->getFormattedErrorMessages() << std::endl;
std::cerr << exc.what() << std::endl;
}
delete jsonparser;
if (ifs)
ifs.close();
@ -739,8 +735,6 @@ void Downloader::repair()
if (this->games.empty())
this->getGameDetails();
Json::Reader *jsonparser = new Json::Reader;
// Create a vector containing all game files
std::vector<gameFile> vGameFiles;
for (unsigned int i = 0; i < games.size(); ++i)
@ -793,7 +787,13 @@ void Downloader::repair()
std::cerr << "Found nothing in " << vGameFiles[i].galaxy_downlink_json_url << ", skipping file" << std::endl;
continue;
}
jsonparser->parse(response, downlinkJson);
try {
std::istringstream iss(response);
iss >> downlinkJson;
} catch (const Json::Exception& exc) {
std::cerr << "Could not parse JSON response, skipping file" << std::endl;
continue;
}
if (!downlinkJson.isMember("downlink"))
{
@ -827,8 +827,6 @@ void Downloader::repair()
std::cout << std::endl;
}
}
delete jsonparser;
}
void Downloader::download()
@ -2237,18 +2235,21 @@ int Downloader::loadGameDetailsCache()
std::ifstream json(cachepath, std::ifstream::binary);
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, root))
{
try {
json >> root;
} catch (const Json::Exception& exc) {
std::cout << "Failed to parse cache" << std::endl;
std::cout << exc.what() << std::endl;
return 2;
}
if (root.isMember("date"))
{
cachedate = bptime::from_iso_string(root["date"].asString());
if ((now - cachedate) > bptime::minutes(Globals::globalConfig.iCacheValid))
{
// cache is too old
delete jsonparser;
json.close();
return res = 3;
return 3;
}
}
@ -2258,32 +2259,16 @@ int Downloader::loadGameDetailsCache()
if (iCacheVersion != GlobalConstants::GAMEDETAILS_CACHE_VERSION)
{
res = 5;
return 5;
}
else
{
if (root.isMember("games"))
{
this->games = getGameDetailsFromJsonNode(root["games"]);
res = 0;
return 0;
}
else
{
res = 4;
}
}
}
else
{
res = 2;
std::cout << "Failed to parse cache" << std::endl;
std::cout << jsonparser->getFormattedErrorMessages() << std::endl;
}
delete jsonparser;
if (json)
json.close();
return res;
return 4;
}
/* Save game details to cache file
returns 0 if successful
@ -2318,8 +2303,7 @@ int Downloader::saveGameDetailsCache()
}
else
{
Json::StyledStreamWriter jsonwriter;
jsonwriter.write(ofs, json);
ofs << json << std::endl;
ofs.close();
}
return res;
@ -2638,8 +2622,6 @@ void Downloader::processDownloadQueue(Config conf, const unsigned int& tid)
}
}
Json::Reader *jsonparser = new Json::Reader;
CURL* dlhandle = curl_easy_init();
curl_easy_setopt(dlhandle, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(dlhandle, CURLOPT_USERAGENT, conf.curlConf.sUserAgent.c_str());
@ -2736,7 +2718,6 @@ void Downloader::processDownloadQueue(Config conf, const unsigned int& tid)
{
msgQueue.push(Message("Galaxy API failed to refresh login", MSGTYPE_ERROR, msg_prefix));
vDownloadInfo[tid].setStatus(DLSTATUS_FINISHED);
delete jsonparser;
delete galaxy;
return;
}
@ -2751,7 +2732,14 @@ void Downloader::processDownloadQueue(Config conf, const unsigned int& tid)
msgQueue.push(Message("Found nothing in " + gf.galaxy_downlink_json_url + ", skipping file", MSGTYPE_WARNING, msg_prefix));
continue;
}
jsonparser->parse(response, downlinkJson);
try {
std::istringstream iss(response);
iss >> downlinkJson;
} catch (const Json::Exception& exc) {
msgQueue.push(Message("Could not parse JSON response, skipping file", MSGTYPE_WARNING, msg_prefix));
continue;
}
if (!downlinkJson.isMember("downlink"))
{
@ -2962,7 +2950,6 @@ void Downloader::processDownloadQueue(Config conf, const unsigned int& tid)
}
curl_easy_cleanup(dlhandle);
delete jsonparser;
delete galaxy;
vDownloadInfo[tid].setStatus(DLSTATUS_FINISHED);
@ -3316,8 +3303,7 @@ void Downloader::saveGalaxyJSON()
}
else
{
Json::StyledStreamWriter jsonwriter;
jsonwriter.write(ofs, Globals::galaxyConf.getJSON());
ofs << Globals::galaxyConf.getJSON() << std::endl;
ofs.close();
}
if (!Globals::globalConfig.bRespectUmask)

View File

@ -10,6 +10,7 @@
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/zlib.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <sstream>
GalaxyConfig Globals::galaxyConf;
@ -78,19 +79,19 @@ bool galaxyAPI::refreshLogin()
+ "&refresh_token=" + Globals::galaxyConf.getRefreshToken();
std::string json = this->getResponse(refresh_url);
if (!json.empty())
{
if (json.empty())
return false;
Json::Value token_json;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, token_json))
{
std::istringstream json_stream(json);
try {
json_stream >> token_json;
Globals::galaxyConf.setJSON(token_json);
res = true;
}
delete jsonparser;
} catch (const Json::Exception& exc) {
return false;
}
return res;
return true;
}
bool galaxyAPI::isTokenExpired()
@ -145,59 +146,47 @@ std::string galaxyAPI::getResponse(const std::string& url, const bool& zlib_deco
Json::Value galaxyAPI::getProductBuilds(const std::string& product_id, const std::string& platform, const std::string& generation)
{
std::string url = "https://content-system.gog.com/products/" + product_id + "/os/" + platform + "/builds?generation=" + generation;
std::istringstream response(this->getResponse(url));
Json::Value json;
std::string url = "https://content-system.gog.com/products/" + product_id + "/os/" + platform + "/builds?generation=" + generation;
std::string response = this->getResponse(url);
Json::Reader *jsonparser = new Json::Reader;
jsonparser->parse(response, json);
delete jsonparser;
response >> json;
return json;
}
Json::Value galaxyAPI::getManifestV1(const std::string& product_id, const std::string& build_id, const std::string& manifest_id, const std::string& platform)
{
std::string url = "https://cdn.gog.com/content-system/v1/manifests/" + product_id + "/" + platform + "/" + build_id + "/" + manifest_id + ".json";
std::istringstream response(this->getResponse(url));
Json::Value json;
std::string url = "https://cdn.gog.com/content-system/v1/manifests/" + product_id + "/" + platform + "/" + build_id + "/" + manifest_id + ".json";
std::string response = this->getResponse(url);
Json::Reader *jsonparser = new Json::Reader;
jsonparser->parse(response, json);
delete jsonparser;
response >> json;
return json;
}
Json::Value galaxyAPI::getManifestV2(std::string manifest_hash)
{
Json::Value json;
if (!manifest_hash.empty() && manifest_hash.find("/") == std::string::npos)
manifest_hash = this->hashToGalaxyPath(manifest_hash);
std::string url = "https://cdn.gog.com/content-system/v2/meta/" + manifest_hash;
std::string response = this->getResponse(url, true);
std::istringstream response(this->getResponse(url, true));
Json::Value json;
Json::Reader *jsonparser = new Json::Reader;
jsonparser->parse(response, json);
delete jsonparser;
response >> json;
return json;
}
Json::Value galaxyAPI::getSecureLink(const std::string& product_id, const std::string& path)
{
std::string url = "https://content-system.gog.com/products/" + product_id + "/secure_link?generation=2&path=" + path + "&_version=2";
std::istringstream response(this->getResponse(url));
Json::Value json;
std::string url = "https://content-system.gog.com/products/" + product_id + "/secure_link?generation=2&path=" + path + "&_version=2";
std::string response = this->getResponse(url);
Json::Reader *jsonparser = new Json::Reader;
jsonparser->parse(response, json);
delete jsonparser;
response >>json;
return json;
}
@ -257,14 +246,11 @@ std::vector<galaxyDepotItem> galaxyAPI::getDepotItemsVector(const std::string& h
Json::Value galaxyAPI::getProductInfo(const std::string& product_id)
{
std::string url = "https://api.gog.com/products/" + product_id + "?expand=downloads,expanded_dlcs,description,screenshots,videos,related_products,changelog&locale=en-US";
std::istringstream response(this->getResponse(url));
Json::Value json;
std::string url = "https://api.gog.com/products/" + product_id + "?expand=downloads,expanded_dlcs,description,screenshots,videos,related_products,changelog&locale=en-US";
std::string response = this->getResponse(url);
Json::Reader *jsonparser = new Json::Reader;
jsonparser->parse(response, json);
delete jsonparser;
response >> json;
return json;
}
@ -384,9 +370,10 @@ std::vector<gameFile> galaxyAPI::fileJsonNodeToGameFileVector(const std::string&
continue;
Json::Value downlinkJson;
Json::Reader *jsonparser = new Json::Reader;
jsonparser->parse(downlinkResponse, downlinkJson);
delete jsonparser;
Json::CharReaderBuilder builder;
std::istringstream downlink_stream(downlinkResponse);
JSONCPP_STRING errs;
Json::parseFromStream(builder, downlink_stream, &downlinkJson, &errs);
std::string downlink_url = downlinkJson["downlink"].asString();
std::string downlink_url_unescaped = (std::string)curl_easy_unescape(curlhandle, downlink_url.c_str(), downlink_url.size(), NULL);

View File

@ -235,9 +235,14 @@ int Util::getGameSpecificConfig(std::string gamename, gameSpecificConfig* conf,
std::ifstream json(filepath, std::ifstream::binary);
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, root))
{
try {
json >> root;
} catch (const Json::Exception& exc) {
std::cerr << "Failed to parse game specific config " << filepath << std::endl;
std::cerr << exc.what() << std::endl;
return res;
}
if (root.isMember("language"))
{
if (root["language"].isInt())
@ -308,16 +313,6 @@ int Util::getGameSpecificConfig(std::string gamename, gameSpecificConfig* conf,
conf->dirConf.sDLCSubdir = root["subdir-dlc"].asString();
res++;
}
}
else
{
std::cerr << "Failed to parse game specific config " << filepath << std::endl;
std::cerr << jsonparser->getFormattedErrorMessages() << std::endl;
}
delete jsonparser;
if (json)
json.close();
return res;
}

View File

@ -99,20 +99,20 @@ Json::Value Website::getGameDetailsJSON(const std::string& gameid)
// Parse JSON
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
if (!jsonparser->parse(json, root))
{
std::istringstream json_stream(json);
try {
json_stream >> root;
} catch(const Json::Exception& exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (Website::getGameDetailsJSON)" << std::endl << json << std::endl;
#endif
std::cout << jsonparser->getFormattedErrorMessages();
delete jsonparser;
std::cout << exc.what();
exit(1);
}
#ifdef DEBUG
std::cerr << "DEBUG INFO (Website::getGameDetailsJSON)" << std::endl << root << std::endl;
#endif
delete jsonparser;
return root;
}
@ -122,22 +122,22 @@ std::vector<gameItem> Website::getGames()
{
std::vector<gameItem> games;
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
int i = 1;
bool bAllPagesParsed = false;
do
{
std::string response = this->getResponse("https://www.gog.com/account/getFilteredProducts?hasHiddenProducts=false&hiddenFlag=0&isUpdated=0&mediaType=1&sortBy=title&system=&page=" + std::to_string(i));
std::istringstream json_stream(response);
try {
// Parse JSON
if (!jsonparser->parse(response, root))
{
json_stream >> root;
} catch (const Json::Exception& exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (Website::getGames)" << std::endl << response << std::endl;
#endif
std::cout << jsonparser->getFormattedErrorMessages();
delete jsonparser;
std::cout << exc.what();
if (!response.empty())
{
if(response[0] != '{')
@ -269,8 +269,6 @@ std::vector<gameItem> Website::getGames()
} while (!bAllPagesParsed);
std::cerr << std::endl;
delete jsonparser;
return games;
}
@ -278,20 +276,21 @@ std::vector<gameItem> Website::getGames()
std::vector<gameItem> Website::getFreeGames()
{
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
std::vector<gameItem> games;
std::string json = this->getResponse("https://www.gog.com/games/ajax/filtered?mediaType=game&page=1&price=free&sort=title");
std::istringstream json_stream(json);
try {
// Parse JSON
if (!jsonparser->parse(json, root))
{
json_stream >> root;
} catch (const Json::Exception& exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (Website::getFreeGames)" << std::endl << json << std::endl;
#endif
std::cout << jsonparser->getFormattedErrorMessages();
delete jsonparser;
std::cout << exc.what();
exit(1);
}
#ifdef DEBUG
std::cerr << "DEBUG INFO (Website::getFreeGames)" << std::endl << root << std::endl;
#endif
@ -304,7 +303,6 @@ std::vector<gameItem> Website::getFreeGames()
game.id = products[i]["id"].isInt() ? std::to_string(products[i]["id"].asInt()) : products[i]["id"].asString();
games.push_back(game);
}
delete jsonparser;
return games;
}
@ -506,18 +504,16 @@ int Website::Login(const std::string& email, const std::string& password)
if (!json.empty())
{
Json::Value token_json;
Json::Reader *jsonparser = new Json::Reader;
if (jsonparser->parse(json, token_json))
{
std::istringstream json_stream(json);
try {
json_stream >> token_json;
Globals::galaxyConf.setJSON(token_json);
res = 2;
}
else
{
} catch (const Json::Exception& exc) {
std::cerr << "Failed to parse json" << std::endl << json << std::endl;
std::cerr << jsonparser->getFormattedErrorMessages() << std::endl;
std::cerr << exc.what() << std::endl;
}
delete jsonparser;
}
}
@ -608,23 +604,24 @@ bool Website::IsloggedInSimple()
std::vector<wishlistItem> Website::getWishlistItems()
{
Json::Value root;
Json::Reader *jsonparser = new Json::Reader;
Json::CharReaderBuilder builder;
int i = 1;
bool bAllPagesParsed = false;
std::vector<wishlistItem> wishlistItems;
do
{
std::string response = this->getResponse("https://www.gog.com/account/wishlist/search?hasHiddenProducts=false&hiddenFlag=0&isUpdated=0&mediaType=0&sortBy=title&system=&page=" + std::to_string(i));
std::string response(this->getResponse("https://www.gog.com/account/wishlist/search?hasHiddenProducts=false&hiddenFlag=0&isUpdated=0&mediaType=0&sortBy=title&system=&page=" + std::to_string(i)));
std::istringstream response_stream(response);
try {
// Parse JSON
if (!jsonparser->parse(response, root))
{
response_stream >> root;
} catch(const Json::Exception exc) {
#ifdef DEBUG
std::cerr << "DEBUG INFO (Website::getWishlistItems)" << std::endl << response << std::endl;
#endif
std::cout << jsonparser->getFormattedErrorMessages();
delete jsonparser;
std::cout << exc.what();
exit(1);
}
#ifdef DEBUG
@ -712,7 +709,5 @@ std::vector<wishlistItem> Website::getWishlistItems()
i++;
} while (!bAllPagesParsed);
delete jsonparser;
return wishlistItems;
}