From 45b55dbe84b0d1bf0707d5635dfc179a0f9b7ee5 Mon Sep 17 00:00:00 2001 From: freeok <51998152+freeok@users.noreply.github.com> Date: Tue, 24 Dec 2024 21:18:17 +0800 Subject: [PATCH] =?UTF-8?q?:tada:=20Release=20v1.7.2=20=F0=9F=8E=85?= =?UTF-8?q?=F0=9F=8F=BB=F0=9F=8E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.ini | 2 +- pom.xml | 4 +- .../com/pcdd/sonovel/parse/ChapterParser.java | 3 +- src/main/resources/rule/rule-template.json | 46 +++++++++++++++++++ src/test/java/com/pcdd/sonovel/JsoupTest.java | 8 ++-- 5 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 src/main/resources/rule/rule-template.json diff --git a/config.ini b/config.ini index 9562c4a..4345f3d 100644 --- a/config.ini +++ b/config.ini @@ -1,6 +1,6 @@ [base] # 启用书源 (只能选一个,当前可选值:1、2、3) -source-id = 3 +source-id = 4 # 下载路径,绝对相对均可 (Windows 路径分隔符不要用 \ ,用 \\ 或 /) download-path = downloads # 文件扩展名,支持 epub、txt、html,推荐 epub diff --git a/pom.xml b/pom.xml index e1505bc..2a2c272 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.pcdd so-novel - 1.7.1 + 1.7.2 jar so-novel @@ -197,4 +197,4 @@ - + \ No newline at end of file diff --git a/src/main/java/com/pcdd/sonovel/parse/ChapterParser.java b/src/main/java/com/pcdd/sonovel/parse/ChapterParser.java index 919f09f..214558a 100644 --- a/src/main/java/com/pcdd/sonovel/parse/ChapterParser.java +++ b/src/main/java/com/pcdd/sonovel/parse/ChapterParser.java @@ -8,7 +8,6 @@ import com.pcdd.sonovel.model.ConfigBean; import com.pcdd.sonovel.model.SearchResult; import com.pcdd.sonovel.util.CrawlUtils; -import com.pcdd.sonovel.util.ExceptionUtils; import com.pcdd.sonovel.util.RandomUA; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; @@ -39,7 +38,7 @@ public ChapterParser(ConfigBean config) { public Chapter parse(Chapter chapter, CountDownLatch latch, SearchResult sr) { try { Console.log("<== 正在下载: 【{}】", chapter.getTitle()); - ExceptionUtils.randomThrow(); + // ExceptionUtils.randomThrow(); chapter.setContent(crawl(chapter.getUrl(), false)); latch.countDown(); return chapterConverter.convert(chapter, config.getExtName()); diff --git a/src/main/resources/rule/rule-template.json b/src/main/resources/rule/rule-template.json new file mode 100644 index 0000000..ece934b --- /dev/null +++ b/src/main/resources/rule/rule-template.json @@ -0,0 +1,46 @@ +{ + "id": 0, + "url": "", + "name": "", + "comment": "", + "type": "", + "search": { + "url": "", + "method": "", + "body": "{}", + "cookies": "{}", + "pagination": false, + "nextPage": "", + "result": "", + "offset": 0, + "bookName": "", + "author": "", + "latestChapter": "", + "update": "" + }, + "book": { + "url": "", + "bookName": "", + "author": "", + "intro": "", + "category": "", + "coverUrl": "", + "latestChapter": "", + "latestUpdate": "", + "isEnd": "", + "catalog": "", + "catalogOffset": 0 + }, + "chapter": { + "url": "", + "pagination": false, + "nextPage": "", + "chapterNo": 0, + "title": "", + "content": "", + "paragraphTagClosed": false, + "paragraphTag": "", + "filterTxt": "", + "filterTag": "" + } +} \ No newline at end of file diff --git a/src/test/java/com/pcdd/sonovel/JsoupTest.java b/src/test/java/com/pcdd/sonovel/JsoupTest.java index c8017fe..3e11d28 100644 --- a/src/test/java/com/pcdd/sonovel/JsoupTest.java +++ b/src/test/java/com/pcdd/sonovel/JsoupTest.java @@ -4,13 +4,11 @@ import lombok.SneakyThrows; import org.jsoup.Connection; import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; public class JsoupTest { /** - * jsoup-1.18.1增加了Response进度事件接口 - * https://github.com/jhy/jsoup/pull/2164 + * jsoup-1.18.1增加了Response进度事件接口 */ @SneakyThrows public static void main(String[] args) { @@ -21,7 +19,7 @@ public static void main(String[] args) { Console.log(percent + "%"); }); - Document document = con.get(); + System.out.println(con.response()); } -} +} \ No newline at end of file