diff --git a/src/es/olympusscanlation/build.gradle b/src/es/olympusscanlation/build.gradle index e5f90b13a..e32a7a0d2 100644 --- a/src/es/olympusscanlation/build.gradle +++ b/src/es/olympusscanlation/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Olympus Scanlation' extClass = '.OlympusScanlation' - extVersionCode = 8 + extVersionCode = 9 } apply from: "$rootDir/common.gradle" diff --git a/src/es/olympusscanlation/src/eu/kanade/tachiyomi/extension/es/olympusscanlation/OlympusScanlation.kt b/src/es/olympusscanlation/src/eu/kanade/tachiyomi/extension/es/olympusscanlation/OlympusScanlation.kt index b8a9eb614..3e1cbc080 100644 --- a/src/es/olympusscanlation/src/eu/kanade/tachiyomi/extension/es/olympusscanlation/OlympusScanlation.kt +++ b/src/es/olympusscanlation/src/eu/kanade/tachiyomi/extension/es/olympusscanlation/OlympusScanlation.kt @@ -24,8 +24,8 @@ class OlympusScanlation : HttpSource() { override val versionId = 2 - override val baseUrl: String = "https://leelolympus.com" - private val apiBaseUrl: String = "https://dashboard.leelolympus.com" + override val baseUrl: String = "https://leerolymp.com" + private val apiBaseUrl: String = "https://dashboard.leerolymp.com" override val lang: String = "es" override val name: String = "Olympus Scanlation" @@ -51,8 +51,7 @@ class OlympusScanlation : HttpSource() { override fun popularMangaParse(response: Response): MangasPage { val result = json.decodeFromString(response.body.string()) - val popularJson = json.decodeFromString>(result.data.popularComics) - val mangaList = popularJson.filter { it.type == "comic" }.map { it.toSManga() } + val mangaList = result.data.popularComics.filter { it.type == "comic" }.map { it.toSManga() } return MangasPage(mangaList, hasNextPage = false) } diff --git a/src/es/olympusscanlation/src/eu/kanade/tachiyomi/extension/es/olympusscanlation/OlympusScanlationDto.kt b/src/es/olympusscanlation/src/eu/kanade/tachiyomi/extension/es/olympusscanlation/OlympusScanlationDto.kt index 08f1bbdd3..5e6719999 100644 --- a/src/es/olympusscanlation/src/eu/kanade/tachiyomi/extension/es/olympusscanlation/OlympusScanlationDto.kt +++ b/src/es/olympusscanlation/src/eu/kanade/tachiyomi/extension/es/olympusscanlation/OlympusScanlationDto.kt @@ -4,6 +4,11 @@ import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.JsonElement +import kotlinx.serialization.json.JsonPrimitive +import kotlinx.serialization.json.JsonTransformingSerializer import java.text.ParseException import java.text.SimpleDateFormat @@ -14,9 +19,21 @@ class PayloadHomeDto( @Serializable class HomeDto( - @SerialName("popular_comics") val popularComics: String, + @SerialName("popular_comics") + @Serializable(with = PopularComicsSerializer::class) + val popularComics: List, ) +object PopularComicsSerializer : JsonTransformingSerializer>(ListSerializer(MangaDto.serializer())) { + override fun transformDeserialize(element: JsonElement): JsonElement { + return if (element is JsonPrimitive && element.isString) { + Json.parseToJsonElement(element.content) + } else { + element + } + } +} + @Serializable class PayloadSeriesDto(val data: PayloadSeriesDataDto)