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).

1  
!7
2  
3  
p {
4  
  //set loadPage_debug;
5  
  S baseURL = "http://legend.freebooks2017.org/Legend_1/";
6  
  int page = 1;
7  
  
8  
  while licensed {
9  
    S html = loadPageWithUserAgent(pageURL(baseURL, page), "Mac Safari");
10  
    L<S> paragraphs = map(f htmldecode_dropAllTags, contentsOfPTags(html));
11  
    //printNumberedLines(paragraphs);
12  
    print("\n#PAGE " + page + "#");
13  
    for (S p : paragraphs) {
14  
      print("#P#");
15  
      print(p);
16  
    }
17  
    ++page;
18  
    if (!html.contains("index_" + page + ".html"))
19  
      break;
20  
  }
21  
}
22  
23  
sS pageURL(S baseURL, int page) {
24  
  baseURL = addSlash(baseURL);
25  
  if (page <= 0) fail("woot");
26  
  else if (page == 1) ret baseURL;
27  
  else ret baseURL + "index_" + page + ".html";
28  
}

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: 449 / 510
Version history: 11 change(s)
Referenced in: [show references]