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

16
LINES

< > BotCompany Repo | #1028650 // webBotTester_extractMsgs [depends on templates #1028282 etc.]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4754L/31K).

static L<WebChatBotMsg> webBotTester_extractMsgs(S html) {
  new L<WebChatBotMsg> out;
  LLS msgs = findContainerTagWithClass(htmlTok(html), "span", "chat_msg_item");
  for (LS tokMsg : msgs) {
    new WebChatBotMsg msg;
    msg.fullHTML = trimJoin(tokMsg);
    LS tokMsg2 = dropFirstTwoAndLastTwo(tokMsg);
    for (LS srSpan : findContainerTagWithClass(tokMsg2, "span", "sr-only"))
      setAllToEmptyString(dropFirstAndLast2(srSpan));
    msg.fromUser = tagHasClass(tokMsg, "chat_msg_item_user");
    msg.msgHTML = trimJoin(tokMsg2);
    msg.msgText = trim(htmldecode_dropAllTags(msg.msgHTML));
    out.add(msg);
  }
  ret out;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028650
Snippet name: webBotTester_extractMsgs [depends on templates #1028282 etc.]
Eternal ID of this version: #1028650/10
Text MD5: 12168146650a19aebd2a7d63e66799ed
Transpilation MD5: c89cc724aae25e647f79907aeb6ea088
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-02 13:30:22
Source code size: 646 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 203 / 315
Version history: 9 change(s)
Referenced in: [show references]