IkigaiMangas: Fix http 404 when reading a chapter (#2511)

* fix pages

* remove dto
This commit is contained in:
bapeey 2024-04-21 02:12:06 -05:00 committed by Draff
parent ecb0606bb4
commit d3a34b5693
3 changed files with 7 additions and 17 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Ikigai Mangas' extName = 'Ikigai Mangas'
extClass = '.IkigaiMangas' extClass = '.IkigaiMangas'
extVersionCode = 5 extVersionCode = 6
isNsfw = true isNsfw = true
} }

View File

@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.decodeFromString import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl
@ -141,14 +142,13 @@ class IkigaiMangas : HttpSource() {
return mangas return mangas
} }
override fun pageListRequest(chapter: SChapter): Request { override fun pageListRequest(chapter: SChapter): Request =
val id = chapter.url.substringAfter("/capitulo/") GET(baseUrl + chapter.url.substringBefore("#"), headers)
return GET("$apiBaseUrl/api/swf/chapters/$id", headers)
}
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
return json.decodeFromString<PayloadPagesDto>(response.body.string()).chapter.pages.mapIndexed { i, img -> val document = response.asJsoup()
Page(i, "", img) return document.select("section > div.img > img").mapIndexed { i, element ->
Page(i, imageUrl = element.attr("abs:src"))
} }
} }

View File

@ -109,16 +109,6 @@ class ChapterMetaDto(
fun hasNextPage() = currentPage < lastPage fun hasNextPage() = currentPage < lastPage
} }
@Serializable
class PayloadPagesDto(
val chapter: PageDto,
)
@Serializable
class PageDto(
val pages: List<String>,
)
@Serializable @Serializable
class SeriesStatusDto( class SeriesStatusDto(
val id: Long, val id: Long,