Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

33
LINES

< > BotCompany Repo | #1020364 // Follow YouTube Live Stream Chat Messages [OK]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (15023L/105K).

!7

module FollowLiveStreamChat > DynPrintLog {
  S videoID = "https://www.youtube.com/watch?v=hGmdFxQ80vE";

  transient S liveStreamID;
  transient S pageToken;
  transient L<YTChatMessage> messages = synchroList();
  
  start {
    thread "Grab Live Stream Chat" {
      while licensed {
        try {
          setField(liveStreamID := youTubeGetLiveStreamID(videoID));
          while licensed {
            YTChatMessages result = youTubeGetChatMessages(liveStreamID, pageToken);
            programLogStruct(result);
            if (nempty(result.messages))
              print("Got " + n2(result.messages, "message") + " from live stream chat");
            for (YTChatMessage msg : result.messages) {
              print("> " + msg.publishedAt + " [" + msg.authorDisplayName + "] " + msg.text);
              vmBus_send('gotYouTubeLiveStreamMessage, msg);
            }
            pageToken = result.nextPageToken;
            sleep(result.pollingIntervalMillis + 1000);
          }
        } on fail {
          sleepSeconds(10.0);
        }
      }
    }
  }
}

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: #1020364
Snippet name: Follow YouTube Live Stream Chat Messages [OK]
Eternal ID of this version: #1020364/11
Text MD5: 6f1f6684b56824b98ec9083950779678
Transpilation MD5: 20aee54392b50c2d8c62795c6dbaff9e
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-16 22:46:11
Source code size: 1104 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 301 / 475
Version history: 10 change(s)
Referenced in: [show references]