From 35ab379d1951eab60c18dca147c8bc0d8d86991a Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 6 Nov 2020 20:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/model/webBook/WebBook.kt | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt index 5bbd695fd..dbf4c665c 100644 --- a/app/src/main/java/io/legado/app/model/webBook/WebBook.kt +++ b/app/src/main/java/io/legado/app/model/webBook/WebBook.kt @@ -179,31 +179,37 @@ class WebBook(val bookSource: BookSource) { Debug.log(sourceUrl, "⇒正文规则为空,使用章节链接:${bookChapter.url}") return bookChapter.url } - val body = - if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) { - book.tocHtml - } else { - val analyzeUrl = AnalyzeUrl( - ruleUrl = bookChapter.getAbsoluteURL(), - baseUrl = book.tocUrl, - headerMapF = bookSource.getHeaderMap(), - book = book, - chapter = bookChapter - ) - analyzeUrl.getResponseAwait( - bookSource.bookSourceUrl, - jsStr = bookSource.getContentRule().webJs, - sourceRegex = bookSource.getContentRule().sourceRegex - ).body - } - return BookContent.analyzeContent( - scope, - body, - book, - bookChapter, - bookSource, - bookChapter.url, - nextChapterUrl - ) + return if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) { + BookContent.analyzeContent( + scope, + book.tocHtml, + book, + bookChapter, + bookSource, + bookChapter.getAbsoluteURL(), + nextChapterUrl + ) + } else { + val res = AnalyzeUrl( + ruleUrl = bookChapter.getAbsoluteURL(), + baseUrl = book.tocUrl, + headerMapF = bookSource.getHeaderMap(), + book = book, + chapter = bookChapter + ).getResponseAwait( + bookSource.bookSourceUrl, + jsStr = bookSource.getContentRule().webJs, + sourceRegex = bookSource.getContentRule().sourceRegex + ) + BookContent.analyzeContent( + scope, + res.body, + book, + bookChapter, + bookSource, + res.url, + nextChapterUrl + ) + } } } \ No newline at end of file