Libraryless. Click here for Pure Java version (2988L/22K/67K).
1 | !752 |
2 | |
3 | sclass OneLiner { |
4 | S userName; |
5 | S contents; // html |
6 | } |
7 | |
8 | p { |
9 | S html = loadNTSnippet("#3000394"); |
10 | psl(getOneLiners(html)); |
11 | } |
12 | |
13 | static L<OneLiner> getOneLiners(S html) { |
14 | new L<OneLiner> out; |
15 | L<S> tok = htmlTok(html); |
16 | |
17 | int i = tok.indexOf("<div class='pouettbl' id='pouetbox_latestoneliner'>"); |
18 | if (i >= 0) { |
19 | int j = findEndOfContainerTag(tok, i); |
20 | if (j >= 0) { |
21 | L<S> tok2 = subList(tok, i+1, j-1); |
22 | //psl(tok2); |
23 | L<L<S>> l = unwrapContainerTags(findContainerTag(tok2, "li")); |
24 | for (L<S> tok3 : l) pcall { |
25 | psl(tok3); |
26 | int k = tok3.indexOf("/a"); |
27 | new OneLiner o; |
28 | o.userName = getHtmlTagParameter(tok3.get(1), "title"); |
29 | o.contents = join(subList(tok3, k+1)); |
30 | out.add(o); |
31 | } |
32 | } |
33 | } |
34 | ret out; |
35 | } |
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: | 599 / 635 |
Referenced in: | [show references] |