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

35
LINES

< > BotCompany Repo | #1005219 // Parse One-Liners On Pouet Homepage [superseded by pouetOneLiners()]

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

Libraryless. Click here for Pure Java version (2988L/22K/67K).

!752

sclass OneLiner {
  S userName;
  S contents; // html
}

p {
  S html = loadNTSnippet("#3000394");
  psl(getOneLiners(html));
}

static L<OneLiner> getOneLiners(S html) {
  new L<OneLiner> out;
  L<S> tok = htmlTok(html);

  int i = tok.indexOf("<div class='pouettbl' id='pouetbox_latestoneliner'>");
  if (i >= 0) {
    int j = findEndOfContainerTag(tok, i);
    if (j >= 0) {
      L<S> tok2 = subList(tok, i+1, j-1);
      //psl(tok2);
      L<L<S>> l = unwrapContainerTags(findContainerTag(tok2, "li"));
      for (L<S> tok3 : l) pcall {
        psl(tok3);
        int k = tok3.indexOf("/a");
        new OneLiner o;
        o.userName = getHtmlTagParameter(tok3.get(1), "title");
        o.contents = join(subList(tok3, k+1));
        out.add(o);
      }
    }
  }
  ret out;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005219
Snippet name: Parse One-Liners On Pouet Homepage [superseded by pouetOneLiners()]
Eternal ID of this version: #1005219/1
Text MD5: f7a234168dfa703b996ddfb1bfd7c79d
Transpilation MD5: cde166ee316d3091222279cbf4e903b7
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-10-24 01:36:18
Source code size: 822 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 598 / 634
Referenced in: #1005225 - pouetOneLiners