From 1fb460d8cbf331595c656caa11f6880cad35b75e Mon Sep 17 00:00:00 2001 From: AwkwardPeak7 Date: Sun, 5 Nov 2023 22:21:39 +0500 Subject: [PATCH] response decode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit thanks to LetrixZ Co-authored-by: Fermín Cirella --- .../org/koitharu/kotatsu/parsers/site/en/Anchira.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Anchira.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Anchira.kt index 3b841134..e5558ab5 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Anchira.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/en/Anchira.kt @@ -33,7 +33,15 @@ import java.util.EnumSet internal class Anchira(context: MangaLoaderContext) : PagedMangaParser(context, MangaSource.ANCHIRA, 24) { private fun Response.decodeAsJson(): String { - val data = use { it.body?.bytes() } ?: throw IllegalArgumentException("Response body is null") + val bytes = use { it.body?.bytes() } ?: throw IllegalArgumentException("Response body is null") + + val padSize = bytes.size / 2 + val pad = bytes.copyOfRange(0, padSize) + val data = bytes.copyOfRange(padSize, bytes.size) + + for (i in 0 until padSize) { + data[i] = (data[i].toInt() xor pad[i].toInt()).toByte() + } return MoshiPack().msgpackToJson(data) }