diff --git a/src/grabber/AutoNovel.java b/src/grabber/AutoNovel.java index f9f9625..3da5e2c 100644 --- a/src/grabber/AutoNovel.java +++ b/src/grabber/AutoNovel.java @@ -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; @@ -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; @@ -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()); } diff --git a/src/grabber/HostSettings.java b/src/grabber/HostSettings.java index 606b9ef..54b0881 100644 --- a/src/grabber/HostSettings.java +++ b/src/grabber/HostSettings.java @@ -34,7 +34,8 @@ public class HostSettings { "Dreame", "Fanfiktion", "WuxiaWorld.online", - "Novelfull" + "Novelfull", + "WuxiaWorld.site" }; private static String[] autoChapterToChapterWebsites = { @@ -42,7 +43,8 @@ public class HostSettings { private static String[] headerlessBrowserWebsites = { "Creative Novels", "FicFun", - "Dreame" + "Dreame", + "WuxiaWorld.site" }; private static String[] noHeaderlessBrowserWebsites = { "Wattpad", // pages broken @@ -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; } } }