Add a verification that snippet/authorChannelId/value isn't null when using commentThreads for COMMUNITY

As it can happen cf https://www.youtube.com/channel/UCWeg2Pkate69NFdBeuRFTAw/community?lc=UgwGfjNxGuwqP8qYPPN4AaABAg&lb=UgkxYiEAo9-b1vWPasxFy13f959rrctQpZwW
This commit is contained in:
Benjamin Loison 2023-02-09 01:51:22 +01:00
parent d0dee043c6
commit 01aac3f66e
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -357,9 +357,13 @@ void treatChannelOrVideo(unsigned short threadId, bool isChannel, string id, str
items = data["items"];
for(const auto& item : items)
{
json snippet = item["snippet"]["topLevelComment"]["snippet"];
string channelId = snippet["authorChannelId"]["value"];
json snippet = item["snippet"]["topLevelComment"]["snippet"],
authorChannelId = snippet["authorChannelId"];
if(!authorChannelId["value"].is_null())
{
string channelId = authorChannelId["value"];
addChannelToTreat(threadId, channelId);
}
string pageToken = snippet["nextPageToken"];
while(pageToken != "")
{