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).

1  
static L<WebChatBotMsg> webBotTester_extractMsgs(S html) {
2  
  new L<WebChatBotMsg> out;
3  
  LLS msgs = findContainerTagWithClass(htmlTok(html), "span", "chat_msg_item");
4  
  for (LS tokMsg : msgs) {
5  
    new WebChatBotMsg msg;
6  
    msg.fullHTML = trimJoin(tokMsg);
7  
    LS tokMsg2 = dropFirstTwoAndLastTwo(tokMsg);
8  
    for (LS srSpan : findContainerTagWithClass(tokMsg2, "span", "sr-only"))
9  
      setAllToEmptyString(dropFirstAndLast2(srSpan));
10  
    msg.fromUser = tagHasClass(tokMsg, "chat_msg_item_user");
11  
    msg.msgHTML = trimJoin(tokMsg2);
12  
    msg.msgText = trim(htmldecode_dropAllTags(msg.msgHTML));
13  
    out.add(msg);
14  
  }
15  
  ret out;
16  
}

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: 205 / 319
Version history: 9 change(s)
Referenced in: [show references]