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 { ext {
extName = 'Atsumaru' extName = 'Atsumaru'
extClass = '.Atsumaru' extClass = '.Atsumaru'
extVersionCode = 3 extVersionCode = 4
isNsfw = true isNsfw = true
} }

View File

@ -97,14 +97,27 @@ class Atsumaru : HttpSource() {
// ============================== Chapters ============================== // ============================== 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 { override fun chapterListRequest(manga: SManga): Request {
return mangaDetailsRequest(manga) return fetchChaptersRequest(manga.url, 0)
} }
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
return response.parseAs<MangaObjectDto>().mangaPage.chapters!!.map { val mangaId = response.request.url.queryParameter("id")!!
it.toSChapter(response.request.url.pathSegments.last()) 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 { 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 @Serializable
class ChapterDto( class ChapterDto(
private val id: String, private val id: String,