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 3d1053510..2cfd28422 100644 --- a/app/src/main/java/io/legado/app/model/WebBook.kt +++ b/app/src/main/java/io/legado/app/model/WebBook.kt @@ -10,6 +10,7 @@ import io.legado.app.model.webbook.BookChapterList import io.legado.app.model.webbook.BookContent import io.legado.app.model.webbook.BookInfo import io.legado.app.model.webbook.BookList +import io.legado.app.utils.NetworkUtils import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlin.coroutines.CoroutineContext @@ -38,7 +39,13 @@ class WebBook(val bookSource: BookSource) { headerMapF = bookSource.getHeaderMap() ) val response = analyzeUrl.getResponseAsync().await() - BookList.analyzeBookList(response, bookSource, analyzeUrl, true) + BookList.analyzeBookList( + response.body(), + bookSource, + analyzeUrl, + NetworkUtils.getUrl(response), + true + ) } ?: arrayListOf() } } @@ -60,7 +67,13 @@ class WebBook(val bookSource: BookSource) { headerMapF = bookSource.getHeaderMap() ) val response = analyzeUrl.getResponseAsync().await() - BookList.analyzeBookList(response, bookSource, analyzeUrl, false) + BookList.analyzeBookList( + response.body(), + bookSource, + analyzeUrl, + NetworkUtils.getUrl(response), + false + ) } } diff --git a/app/src/main/java/io/legado/app/model/webbook/BookList.kt b/app/src/main/java/io/legado/app/model/webbook/BookList.kt index f7baa2b3a..b5f87d64e 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookList.kt @@ -7,21 +7,18 @@ import io.legado.app.data.entities.SearchBook import io.legado.app.help.BookHelp import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl -import io.legado.app.utils.NetworkUtils -import retrofit2.Response object BookList { @Throws(Exception::class) fun analyzeBookList( - response: Response, + body: String?, bookSource: BookSource, analyzeUrl: AnalyzeUrl, + baseUrl: String, isSearch: Boolean = true ): ArrayList { val bookList = ArrayList() - val baseUrl: String = NetworkUtils.getUrl(response) - val body: String? = response.body() body ?: throw Exception( App.INSTANCE.getString( R.string.error_get_web_content,