Skip to content

Commit

Permalink
Added wuxiaworld.site
Browse files Browse the repository at this point in the history
  • Loading branch information
Flameish committed Mar 1, 2020
1 parent 0107223 commit 0e1d98e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/grabber/AutoNovel.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ private void getChaptersJsoup() throws IOException {
}
// Get href link of last (first in novel context) chapter
String boxNovelFirstChapter = chapterLinks.get(chapterLinks.size()-1);
System.out.println(boxNovelFirstChapter);
String boxNovelbaseLinkStart = boxNovelFirstChapter.substring(0, shared.ordinalIndexOf(boxNovelFirstChapter, "/", 5) + 9);
String boxNovelChapterNumberString = boxNovelFirstChapter.substring(boxNovelbaseLinkStart.length());
int boxNovelChapterNumber;
Expand Down Expand Up @@ -291,7 +290,6 @@ private void getChaptersJsoup() throws IOException {
}
// Get href link of last (first in novel context) chapter
String wuxiaonlineFirstChapter = chapterLinks.get(chapterLinks.size() - 1);
System.out.println(wuxiaonlineFirstChapter);
String wuxiaonlinebaseLinkStart = wuxiaonlineFirstChapter.substring(0, shared.ordinalIndexOf(wuxiaonlineFirstChapter, "/", 4) + 9);
String wuxiaonlineChapterNumberString = wuxiaonlineFirstChapter.substring(wuxiaonlinebaseLinkStart.length());
int wuxiaonlineChapterNumber;
Expand Down Expand Up @@ -479,12 +477,16 @@ private void getChaptersHeaderless() {
case "https://dreame.com/":
driver.findElement(By.cssSelector(".button-round-purple")).click();
break;
case "https://wuxiaworld.site/":
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(currHostSettings.chapterLinkSelecter)));
System.out.println(tocDoc);
break;
}
// Parse html from headerless to Jsoup for faster interaction.
String baseUrl = driver.getCurrentUrl().substring(0, shared.ordinalIndexOf(driver.getCurrentUrl(), "/", 3) + 1);
// baseUrl (eg. wuxiaworld.com) is needed to get full href links
Document doc = Jsoup.parse(driver.getPageSource(), baseUrl);
for (Element chapterLink : doc.select(currHostSettings.chapterLinkSelecter)) {
tocDoc = Jsoup.parse(driver.getPageSource(), baseUrl);
for (Element chapterLink : tocDoc.select(currHostSettings.chapterLinkSelecter)) {
chapterLinks.add(chapterLink.attr("abs:href"));
chaptersNames.add(chapterLink.text());
}
Expand Down
20 changes: 18 additions & 2 deletions src/grabber/HostSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ public class HostSettings {
"Dreame",
"Fanfiktion",
"WuxiaWorld.online",
"Novelfull"
"Novelfull",
"WuxiaWorld.site"
};
private static String[] autoChapterToChapterWebsites = {

};
private static String[] headerlessBrowserWebsites = {
"Creative Novels",
"FicFun",
"Dreame"
"Dreame",
"WuxiaWorld.site"
};
private static String[] noHeaderlessBrowserWebsites = {
"Wattpad", // pages broken
Expand Down Expand Up @@ -451,6 +453,20 @@ public HostSettings(String domain, String urla) {
bookAuthorSelector = ".info > div:nth-child(1)";
bookSubjectSelector = ".info > div:nth-child(2)";
break;
case "wuxiaworld.site":
host = "https://wuxiaworld.site/";
ordinalIndexForBaseNovel = 5;
chapterLinkSelecter = ".listing-chapters_wrap a";
chapterContainer = ".text-left";
nextChapterBtn = ".btn.next_page";
titleHostName = "";
blacklistedTags = new LinkedList<>(Arrays.asList("script", "ad"));
bookTitleSelector = ".post-title h3";
bookDescSelector = "#editdescription";
bookCoverSelector = ".summary_image img";
bookAuthorSelector = ".author-content";
bookSubjectSelector = ".genres-content a";
break;
}
}
}

0 comments on commit 0e1d98e

Please sign in to comment.