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

44
LINES

< > BotCompany Repo | #1000849 // Get names of some parties from pouet (with links, static)

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

Libraryless. Click here for Pure Java version (741L/7K/20K).

1  
!747
2  
3  
m {
4  
  static class Party { S name, link, weblink; }
5  
  static new L<Party> parties;
6  
  
7  
  static S html; // can set this from client programs
8  
9  
  !include #1000850 // TableFinder
10  
  
11  
  p {
12  
    // get html
13  
    
14  
    if (html == null) {
15  
      S htmlID = "#3000025";
16  
      if (args.length != 0) htmlID = args[0];
17  
      html = loadSnippet(htmlID);
18  
    }
19  
20  
    // analysis
21  
    
22  
    new TableFinder tf;
23  
    tf.go(html);
24  
    for (int i = 1; i < tf.data.size(); i++) {
25  
      S cell = tf.data.get(i).get(0);
26  
      parseParty(htmlcoarsetok(cell));
27  
    }
28  
    
29  
    // print success!
30  
    
31  
    print(parties.size() + " parties found!");
32  
  }
33  
  
34  
  static void parseParty(L<S> tok) {
35  
    if (tok.size() == 1) return;
36  
    new Party p;
37  
    p.name = htmldecode(tok.get(2));
38  
    p.link = linkFrom(tok.get(1));
39  
    if (tok.size() > 5)
40  
      p.weblink = linkFrom(tok.get(5));
41  
    print("Party found! " + structure(p));
42  
    parties.add(p);
43  
  }
44  
}

Author comment

Began life as a copy of #1000846

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: #1000849
Snippet name: Get names of some parties from pouet (with links, static)
Eternal ID of this version: #1000849/1
Text MD5: 6a5465c920dfa2d95d3ec138bd7200da
Transpilation MD5: 34b3fa7c63c5d3c21413ff1e4301cd7f
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-30 17:34:53
Source code size: 964 bytes / 44 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 700 / 919
Referenced in: [show references]