Fix #9: Make sure that in case of error returned by the YouTube Data API v3 the algorithm treats it correctly

Note that in case of error the algorithm used to skip the received content, as if just no `items` were in it.
This commit is contained in:
Benjamin Loison 2023-01-06 20:55:32 +01:00
parent 34bbc216f6
commit 71e4bd95a9
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -342,6 +342,12 @@ json getJson(unsigned short threadId, string url, string directoryPath)
exit(1); exit(1);
} }
if(data.contains("error"))
{
PRINT(threadId, "Found error in JSON at URL: " << finalUrl << " for content: " << content << " !")
return getJson(threadId, url, directoryPath);
}
ostringstream toString; ostringstream toString;
toString << CHANNELS_DIRECTORY << directoryPath << "/" << requestsPerChannel << ".json"; toString << CHANNELS_DIRECTORY << directoryPath << "/" << requestsPerChannel << ".json";
requestsPerChannel++; requestsPerChannel++;