From fda66a243573390be3c9309a237cd209dee9d584 Mon Sep 17 00:00:00 2001 From: Pavkazzz Date: Sat, 14 Dec 2024 22:38:13 +0300 Subject: [PATCH] [ru-Acomics] Fix parsing popular and search page --- src/ru/acomics/build.gradle | 2 +- .../tachiyomi/extension/ru/acomics/AComics.kt | 25 +++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/ru/acomics/build.gradle b/src/ru/acomics/build.gradle index ab284622d8..f5197143ec 100644 --- a/src/ru/acomics/build.gradle +++ b/src/ru/acomics/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'AComics' extClass = '.AComics' - extVersionCode = 4 + extVersionCode = 5 isNsfw = true } diff --git a/src/ru/acomics/src/eu/kanade/tachiyomi/extension/ru/acomics/AComics.kt b/src/ru/acomics/src/eu/kanade/tachiyomi/extension/ru/acomics/AComics.kt index 2edb9acae5..41a0e0820e 100644 --- a/src/ru/acomics/src/eu/kanade/tachiyomi/extension/ru/acomics/AComics.kt +++ b/src/ru/acomics/src/eu/kanade/tachiyomi/extension/ru/acomics/AComics.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.ru.acomics import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga @@ -39,17 +40,32 @@ class AComics : ParsedHttpSource() { override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/comics?$DEFAULT_COMIC_QUERIES&sort=subscr_count&skip=${10 * (page - 1)}", headers) - override fun popularMangaSelector() = "table.list-loadable > tbody > tr" + override fun popularMangaSelector() = "section.serial-card" override fun popularMangaFromElement(element: Element) = SManga.create().apply { - thumbnail_url = element.selectFirst("a > img")?.absUrl("src") - element.selectFirst("div.title > a")!!.run { + thumbnail_url = element.selectFirst("a > img")?.absUrl("data-real-src") + element.selectFirst("h2 > a")!!.run { setUrlWithoutDomain(attr("href") + "/about") title = text() } } - override fun popularMangaNextPageSelector() = "span.button:not(:has(a)) + span.button > a" + override fun popularMangaNextPageSelector(): String? { + TODO("Not yet implemented") + } + + override fun popularMangaParse(response: Response): MangasPage { + val document = response.asJsoup() + + val mangas = document.select(popularMangaSelector()).map { element -> + popularMangaFromElement(element) + } + + return MangasPage(mangas, true) + } + + override fun latestUpdatesParse(response: Response) = popularMangaParse(response) + override fun searchMangaParse(response: Response) = popularMangaParse(response) // =============================== Latest =============================== override fun latestUpdatesRequest(page: Int): Request = @@ -58,7 +74,6 @@ class AComics : ParsedHttpSource() { override fun latestUpdatesSelector() = popularMangaSelector() override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element) - override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() // =============================== Search ===============================