Flame comics: Update data classes to match updated API responses (#11299)

* Update data classes to match updated API responses

* Update class name to correspond its usage

* Remove fallback string
This commit is contained in:
Kirill Kvit 2025-10-29 14:28:28 +01:00 committed by Draff
parent db1d8e26f4
commit dc20771476
Signed by: Draff
GPG Key ID: E8A89F3211677653
3 changed files with 38 additions and 20 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Flame Comics'
extClass = '.FlameComics'
extVersionCode = 44
extVersionCode = 45
}
apply from: "$rootDir/common.gradle"

View File

@ -176,10 +176,11 @@ class FlameComics : HttpSource() {
override fun mangaDetailsParse(response: Response): SManga = SManga.create().apply {
val seriesData =
json.decodeFromString<MangaPageData>(response.body.string()).pageProps.series
json.decodeFromString<MangaDetailsResponseData>(response.body.string()).pageProps.series
title = seriesData.title
thumbnail_url = thumbnailUrl(seriesData)
description = Jsoup.parseBodyFragment(seriesData.description).wholeText()
description = seriesData.description
?.let { Jsoup.parseBodyFragment(it).wholeText() }
genre = seriesData.tags?.let { tags ->
(listOf(seriesData.type) + tags).joinToString()
@ -197,8 +198,9 @@ class FlameComics : HttpSource() {
}
override fun chapterListParse(response: Response): List<SChapter> {
val mangaPageData = json.decodeFromString<MangaPageData>(response.body.string())
return mangaPageData.pageProps.chapters.map { chapter ->
val chaptersListResponseData =
json.decodeFromString<ChapterListResponseData>(response.body.string())
return chaptersListResponseData.pageProps.chapters.map { chapter ->
SChapter.create().apply {
setUrlWithoutDomain(
baseUrl.toHttpUrl().newBuilder().apply {

View File

@ -14,13 +14,31 @@ class NewBuildID(
)
@Serializable
class MangaPageData(
class MangaDetailsResponseData(
val pageProps: PageProps,
) {
@Serializable
class PageProps(
val series: Series,
)
}
@Serializable
class ChapterListResponseData(
val pageProps: PageProps,
) {
@Serializable
class PageProps(
val chapters: List<Chapter>,
val series: Series,
)
@Serializable
data class Chapter(
val chapter: Double,
val title: String?,
val release_date: Long,
val series_id: Int,
val token: String,
)
}
@ -60,7 +78,16 @@ class ChapterPageData(
) {
@Serializable
class PageProps(
val chapter: Chapter,
val chapter: ChapterPage,
)
@Serializable
data class ChapterPage(
val release_date: Long,
val series_id: Int,
val token: String,
@Serializable(with = KeysToListSerializer::class)
val images: List<Page>,
)
}
@ -68,7 +95,7 @@ class ChapterPageData(
class Series(
val title: String,
val altTitles: List<String>?,
val description: String,
val description: String?,
val cover: String,
val type: String,
val tags: List<String>?,
@ -80,17 +107,6 @@ class Series(
val views: Int?,
)
@Serializable
class Chapter(
val chapter: Double,
val title: String?,
val release_date: Long,
val series_id: Int,
val token: String,
@Serializable(with = KeysToListSerializer::class)
val images: List<Page>,
)
@Serializable
class Page(
val name: String,