diff --git a/multisrc/overrides/foolslide/hentaitokyo/src/HentaiTokyo.kt b/multisrc/overrides/foolslide/hentaitokyo/src/HentaiTokyo.kt new file mode 100644 index 000000000..2b06439c9 --- /dev/null +++ b/multisrc/overrides/foolslide/hentaitokyo/src/HentaiTokyo.kt @@ -0,0 +1,19 @@ +package eu.kanade.tachiyomi.extension.pt.hentaitokyo + +import eu.kanade.tachiyomi.annotations.Nsfw +import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.multisrc.gattsu.Gattsu +import okhttp3.OkHttpClient +import java.util.concurrent.TimeUnit + +@Nsfw +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/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/gattsu/Gattsu.kt index 24a06b050..160a9f586 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 @@ -109,12 +109,12 @@ abstract class Gattsu( setUrlWithoutDomain(element.ownerDocument().location()) } - protected open fun pageListSelector(): String = "div.meio div.post-box ul.post-fotos li a img" + protected open fun pageListSelector(): String = "div.meio div.post-box ul.post-fotos li a > img" override fun pageListParse(document: Document): List { return document.select(pageListSelector()) .mapIndexed { i, el -> - Page(i, document.location(), el.attr("src").withoutSize()) + Page(i, document.location(), el.imgAttr().withoutSize()) } } @@ -129,6 +129,10 @@ abstract class Gattsu( return GET(page.imageUrl!!, imageHeaders) } + protected fun Element.imgAttr(): String = + if (hasAttr("data-src")) attr("abs:data-src") + else attr("abs:src") + protected fun String.toDate(): Long { return try { DATE_FORMATTER.parse(this.substringBefore("T"))?.time ?: 0L 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 80be9ec34..bded53867 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,11 +9,12 @@ class GattsuGenerator : ThemeSourceGenerator { override val themeClass = "Gattsu" - override val baseVersionCode: Int = 1 + override val baseVersionCode: Int = 2 override val sources = listOf( SingleLang("Hentai Kai", "https://hentaikai.com", "pt-BR", isNsfw = true), SingleLang("Hentai Season", "https://hentaiseason.com", "pt-BR", isNsfw = true), + SingleLang("Hentai Tokyo", "https://hentaitokyo.net", "pt-BR", isNsfw = true), SingleLang("Universo Hentai", "https://universohentai.com", "pt-BR", isNsfw = true) )