Add a new source to Gattsu and fix HK. (#8995)
This commit is contained in:
parent
64ed6df252
commit
4a4d375fd6
|
@ -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()
|
||||||
|
}
|
|
@ -109,12 +109,12 @@ abstract class Gattsu(
|
||||||
setUrlWithoutDomain(element.ownerDocument().location())
|
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<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
return document.select(pageListSelector())
|
return document.select(pageListSelector())
|
||||||
.mapIndexed { i, el ->
|
.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)
|
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 {
|
protected fun String.toDate(): Long {
|
||||||
return try {
|
return try {
|
||||||
DATE_FORMATTER.parse(this.substringBefore("T"))?.time ?: 0L
|
DATE_FORMATTER.parse(this.substringBefore("T"))?.time ?: 0L
|
||||||
|
|
|
@ -9,11 +9,12 @@ class GattsuGenerator : ThemeSourceGenerator {
|
||||||
|
|
||||||
override val themeClass = "Gattsu"
|
override val themeClass = "Gattsu"
|
||||||
|
|
||||||
override val baseVersionCode: Int = 1
|
override val baseVersionCode: Int = 2
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
SingleLang("Hentai Kai", "https://hentaikai.com", "pt-BR", isNsfw = true),
|
SingleLang("Hentai Kai", "https://hentaikai.com", "pt-BR", isNsfw = true),
|
||||||
SingleLang("Hentai Season", "https://hentaiseason.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)
|
SingleLang("Universo Hentai", "https://universohentai.com", "pt-BR", isNsfw = true)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue