From 975bd42526fbb4a5f6d0d80f55df2c68cad56ee7 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 23 Sep 2019 10:39:20 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/model/WebBook.kt | 1 + .../java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 2 +- .../java/io/legado/app/model/webbook/BookChapterList.kt | 9 +++++++-- .../main/java/io/legado/app/model/webbook/BookContent.kt | 5 +++-- .../main/java/io/legado/app/model/webbook/BookInfo.kt | 4 ++-- .../main/java/io/legado/app/model/webbook/BookList.kt | 4 ++-- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/WebBook.kt b/app/src/main/java/io/legado/app/model/WebBook.kt index 6e00a80bc..a09e9f326 100644 --- a/app/src/main/java/io/legado/app/model/WebBook.kt +++ b/app/src/main/java/io/legado/app/model/WebBook.kt @@ -114,6 +114,7 @@ class WebBook(val bookSource: BookSource) { book, bookChapter, bookSource, + analyzeUrl, nextChapterUrl ) } diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index 080345ab1..654882cc2 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -30,7 +30,7 @@ import javax.script.SimpleBindings @Keep @SuppressLint("DefaultLocale") class AnalyzeUrl( - private var ruleUrl: String, + var ruleUrl: String, key: String? = null, page: Int? = null, headerMapF: Map? = null, diff --git a/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt index 3557ea844..13c4ab54b 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt @@ -26,8 +26,13 @@ object BookChapterList { var chapterList = arrayListOf() val baseUrl: String = NetworkUtils.getUrl(response) val body: String? = response.body() - body ?: throw Exception(App.INSTANCE.getString(R.string.error_get_web_content, baseUrl)) - SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:$baseUrl") + body ?: throw Exception( + App.INSTANCE.getString( + R.string.error_get_web_content, + analyzeUrl.ruleUrl + ) + ) + SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:${analyzeUrl.ruleUrl}") val tocRule = bookSource.getTocRule() val nextUrlList = arrayListOf(baseUrl) var reverse = false diff --git a/app/src/main/java/io/legado/app/model/webbook/BookContent.kt b/app/src/main/java/io/legado/app/model/webbook/BookContent.kt index 0f78b9d4a..fc5178104 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookContent.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookContent.kt @@ -23,6 +23,7 @@ object BookContent { book: Book, bookChapter: BookChapter, bookSource: BookSource, + analyzeUrl: AnalyzeUrl, nextChapterUrlF: String? = null ): String { val baseUrl: String = NetworkUtils.getUrl(response) @@ -30,10 +31,10 @@ object BookContent { body ?: throw Exception( App.INSTANCE.getString( R.string.error_get_web_content, - baseUrl + analyzeUrl.ruleUrl ) ) - SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:$baseUrl") + SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:${analyzeUrl.ruleUrl}") val content = StringBuilder() val nextUrlList = arrayListOf(baseUrl) val contentRule = bookSource.getContentRule() diff --git a/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt b/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt index 1a7c5051c..c80ce8c55 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt @@ -21,10 +21,10 @@ object BookInfo { body ?: throw Exception( App.INSTANCE.getString( R.string.error_get_web_content, - baseUrl + analyzeUrl.ruleUrl ) ) - SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:$baseUrl") + SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:${analyzeUrl.ruleUrl}") val infoRule = bookSource.getBookInfoRule() val analyzeRule = AnalyzeRule(book) analyzeRule.setContent(body, baseUrl) diff --git a/app/src/main/java/io/legado/app/model/webbook/BookList.kt b/app/src/main/java/io/legado/app/model/webbook/BookList.kt index 1e2bfb6c9..8d953c342 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookList.kt @@ -25,10 +25,10 @@ object BookList { body ?: throw Exception( App.INSTANCE.getString( R.string.error_get_web_content, - baseUrl + analyzeUrl.ruleUrl ) ) - SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:$baseUrl") + SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取成功:${analyzeUrl.ruleUrl}") val analyzeRule = AnalyzeRule(null) analyzeRule.setContent(body, baseUrl) bookSource.bookUrlPattern?.let {