Libraryless. Click here for Pure Java version (2836L/20K/64K).
1 | !752 |
2 | |
3 | p { |
4 | S arg = or(get(args, 0), "#3000391"); |
5 | S s = loadSnippetOrPage(arg); |
6 | |
7 | L<S> tok = htmlTok(s); |
8 | |
9 | int n = 0; |
10 | for (int i : indexesOfLinesStartingWith(tok, "<div class='comment")) pcall { |
11 | int j = findEndOfContainerTag(tok, i); |
12 | L<S> tok2 = subList(tok, i+1, j-1); |
13 | //print("Yo: " + join(subList(tok, i, j)) + "\n"); |
14 | |
15 | j = indexOfStartsWith(tok2, "<div class='content'"); |
16 | int k = findEndOfContainerTag(tok2, j); |
17 | S comment = join(subList(tok2, j+1, k-1)).trim(); |
18 | |
19 | int u = indexOfEndsWith(tok2, "class='user'>"); |
20 | S user = u < 0 ? "?" : tok2.get(u+1); |
21 | |
22 | S vote = "+-"; |
23 | if (tok2.contains("<span class='vote rulez'>")) |
24 | vote = "+"; |
25 | else if (tok2.contains("<span class='vote sucks'>")) |
26 | vote = "-"; |
27 | |
28 | //print(vote + " comment by " + quote(user) + ": " + htmldecode(comment)); |
29 | print(htmldecode(comment)); |
30 | print(" " + vote + " [" + user + "]"); |
31 | print(); |
32 | ++n; |
33 | } |
34 | |
35 | print(n(n, "comment") + " found on " + arg); |
36 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003988 |
Snippet name: | Parse Pouet Comments [works] |
Eternal ID of this version: | #1003988/1 |
Text MD5: | 1e66c76fede2c285cd37aae0d42e7b00 |
Transpilation MD5: | f662f3399e1efe499559d358625d5343 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-10-23 23:09:02 |
Source code size: | 1041 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 663 / 718 |
Referenced in: | [show references] |