sclass YTChatMessage { S text, publishedAt, authorChannelId, authorDisplayName; } sclass YTChatMessages { S nextPageToken; int pollingIntervalMillis; L messages; } static YTChatMessages youTubeGetChatMessages(S liveStreamID) { ret youTubeGetChatMessages(liveStreamID, null); } static YTChatMessages youTubeGetChatMessages(S liveStreamID, S pageToken) { S page = loadPageWithParamsSilently("https://www.googleapis.com/youtube/v3/liveChat/messages", liveChatId := liveStreamID, part := "id,snippet,authorDetails", +pageToken, key := youTubeDataAPIKey()); Map map = jsonDecodeMap(page); //printStruct(map); L items = cast map.get('items); ret nu(YTChatMessages, nextPageToken := getString(map, 'nextPageToken), pollingIntervalMillis := getInt(map, 'pollingIntervalMillis), messages := map(items, func(Map item) -> YTChatMessage { Map snippet = (Map) item.get('snippet); Map textMessageDetails = (Map) _get(snippet, 'textMessageDetails); Map authorDetails = (Map) _get(item, 'authorDetails); ret nu(YTChatMessage, text := getString(textMessageDetails, 'messageText), publishedAt := getString(snippet, 'publishedAt), authorChannelId := getString(snippet, 'authorChannelId), authorDisplayName := getString(authorDetails, 'displayName)); })); }