MyComic: Support chapter groups parsing (#9186)

* MyComic: Support chapter groups parsing

* Rename dto file name for suitable camel case.
This commit is contained in:
AlphaBoom 2025-06-13 12:40:00 +08:00 committed by Draff
parent d1878c4183
commit 8a81d39865
Signed by: Draff
GPG Key ID: E8A89F3211677653
3 changed files with 17 additions and 11 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'MyComic'
extClass = '.MyComic'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View File

@ -38,17 +38,23 @@ class MyComic : ParsedHttpSource(), ConfigurableSource {
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val data = document.select("div[data-flux-card] + div div[x-data]").attr("x-data")
val chaptersStr =
data.substringAfter("chapters:").substringBefore("\n").trim().removeSuffix(",")
return chaptersStr.parseAs<List<Chapter>>().map {
SChapter.create().apply {
name = it.title
// Since the images included in the chapter do not distinguish between Traditional and Simplified Chinese, the default URL will be used uniformly here.
// Additionally, using different URLs would create more issues, so it's best to keep the URL consistent.
url = "/chapters/${it.id}"
return document.select("div[data-flux-card] + div div[x-data]")
.eachAttr("x-data")
.map {
it.substringAfter("chapters:").substringBefore("\n").trim().removeSuffix(",")
}
.map {
it.parseAs<List<Chapter>>()
}
.flatten()
.map {
SChapter.create().apply {
name = it.title
// Since the images included in the chapter do not distinguish between Traditional and Simplified Chinese, the default URL will be used uniformly here.
// Additionally, using different URLs would create more issues, so it's best to keep the URL consistent.
url = "/chapters/${it.id}"
}
}
}
}
override fun chapterFromElement(element: Element) = throw UnsupportedOperationException()