Libraryless. Click here for Pure Java version (1643L/12K/37K).
!752 m { static bool real = false; static S html; static class Headline { S title, link, date, time; } static new L<Headline> headlines; p { html = real ? loadPage("http://tinybrain.blog.de") : loadSnippet("#3000133"); // puts all tags on even indices, all text on odd indices L<S> tok = htmlcoarsetok(html); //print(fromLines(tok)); S link = null; Headline hl = null; for (int i = 1; i < l(tok); i += 2) { S t = tok.get(i); if (tagIs(t, "a")) link = "http://tinybrain.blog.de" + tagGet(t, "href"); if (eqic(t, "<span class=\"name\">")) { headlines.add(hl = new Headline); hl.link = link; hl.title = htmldecode(tok.get(i+1)); print("Headline: " + hl.title); print(" Link: " + link); } if (eqic(t, "<span class=\"date\">") && hl != null && match("*-*-*", tok.get(i+1))) { hl.date = tok.get(i+1); print(" Date: " + hl.date); } if (eqic(t, "<span class=\"time\">") && hl != null) { int j = i+1; while (j < l(tok) && !match("*:*:*", tok.get(j))) j += 2; if (j < l(tok)) { hl.time = tok.get(j); print(" Time: " + hl.time); } } } } }
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: | #1001864 |
Snippet name: | Get headlines from blog (works) |
Eternal ID of this version: | #1001864/1 |
Text MD5: | 29998506457f5c000832f47f4a072419 |
Transpilation MD5: | b95c10c30987c6eaca4b23348878e5c5 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-11-30 20:42:02 |
Source code size: | 1347 bytes / 51 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 659 / 675 |
Referenced in: | #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |