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

41
LINES

< > BotCompany Repo | #1000671 // Listen to commands on blog.

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (130L/2K/5K).

1  
!636
2  
!modern
3  
4  
main {
5  
  psvm {
6  
    S s = load("tinybrain.blog.de");
7  
    L<S> tok = htmlcoarsetok(s);
8  
    for (int i = 0; i+1 < tok.size(); i += 2) {
9  
      String t = tok.get(i);
10  
      
11  
      if (tok.get(i+1).equals("<blockquote>")) {
12  
        int j = i+1;
13  
        while (j < tok.size() && !tok.get(j).equals("</blockquote>"))
14  
          j += 2;
15  
        i = j+1;
16  
        continue;
17  
      }
18  
      
19  
      if (t.indexOf("Computer!") < 0) continue;
20  
      print("!!! " + t);
21  
      if (tok.get(i+3).equals("<blockquote>")) {
22  
        int j = i+3;
23  
        while (j < tok.size() && !tok.get(j).equals("</blockquote>"))
24  
          j += 2;
25  
          
26  
        new StringBuilder buf;
27  
        for (i = i+4; i < j; i += 2)
28  
          buf.append(tok.get(i) + "\n");
29  
        String code = buf.toString();
30  
        code = code.replace("&lt;", "<");
31  
        code = code.replace("&gt;", ">");
32  
        code = code.replace("\n\n", "\n");
33  
        print("Code:\n" + indent("  ", code));
34  
      }
35  
    }
36  
  }
37  
  
38  
  static S load(String bla) ctex {
39  
    return loadPage(bla);
40  
  }
41  
}

Author comment

Began life as a copy of #1000669

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000671
Snippet name: Listen to commands on blog.
Eternal ID of this version: #1000671/1
Text MD5: d2e964be0adedc46cf68e479554dcbbb
Transpilation MD5: aba6ff6ac4e2edf2a48865018956a040
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-21 23:50:57
Source code size: 1084 bytes / 41 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 618 / 670
Referenced in: [show references]