From 1e0146eea010e82912f9ac42d163b9a372ccf1fe Mon Sep 17 00:00:00 2001 From: Alessandro Jean Date: Mon, 31 Jan 2022 09:12:57 -0300 Subject: [PATCH] Fix missing latest pages in Gattsu sources. (#10608) --- .../gattsu/hentaitokyo/src/HentaiTokyo.kt | 17 +++++++++++++++++ .../gattsu/universohentai/src/UniversoHentai.kt | 2 -- .../kanade/tachiyomi/multisrc/gattsu/Gattsu.kt | 9 ++++++--- .../multisrc/gattsu/GattsuGenerator.kt | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 multisrc/overrides/gattsu/hentaitokyo/src/HentaiTokyo.kt diff --git a/multisrc/overrides/gattsu/hentaitokyo/src/HentaiTokyo.kt b/multisrc/overrides/gattsu/hentaitokyo/src/HentaiTokyo.kt new file mode 100644 index 000000000..19619cec1 --- /dev/null +++ b/multisrc/overrides/gattsu/hentaitokyo/src/HentaiTokyo.kt @@ -0,0 +1,17 @@ +package eu.kanade.tachiyomi.extension.pt.hentaitokyo + +import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.multisrc.gattsu.Gattsu +import okhttp3.OkHttpClient +import java.util.concurrent.TimeUnit + +class HentaiTokyo : Gattsu( + "Hentai Tokyo", + "https://hentaitokyo.net", + "pt-BR" +) { + + override val client: OkHttpClient = super.client.newBuilder() + .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) + .build() +} diff --git a/multisrc/overrides/gattsu/universohentai/src/UniversoHentai.kt b/multisrc/overrides/gattsu/universohentai/src/UniversoHentai.kt index 7824cd2f6..285637566 100644 --- a/multisrc/overrides/gattsu/universohentai/src/UniversoHentai.kt +++ b/multisrc/overrides/gattsu/universohentai/src/UniversoHentai.kt @@ -29,8 +29,6 @@ class UniversoHentai : Gattsu( setUrlWithoutDomain(element.attr("href")) } - override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector() - override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { val postBox = document.selectFirst(chapterListSelector())!! diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt index 160a9f586..6a6273afb 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt @@ -42,7 +42,10 @@ abstract class Gattsu( override fun popularMangaNextPageSelector(): String? = latestUpdatesNextPageSelector() - override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl, headers) + override fun latestUpdatesRequest(page: Int): Request { + val path = if (page == 1) "" else "page/$page" + return GET("$baseUrl/$path", headers) + } override fun latestUpdatesSelector() = "div.meio div.lista ul li a[href^=$baseUrl]" @@ -52,7 +55,7 @@ abstract class Gattsu( setUrlWithoutDomain(element.attr("href")) } - override fun latestUpdatesNextPageSelector(): String? = null + override fun latestUpdatesNextPageSelector(): String = "ul.paginacao li.next > a" override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { val searchUrl = "$baseUrl/page/$page/".toHttpUrlOrNull()!!.newBuilder() @@ -67,7 +70,7 @@ abstract class Gattsu( override fun searchMangaFromElement(element: Element): SManga = latestUpdatesFromElement(element) - override fun searchMangaNextPageSelector() = "ul.paginacao li.next > a" + override fun searchMangaNextPageSelector(): String = latestUpdatesNextPageSelector() override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { val postBox = document.select("div.meio div.post-box").first()!! diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/GattsuGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/GattsuGenerator.kt index c8d2ff609..08f538f32 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/GattsuGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/GattsuGenerator.kt @@ -9,7 +9,7 @@ class GattsuGenerator : ThemeSourceGenerator { override val themeClass = "Gattsu" - override val baseVersionCode: Int = 2 + override val baseVersionCode: Int = 3 override val sources = listOf( SingleLang("Hentai Season", "https://hentaiseason.com", "pt-BR", isNsfw = true),