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

28
LINES

< > BotCompany Repo | #1008405 // Parse Online Novel To Paragraphs [WORKS]

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

Libraryless. Click here for Pure Java version (1508L/12K/38K).

!7

p {
  //set loadPage_debug;
  S baseURL = "http://legend.freebooks2017.org/Legend_1/";
  int page = 1;
  
  while licensed {
    S html = loadPageWithUserAgent(pageURL(baseURL, page), "Mac Safari");
    L<S> paragraphs = map(f htmldecode_dropAllTags, contentsOfPTags(html));
    //printNumberedLines(paragraphs);
    print("\n#PAGE " + page + "#");
    for (S p : paragraphs) {
      print("#P#");
      print(p);
    }
    ++page;
    if (!html.contains("index_" + page + ".html"))
      break;
  }
}

sS pageURL(S baseURL, int page) {
  baseURL = addSlash(baseURL);
  if (page <= 0) fail("woot");
  else if (page == 1) ret baseURL;
  else ret baseURL + "index_" + page + ".html";
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008405
Snippet name: Parse Online Novel To Paragraphs [WORKS]
Eternal ID of this version: #1008405/12
Text MD5: 5a7435a547ece4156fc1da3f873740c3
Transpilation MD5: 8a822d0bdd169f2d3c0a049b43f02f5a
Author: stefan
Category: javax / html parsing
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-15 14:22:16
Source code size: 714 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 564 / 662
Version history: 11 change(s)
Referenced in: [show references]