From 42e4618a131b35a4789d01fdd49af3a4e17b18c8 Mon Sep 17 00:00:00 2001 From: meatballsaretasty Date: Wed, 16 Jul 2025 12:00:18 -0400 Subject: [PATCH] Fix/hc not finding pages (#9669) * Update build.gradle * fix: pageListParse not returning any pages The old selector wasn't returning any images. Changed fetchChapterList url to the new HC `story` page which has all the images, unpaginated. Updated pageListParse. --- src/all/hentaicosplay/build.gradle | 2 +- .../all/hentaicosplay/HentaiCosplay.kt | 24 +++++++------------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/all/hentaicosplay/build.gradle b/src/all/hentaicosplay/build.gradle index 872849997..e0ca4985e 100644 --- a/src/all/hentaicosplay/build.gradle +++ b/src/all/hentaicosplay/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Hentai Cosplay' extClass = '.HentaiCosplay' - extVersionCode = 4 + extVersionCode = 5 isNsfw = true } diff --git a/src/all/hentaicosplay/src/eu/kanade/tachiyomi/extension/all/hentaicosplay/HentaiCosplay.kt b/src/all/hentaicosplay/src/eu/kanade/tachiyomi/extension/all/hentaicosplay/HentaiCosplay.kt index 592784ff7..3c420a32a 100644 --- a/src/all/hentaicosplay/src/eu/kanade/tachiyomi/extension/all/hentaicosplay/HentaiCosplay.kt +++ b/src/all/hentaicosplay/src/eu/kanade/tachiyomi/extension/all/hentaicosplay/HentaiCosplay.kt @@ -198,7 +198,7 @@ class HentaiCosplay : HttpSource() { override fun fetchChapterList(manga: SManga): Observable> = Observable.fromCallable { SChapter.create().apply { name = "Gallery" - url = manga.url.removeSuffix("/").plus("/attachment/1/") + url = manga.url.replace("/image/", "/story/") date_upload = runCatching { dateFormat.parse(dateCache[manga.url]!!)!!.time }.getOrDefault(0L) @@ -209,21 +209,13 @@ class HentaiCosplay : HttpSource() { override fun pageListParse(response: Response): List { val document = response.asJsoup() - val pageUrl = document.location().substringBeforeLast("/1/") - - val totalPages = document.selectFirst("#right_sidebar > h3, #title > h2") - ?.text()?.trim() - ?.run { pagesRegex.find(this)?.groupValues?.get(1) } - ?.toIntOrNull() - ?: return emptyList() - - val pages = (1..totalPages).map { - Page(it, "$pageUrl/$it/") - } - - pages[0].imageUrl = imageUrlParse(document) - - return pages + return document.select("amp-img[src*=upload]") + .mapIndexed { index, element -> + Page( + index = index, + imageUrl = element.attr("src"), + ) + } } override fun imageUrlParse(response: Response) = imageUrlParse(response.asJsoup())