From 3b597ac9ee04e087a61d5c4e4e36e1f2491ca566 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 26 Jan 2021 11:12:44 +0800 Subject: [PATCH] update updateLog.md --- .../io/legado/app/service/CheckSourceService.kt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 6bd72e7bf..310902e00 100644 --- a/app/src/main/java/io/legado/app/service/CheckSourceService.kt +++ b/app/src/main/java/io/legado/app/service/CheckSourceService.kt @@ -107,7 +107,21 @@ class CheckSourceService : BaseService() { fun check(source: BookSource) { execute(context = searchCoroutine) { val webBook = WebBook(source) - val books = webBook.searchBookAwait(this, CheckSource.keyword) + var books = webBook.searchBookAwait(this, CheckSource.keyword) + if (books.isEmpty()) { + val exs = source.getExploreKinds() + if (exs.isEmpty()) { + throw Exception("搜索内容为空并且没有发现") + } + var url: String? = null + for (ex in exs) { + url = ex.url + if (!url.isNullOrBlank()) { + break + } + } + books = webBook.exploreBookAwait(this, url!!) + } val book = webBook.getBookInfoAwait(this, books.first().toBook()) val toc = webBook.getChapterListAwait(this, book) val content = webBook.getContentAwait(this, book, toc.first())