sclass YTChatMessage { S text, publishedAt, authorChannelId, authorDisplayName; } sclass YTChatMessages { S nextPageToken; int pollingIntervalMillis; L<YTChatMessage> 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<Map> 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)); })); }
Began life as a copy of #1009898
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020354 |
Snippet name: | youTubeGetChatMessages [dev.] |
Eternal ID of this version: | #1020354/15 |
Text MD5: | d742bc1985dea079147e8f55f21bd159 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-16 18:29:55 |
Source code size: | 1404 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 337 / 419 |
Version history: | 14 change(s) |
Referenced in: | [show references] |