diff --git a/src/pt/slimeread/build.gradle b/src/pt/slimeread/build.gradle index e0a5817a2..03da5ed49 100644 --- a/src/pt/slimeread/build.gradle +++ b/src/pt/slimeread/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'SlimeRead' extClass = '.SlimeRead' - extVersionCode = 4 + extVersionCode = 5 isNsfw = true } diff --git a/src/pt/slimeread/src/eu/kanade/tachiyomi/extension/pt/slimeread/SlimeRead.kt b/src/pt/slimeread/src/eu/kanade/tachiyomi/extension/pt/slimeread/SlimeRead.kt index 6d42f2d23..9a221420a 100644 --- a/src/pt/slimeread/src/eu/kanade/tachiyomi/extension/pt/slimeread/SlimeRead.kt +++ b/src/pt/slimeread/src/eu/kanade/tachiyomi/extension/pt/slimeread/SlimeRead.kt @@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource +import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import kotlinx.serialization.json.decodeFromStream import okhttp3.HttpUrl @@ -30,7 +31,10 @@ class SlimeRead : HttpSource() { override val baseUrl = "https://slimeread.com" - private val apiUrl = "https://old.slimeread.com:8443" + private val apiUrl = run { + val apiList = arrayOf("free", "beta", "api", "data", "test", "dev", "staging", "prod", "old", "new") + "https://${apiList.random()}.slimeread.com:8443" + } override val lang = "pt-BR" @@ -162,7 +166,12 @@ class SlimeRead : HttpSource() { override fun pageListRequest(chapter: SChapter) = GET(apiUrl + chapter.url, headers) override fun pageListParse(response: Response): List { - val pages = response.parseAs>().flatMap { it.pages } + val body = response.body.string() + val pages = if (body.startsWith("{")) { + json.decodeFromString>(body).values.flatMap { it.pages } + } else { + json.decodeFromString>(body).flatMap { it.pages } + } return pages.mapIndexed { index, item -> Page(index, "", item.url)