diff --git a/app/src/main/java/io/legado/app/model/Debug.kt b/app/src/main/java/io/legado/app/model/Debug.kt index e5225fc99..31bef2c81 100644 --- a/app/src/main/java/io/legado/app/model/Debug.kt +++ b/app/src/main/java/io/legado/app/model/Debug.kt @@ -253,8 +253,8 @@ object Debug { .onSuccess { log(debugSource, "︽目录页解析完成") log(debugSource, showTime = false) - val nextChapterUrl = it.getOrNull(1)?.url - contentDebug(scope, bookSource, book, it[0], nextChapterUrl) + val nextChapterUrl = it.getOrNull(1)?.url ?: it.first().url + contentDebug(scope, bookSource, book, it.first(), nextChapterUrl) } .onError { log(debugSource, it.msg, state = -1) 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 754cbc133..d3f0e004b 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 { redirectUrl: String, baseUrl: String, body: String?, - nextChapterUrl: String? = null, + nextChapterUrl: String?, needSave: Boolean = true ): String { body ?: throw NoStackTraceException( @@ -47,6 +47,7 @@ object BookContent { nextChapterUrl } else { appDb.bookChapterDao.getChapter(book.bookUrl, bookChapter.index + 1)?.url + ?: appDb.bookChapterDao.getChapter(book.bookUrl, 0)?.url } val content = StringBuilder() val nextUrlList = arrayListOf(baseUrl) diff --git a/app/src/main/java/io/legado/app/service/CheckSourceService.kt b/app/src/main/java/io/legado/app/service/CheckSourceService.kt index d1aa3da97..6887de070 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -135,12 +135,13 @@ class CheckSourceService : BaseService() { } val book = WebBook.getBookInfoAwait(this, source, books.first().toBook()) val toc = WebBook.getChapterListAwait(this, source, book) + val nextChapterUrl = toc.getOrNull(1)?.url ?: toc.first().url val content = WebBook.getContentAwait( this, bookSource = source, book = book, bookChapter = toc.first(), - nextChapterUrl = toc.getOrNull(1)?.url, + nextChapterUrl = nextChapterUrl, needSave = false ) if (content.isBlank()) {