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

@ -19,7 +19,9 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.withContext
import splitties.init.appCtx
import java.net.URLDecoder
@Suppress("BlockingMethodInNonBlockingContext")
object BookContent {
@Throws(Exception::class)
@ -32,7 +34,7 @@ object BookContent {
redirectUrl: String,
nextChapterUrl: String? = null
): String {
val baseUrl = strResponse.url
val baseUrl = URLDecoder.decode(strResponse.url, "utf-8")
val body = strResponse.body
body ?: throw Exception(
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.ensureActive
import splitties.init.appCtx
import java.net.URLDecoder
object BookInfo {
@ -25,7 +26,7 @@ object BookInfo {
redirectUrl: String,
canReName: Boolean,
) {
val baseUrl = strResponse.url
val baseUrl = URLDecoder.decode(strResponse.url, "utf-8")
val body = strResponse.body
body ?: throw Exception(
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.ensureActive
import splitties.init.appCtx
import java.net.URLDecoder
object BookList {
@ -28,7 +29,7 @@ object BookList {
variableBook: SearchBook,
isSearch: Boolean = true,
): ArrayList<SearchBook> {
val baseUrl = strResponse.url
val baseUrl = URLDecoder.decode(strResponse.url, "utf-8")
val body = strResponse.body
body ?: throw Exception(
appCtx.getString(

Loading…
Cancel
Save