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 156a621413
commit e3cab4c204

View File

@ -342,6 +342,12 @@ json getJson(unsigned short threadId, string url, string directoryPath)
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;
toString << CHANNELS_DIRECTORY << directoryPath << "/" << requestsPerChannel << ".json";
requestsPerChannel++;