OlympusScanlation: Update domain (#3061)

* update domain

* copilot made this
This commit is contained in:
bapeey 2024-05-17 06:21:57 -05:00 committed by Draff
parent f09a232033
commit d4191959e4
3 changed files with 22 additions and 6 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Olympus Scanlation' extName = 'Olympus Scanlation'
extClass = '.OlympusScanlation' extClass = '.OlympusScanlation'
extVersionCode = 8 extVersionCode = 9
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -24,8 +24,8 @@ class OlympusScanlation : HttpSource() {
override val versionId = 2 override val versionId = 2
override val baseUrl: String = "https://leelolympus.com" override val baseUrl: String = "https://leerolymp.com"
private val apiBaseUrl: String = "https://dashboard.leelolympus.com" private val apiBaseUrl: String = "https://dashboard.leerolymp.com"
override val lang: String = "es" override val lang: String = "es"
override val name: String = "Olympus Scanlation" override val name: String = "Olympus Scanlation"
@ -51,8 +51,7 @@ class OlympusScanlation : HttpSource() {
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val result = json.decodeFromString<PayloadHomeDto>(response.body.string()) val result = json.decodeFromString<PayloadHomeDto>(response.body.string())
val popularJson = json.decodeFromString<List<MangaDto>>(result.data.popularComics) val mangaList = result.data.popularComics.filter { it.type == "comic" }.map { it.toSManga() }
val mangaList = popularJson.filter { it.type == "comic" }.map { it.toSManga() }
return MangasPage(mangaList, hasNextPage = false) return MangasPage(mangaList, hasNextPage = false)
} }

View File

@ -4,6 +4,11 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable 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.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
@ -14,9 +19,21 @@ class PayloadHomeDto(
@Serializable @Serializable
class HomeDto( class HomeDto(
@SerialName("popular_comics") val popularComics: String, @SerialName("popular_comics")
@Serializable(with = PopularComicsSerializer::class)
val popularComics: List<MangaDto>,
) )
object PopularComicsSerializer : JsonTransformingSerializer<List<MangaDto>>(ListSerializer(MangaDto.serializer())) {
override fun transformDeserialize(element: JsonElement): JsonElement {
return if (element is JsonPrimitive && element.isString) {
Json.parseToJsonElement(element.content)
} else {
element
}
}
}
@Serializable @Serializable
class PayloadSeriesDto(val data: PayloadSeriesDataDto) class PayloadSeriesDto(val data: PayloadSeriesDataDto)