From 71e4bd95a95c9133289c2da801914d91133b53a0 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Fri, 6 Jan 2023 20:55:32 +0100 Subject: [PATCH] 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. --- main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.cpp b/main.cpp index 5a79c70..ba10767 100644 --- a/main.cpp +++ b/main.cpp @@ -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++;