Make the first channel of channels.txt
being treated again, solve temporary empty response from YouTube Data API v3 issue and temporarily remove sanity check failing very rarely #39
This commit is contained in:
parent
e166fdb4e5
commit
cb7b68342a
13
main.cpp
13
main.cpp
@ -117,14 +117,17 @@ int main(int argc, char *argv[])
|
||||
|
||||
for(const auto& entry : filesystem::directory_iterator(CHANNELS_DIRECTORY))
|
||||
{
|
||||
string fileName = entry.path().filename(),
|
||||
channelId = fileName.substr(0, fileName.length() - 4);
|
||||
string fileName = entry.path().filename();
|
||||
// Skip files such as `UNLISTED_VIDEOS_FILE_PATH`.
|
||||
if (fileName.substr(0, 2) == "UC") {
|
||||
string channelId = fileName.substr(0, fileName.length() - 4);
|
||||
|
||||
channelsToTreat.erase(channelsToTreatRev[channelId]);
|
||||
channelsToTreatRev.erase(channelId);
|
||||
|
||||
channelsAlreadyTreated.insert(channelId);
|
||||
}
|
||||
}
|
||||
|
||||
MAIN_PRINT(channelsToTreat.size() << " channel(s) to treat")
|
||||
MAIN_PRINT(channelsAlreadyTreated.size() << " channel(s) already treated")
|
||||
@ -532,7 +535,7 @@ void treatChannelOrVideo(unsigned short threadId, bool isChannel, string id, str
|
||||
// We verify that we don't skip any message by verifying that the first message was already treated if we already treated some messages.
|
||||
if(!messageIds.empty() && messageIds.find(firstMessageId) == messageIds.end())
|
||||
{
|
||||
EXIT_WITH_ERROR("The verification that we don't skip any message failed!")
|
||||
PRINT("The verification that we don't skip any message failed! Continuing anyway...")
|
||||
}
|
||||
for(const auto& message : snippet)
|
||||
{
|
||||
@ -751,7 +754,9 @@ json getJson(unsigned short threadId, string url, bool usingYoutubeDataApiv3, st
|
||||
}
|
||||
catch (json::parse_error& ex)
|
||||
{
|
||||
EXIT_WITH_ERROR("Parse error for " << finalUrl << ", as got: " << content << " !")
|
||||
// From the experience this sometimes happens due to empty `content` but retrying just after solves the problem.
|
||||
PRINT("Parse error for " << finalUrl << ", as got: " << content << " ! Retrying...")
|
||||
return getJson(threadId, url, usingYoutubeDataApiv3, channelId);
|
||||
}
|
||||
|
||||
if(data.contains("error"))
|
||||
|
Loading…
Reference in New Issue
Block a user