Atsumaru: Fetch all chapter list pages (#10749)

add chapter list pagination
This commit is contained in:
bapeey 2025-09-27 07:24:08 -05:00 committed by Draff
parent fe47d20f67
commit 8c74ea91cd
Signed by: Draff
GPG Key ID: E8A89F3211677653
3 changed files with 28 additions and 4 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Atsumaru'
extClass = '.Atsumaru'
extVersionCode = 3
extVersionCode = 4
isNsfw = true
}

View File

@ -97,14 +97,27 @@ class Atsumaru : HttpSource() {
// ============================== Chapters ==============================
private fun fetchChaptersRequest(mangaId: String, page: Int): Request {
return GET("$baseUrl/api/manga/chapters?id=$mangaId&filter=all&sort=desc&page=$page", apiHeaders)
}
override fun chapterListRequest(manga: SManga): Request {
return mangaDetailsRequest(manga)
return fetchChaptersRequest(manga.url, 0)
}
override fun chapterListParse(response: Response): List<SChapter> {
return response.parseAs<MangaObjectDto>().mangaPage.chapters!!.map {
it.toSChapter(response.request.url.pathSegments.last())
val mangaId = response.request.url.queryParameter("id")!!
val chapterList = mutableListOf<ChapterDto>()
var result = response.parseAs<ChapterListDto>()
chapterList.addAll(result.chapters)
while (result.hasNextPage()) {
result = client.newCall(fetchChaptersRequest(mangaId, result.page + 1)).execute().parseAs()
chapterList.addAll(result.chapters)
}
return chapterList.map { it.toSChapter(mangaId) }
}
override fun getChapterUrl(chapter: SChapter): String {

View File

@ -101,6 +101,17 @@ class MangaDto(
)
}
@Serializable
class ChapterListDto(
val chapters: List<ChapterDto>,
val pages: Int,
val page: Int,
) {
fun hasNextPage(): Boolean {
return page + 1 < pages
}
}
@Serializable
class ChapterDto(
private val id: String,