pull/1259/head
gedoor 3 years ago
parent 9d5a47bfb9
commit 41fc802fb8
  1. 5
      app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt
  2. 4
      app/src/main/java/io/legado/app/model/webBook/BookContent.kt
  3. 3
      app/src/main/java/io/legado/app/model/webBook/BookInfo.kt
  4. 3
      app/src/main/java/io/legado/app/model/webBook/BookList.kt

@ -15,9 +15,10 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.ensureActive import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import splitties.init.appCtx import splitties.init.appCtx
import java.net.URLDecoder
@Suppress("BlockingMethodInNonBlockingContext")
object BookChapterList { object BookChapterList {
suspend fun analyzeChapterList( suspend fun analyzeChapterList(
@ -27,7 +28,7 @@ object BookChapterList {
book: Book, book: Book,
redirectUrl: String redirectUrl: String
): List<BookChapter> { ): List<BookChapter> {
val baseUrl = strResponse.url val baseUrl = URLDecoder.decode(strResponse.url, "utf-8")
val body = strResponse.body val body = strResponse.body
body ?: throw Exception( body ?: throw Exception(
appCtx.getString(R.string.error_get_web_content, baseUrl) appCtx.getString(R.string.error_get_web_content, baseUrl)

@ -19,7 +19,9 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.ensureActive import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import splitties.init.appCtx import splitties.init.appCtx
import java.net.URLDecoder
@Suppress("BlockingMethodInNonBlockingContext")
object BookContent { object BookContent {
@Throws(Exception::class) @Throws(Exception::class)
@ -32,7 +34,7 @@ object BookContent {
redirectUrl: String, redirectUrl: String,
nextChapterUrl: String? = null nextChapterUrl: String? = null
): String { ): String {
val baseUrl = strResponse.url val baseUrl = URLDecoder.decode(strResponse.url, "utf-8")
val body = strResponse.body val body = strResponse.body
body ?: throw Exception( body ?: throw Exception(
appCtx.getString(R.string.error_get_web_content, baseUrl) appCtx.getString(R.string.error_get_web_content, baseUrl)

@ -13,6 +13,7 @@ import io.legado.app.utils.StringUtils.wordCountFormat
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ensureActive import kotlinx.coroutines.ensureActive
import splitties.init.appCtx import splitties.init.appCtx
import java.net.URLDecoder
object BookInfo { object BookInfo {
@ -25,7 +26,7 @@ object BookInfo {
redirectUrl: String, redirectUrl: String,
canReName: Boolean, canReName: Boolean,
) { ) {
val baseUrl = strResponse.url val baseUrl = URLDecoder.decode(strResponse.url, "utf-8")
val body = strResponse.body val body = strResponse.body
body ?: throw Exception( body ?: throw Exception(
appCtx.getString(R.string.error_get_web_content, baseUrl) appCtx.getString(R.string.error_get_web_content, baseUrl)

@ -16,6 +16,7 @@ import io.legado.app.utils.StringUtils.wordCountFormat
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ensureActive import kotlinx.coroutines.ensureActive
import splitties.init.appCtx import splitties.init.appCtx
import java.net.URLDecoder
object BookList { object BookList {
@ -28,7 +29,7 @@ object BookList {
variableBook: SearchBook, variableBook: SearchBook,
isSearch: Boolean = true, isSearch: Boolean = true,
): ArrayList<SearchBook> { ): ArrayList<SearchBook> {
val baseUrl = strResponse.url val baseUrl = URLDecoder.decode(strResponse.url, "utf-8")
val body = strResponse.body val body = strResponse.body
body ?: throw Exception( body ?: throw Exception(
appCtx.getString( appCtx.getString(

Loading…
Cancel
Save