From 65004e33a54428845c3aa941658ec7fed231dfe7 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 6 Nov 2020 20:56:39 +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 | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 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 dbf4c665c..9e69cff3d 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 @@ -101,19 +101,18 @@ class WebBook(val bookSource: BookSource) { ): Coroutine { return Coroutine.async(scope, context) { book.type = bookSource.bookSourceType - val body = - if (!book.infoHtml.isNullOrEmpty()) { - book.infoHtml - } else { - val analyzeUrl = AnalyzeUrl( - ruleUrl = book.bookUrl, - baseUrl = sourceUrl, - headerMapF = bookSource.getHeaderMap(), - book = book - ) - analyzeUrl.getResponseAwait(bookSource.bookSourceUrl).body - } - BookInfo.analyzeBookInfo(book, body, bookSource, book.bookUrl, canReName) + if (!book.infoHtml.isNullOrEmpty()) { + book.infoHtml + BookInfo.analyzeBookInfo(book, book.infoHtml, bookSource, book.bookUrl, canReName) + } else { + val res = AnalyzeUrl( + ruleUrl = book.bookUrl, + baseUrl = sourceUrl, + headerMapF = bookSource.getHeaderMap(), + book = book + ).getResponseAwait(bookSource.bookSourceUrl) + BookInfo.analyzeBookInfo(book, res.body, bookSource, res.url, canReName) + } book } } @@ -143,7 +142,12 @@ class WebBook(val bookSource: BookSource) { baseUrl = book.bookUrl, headerMapF = bookSource.getHeaderMap() ).getResponseAwait(bookSource.bookSourceUrl) - BookChapterList.analyzeChapterList(this, book, res.body, bookSource, res.url) + BookChapterList.analyzeChapterList( + this, + book, res.body, + bookSource, + res.url + ) } }