Libraryless. Click here for Pure Java version (7630L/51K/170K).
1 | !7 |
2 | |
3 | sS botID = #1008316; // #1008533; |
4 | |
5 | sclass Msg { |
6 | long time; |
7 | bool fromUser; |
8 | S text; |
9 | |
10 | *() {} |
11 | *(bool *fromUser, S *text) { time = now(); } |
12 | } |
13 | |
14 | concept Conversation { |
15 | S cookie; |
16 | long dialogID; |
17 | new L<Msg> msgs; |
18 | |
19 | void add(Msg m) { |
20 | msgs.add(m); |
21 | change(); |
22 | } |
23 | } |
24 | |
25 | p { |
26 | S html = loadPage("http://ai1.lol/" + psI(botID) + "/raw/logs"); |
27 | for (L<S> li : html_contentsOfLIs(html)) { |
28 | S dialogID = assertInteger(first(li)); |
29 | print("\nDialog " + dialogID); |
30 | new Conversation conv; |
31 | conv.dialogID = parseLong(dialogID); |
32 | for (L<S> li2 : html_contentsOfLIs(li)) { |
33 | S msg = htmldecode(join(li2)); |
34 | new Msg m; |
35 | if (msg.startsWith(">")) m.fromUser = true; |
36 | else if (!msg.startsWith("<")) { |
37 | warn("Unknown line: " + msg); |
38 | continue; |
39 | } |
40 | m.text = trim(substring(msg, 1)); |
41 | conv.add(m); |
42 | printStruct(m); |
43 | } |
44 | } |
45 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008536 |
Snippet name: | Read Web Bot's Chat Log [OK] |
Eternal ID of this version: | #1008536/10 |
Text MD5: | f6fda5a81fe797e70ce6788edc4d7a4d |
Transpilation MD5: | f9a343f2f4f21fafe70b0ba30a4d8c26 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-05-30 16:44:54 |
Source code size: | 935 bytes / 45 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 570 / 636 |
Version history: | 9 change(s) |
Referenced in: | [show references] |