From 8a81d398651feb0b9c4f8a0cdfe2050b9d1bcf88 Mon Sep 17 00:00:00 2001 From: AlphaBoom <30779939+AlphaBoom@users.noreply.github.com> Date: Fri, 13 Jun 2025 12:40:00 +0800 Subject: [PATCH] MyComic: Support chapter groups parsing (#9186) * MyComic: Support chapter groups parsing * Rename dto file name for suitable camel case. --- src/zh/mycomic/build.gradle | 2 +- .../tachiyomi/extension/zh/mycomic/MyComic.kt | 26 ++++++++++++------- .../mycomic/{MyComicDTO.kt => MyComicDto.kt} | 0 3 files changed, 17 insertions(+), 11 deletions(-) rename src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/{MyComicDTO.kt => MyComicDto.kt} (100%) diff --git a/src/zh/mycomic/build.gradle b/src/zh/mycomic/build.gradle index d408b3b2a..b4a514218 100644 --- a/src/zh/mycomic/build.gradle +++ b/src/zh/mycomic/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'MyComic' extClass = '.MyComic' - extVersionCode = 1 + extVersionCode = 2 isNsfw = true } diff --git a/src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/MyComic.kt b/src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/MyComic.kt index 7e1d1313d..6094caf0a 100644 --- a/src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/MyComic.kt +++ b/src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/MyComic.kt @@ -38,17 +38,23 @@ class MyComic : ParsedHttpSource(), ConfigurableSource { override fun chapterListParse(response: Response): List { 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>().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>() + } + .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() diff --git a/src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/MyComicDTO.kt b/src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/MyComicDto.kt similarity index 100% rename from src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/MyComicDTO.kt rename to src/zh/mycomic/src/eu/kanade/tachiyomi/extension/zh/mycomic/MyComicDto.kt