From 304cb7ff77f9f6b50ff98dd082d73043a2754257 Mon Sep 17 00:00:00 2001 From: Celeter Date: Sun, 3 Nov 2019 14:25:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E7=8E=B0=E8=B0=83?= =?UTF-8?q?=E8=AF=95=EF=BC=8C=E4=BE=8B=EF=BC=9A=20=E6=9C=88=E7=A5=A8?= =?UTF-8?q?=E6=A6=9C::https://www.qidian.com/rank/yuepiao=3Fpage=3D{{page}?= =?UTF-8?q?}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/model/webbook/SourceDebug.kt | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt b/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt index 1fd916380..e36382630 100644 --- a/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt +++ b/app/src/main/java/io/legado/app/model/webbook/SourceDebug.kt @@ -65,14 +65,38 @@ class SourceDebug(private val webBook: WebBook, callback: Callback) { val book = Book() book.origin = webBook.sourceUrl book.bookUrl = key - printLog(webBook.sourceUrl, "⇒开始访问:$key") + printLog(webBook.sourceUrl, "⇒开始访问详情页:$key") infoDebug(book) + } else if (key.contains("::")) { + val url = key.substring(key.indexOf("::") + 2) + printLog(webBook.sourceUrl, "⇒开始访问发现页:$url") + exploreDebug(url) } else { printLog(webBook.sourceUrl, "⇒开始搜索关键字:$key") searchDebug(key) } } + private fun exploreDebug(url: String) { + printLog(debugSource, "︾开始解析发现页") + val explore = webBook.exploreBook(url, 1) + .onSuccess { exploreBooks -> + exploreBooks?.let { + if (exploreBooks.isNotEmpty()) { + printLog(debugSource, "︽发现页解析完成") + printLog(debugSource, "", showTime = false) + infoDebug(exploreBooks[0].toBook()) + } else { + printLog(debugSource, "︽未获取到书籍", state = -1) + } + } + } + .onError { + printLog(debugSource, it.localizedMessage, state = -1) + } + tasks.add(explore) + } + private fun searchDebug(key: String) { printLog(debugSource, "︾开始解析搜索页") val search = webBook.searchBook(key, 1)