From 68c8110caf9d4966c57782a9aab7cc97766e6c96 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 31 Jul 2019 14:01:43 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/model/WebBook.kt | 10 +++++----- .../java/io/legado/app/model/webbook/BookContent.kt | 5 +---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/WebBook.kt b/app/src/main/java/io/legado/app/model/WebBook.kt index 43882e881..b8bafd83a 100644 --- a/app/src/main/java/io/legado/app/model/WebBook.kt +++ b/app/src/main/java/io/legado/app/model/WebBook.kt @@ -19,7 +19,7 @@ class WebBook(private val bookSource: BookSource) { fun searchBook(key: String, page: Int?, isSearch: Boolean = true): Coroutine> { return Coroutine.async { bookSource.getSearchRule().searchUrl?.let { searchUrl -> - val analyzeUrl = AnalyzeUrl(searchUrl, key, page, baseUrl = bookSource.bookSourceUrl) + val analyzeUrl = AnalyzeUrl(searchUrl, key, page, baseUrl = sourceUrl) val response = analyzeUrl.getResponseAsync().await() BookList.analyzeBookList(response, bookSource, analyzeUrl, isSearch) } ?: arrayListOf() @@ -28,7 +28,7 @@ class WebBook(private val bookSource: BookSource) { fun getBookInfo(book: Book): Coroutine { return Coroutine.async { - val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = book.bookUrl) + val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = book.bookUrl, baseUrl = sourceUrl) val response = analyzeUrl.getResponseAsync().await() BookInfo.analyzeBookInfo(book, response.body(), bookSource, analyzeUrl) book @@ -37,7 +37,7 @@ class WebBook(private val bookSource: BookSource) { fun getChapterList(book: Book): Coroutine> { return Coroutine.async { - val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = book.tocUrl) + val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = book.tocUrl, baseUrl = book.bookUrl) val response = analyzeUrl.getResponseAsync().await() BookChapterList.analyzeChapterList(this, book, response, bookSource, analyzeUrl) } @@ -45,9 +45,9 @@ class WebBook(private val bookSource: BookSource) { fun getContent(book: Book, bookChapter: BookChapter): Coroutine { return Coroutine.async { - val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = bookChapter.url) + val analyzeUrl = AnalyzeUrl(book = book, ruleUrl = bookChapter.url, baseUrl = book.tocUrl) val response = analyzeUrl.getResponseAsync().await() - BookContent.analyzeContent(this, response, book, bookChapter, bookSource, analyzeUrl) + BookContent.analyzeContent(this, response, book, bookSource) } } } \ No newline at end of file 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 a6ab5cff4..9d41cb4aa 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 @@ -3,7 +3,6 @@ package io.legado.app.model.webbook import io.legado.app.App import io.legado.app.R import io.legado.app.data.entities.Book -import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.rule.ContentRule import io.legado.app.model.analyzeRule.AnalyzeRule @@ -20,9 +19,7 @@ object BookContent { coroutineScope: CoroutineScope, response: Response, book: Book, - bookChapter: BookChapter, - bookSource: BookSource, - analyzeUrl: AnalyzeUrl + bookSource: BookSource ): String { val baseUrl: String = NetworkUtils.getUrl(response) val body: String? = response.body()