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 c2286d1ab..76ab4278e 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 @@ -159,6 +159,7 @@ object BookChapterList { for (item in elements) { analyzeRule.setContent(item) val bookChapter = BookChapter(bookUrl = book.bookUrl) + analyzeRule.chapter = bookChapter bookChapter.title = analyzeRule.getString(nameRule) bookChapter.url = analyzeRule.getString(urlRule, true) if (bookChapter.url.isEmpty()) bookChapter.url = baseUrl 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 d14ab2249..9db46adb1 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 @@ -35,7 +35,7 @@ object BookContent { val content = StringBuilder() val nextUrlList = arrayListOf(baseUrl) val contentRule = bookSource.getContentRule() - var contentData = analyzeContent(body, contentRule, book, bookSource, baseUrl) + var contentData = analyzeContent(body, contentRule, book, bookChapter, bookSource, baseUrl) content.append(contentData.content) if (contentData.nextUrl.size == 1) { var nextUrl = contentData.nextUrl[0] @@ -56,7 +56,15 @@ object BookContent { ).getResponseAwait() .body()?.let { nextBody -> contentData = - analyzeContent(nextBody, contentRule, book, bookSource, baseUrl, false) + analyzeContent( + nextBody, + contentRule, + book, + bookChapter, + bookSource, + baseUrl, + false + ) nextUrl = if (contentData.nextUrl.isNotEmpty()) contentData.nextUrl[0] else "" content.append(contentData.content) @@ -82,6 +90,7 @@ object BookContent { it, contentRule, book, + bookChapter, bookSource, item.nextUrl, false @@ -106,6 +115,7 @@ object BookContent { body: String, contentRule: ContentRule, book: Book, + chapter: BookChapter, bookSource: BookSource, baseUrl: String, printLog: Boolean = true @@ -113,6 +123,7 @@ object BookContent { val nextUrlList = arrayListOf() val analyzeRule = AnalyzeRule(book) analyzeRule.setContent(body, baseUrl) + analyzeRule.chapter = chapter val nextUrlRule = contentRule.nextContentUrl if (!nextUrlRule.isNullOrEmpty()) { SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取正文下一页链接", printLog) 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 a5c3aec17..7f8252ca3 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 @@ -111,7 +111,7 @@ object BookList { searchBook.originName = bookSource.bookSourceName searchBook.originOrder = bookSource.customOrder searchBook.type = bookSource.bookSourceType - analyzeRule.setBook(searchBook) + analyzeRule.book = searchBook with(bookSource.getBookInfoRule()) { init?.let { if (it.isNotEmpty()) { @@ -167,7 +167,7 @@ object BookList { searchBook.originName = bookSource.bookSourceName searchBook.type = bookSource.bookSourceType searchBook.originOrder = bookSource.customOrder - analyzeRule.setBook(searchBook) + analyzeRule.book = searchBook analyzeRule.setContent(item) SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取书名", printLog) searchBook.name = analyzeRule.getString(ruleName)