修复书源校验正文下一页没有截止的bug

pull/1274/head
gedoor 3 years ago
parent 3d5a31116d
commit 612d11a3ef
  1. 2
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  2. 10
      app/src/main/java/io/legado/app/service/CheckSourceService.kt

@ -50,7 +50,7 @@ data class BookSource(
@delegate:Transient @delegate:Transient
@delegate:Ignore @delegate:Ignore
@IgnoredOnParcel @IgnoredOnParcel
val exploreKinds by lazy { val exploreKinds: List<ExploreKind> by lazy {
val exploreUrl = exploreUrl ?: return@lazy emptyList() val exploreUrl = exploreUrl ?: return@lazy emptyList()
val kinds = arrayListOf<ExploreKind>() val kinds = arrayListOf<ExploreKind>()
var ruleStr = exploreUrl var ruleStr = exploreUrl

@ -113,9 +113,6 @@ class CheckSourceService : BaseService() {
var books = webBook.searchBookAwait(this, CheckSource.keyword) var books = webBook.searchBookAwait(this, CheckSource.keyword)
if (books.isEmpty()) { if (books.isEmpty()) {
val exs = source.exploreKinds val exs = source.exploreKinds
if (exs.isEmpty()) {
throw Exception("搜索内容为空并且没有发现")
}
var url: String? = null var url: String? = null
for (ex in exs) { for (ex in exs) {
url = ex.url url = ex.url
@ -123,11 +120,14 @@ class CheckSourceService : BaseService() {
break break
} }
} }
books = webBook.exploreBookAwait(this, url!!) if (url.isNullOrBlank()) {
throw Exception("搜索内容为空并且没有发现")
}
books = webBook.exploreBookAwait(this, url)
} }
val book = webBook.getBookInfoAwait(this, books.first().toBook()) val book = webBook.getBookInfoAwait(this, books.first().toBook())
val toc = webBook.getChapterListAwait(this, book) val toc = webBook.getChapterListAwait(this, book)
val content = webBook.getContentAwait(this, book, toc.first()) val content = webBook.getContentAwait(this, book, toc.first(), toc.getOrNull(2)?.url)
if (content.isBlank()) { if (content.isBlank()) {
throw Exception("正文内容为空") throw Exception("正文内容为空")
} }

Loading…
Cancel
Save