Add a new source to Gattsu (closes #8624). (#8642)

This commit is contained in:
Alessandro Jean 2021-08-19 06:57:18 -03:00 committed by GitHub
parent fde4fe46c5
commit e5d55d91b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 73 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -0,0 +1,69 @@
package eu.kanade.tachiyomi.extension.pt.universohentai
import eu.kanade.tachiyomi.annotations.Nsfw
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.multisrc.gattsu.Gattsu
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.util.concurrent.TimeUnit
@Nsfw
class UniversoHentai : Gattsu(
"Universo Hentai",
"https://universohentai.com",
"pt-BR"
) {
override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.build()
override fun latestUpdatesSelector() = "div.meio div.videos div.video a[href^=$baseUrl]:not(:has(span.selo-hd))"
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
title = element.selectFirst("span.video-titulo").text().trim()
thumbnail_url = element.selectFirst("img.wp-post-image").attr("src")
setUrlWithoutDomain(element.attr("href"))
}
override fun latestUpdatesNextPageSelector() = searchMangaNextPageSelector()
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
val postBox = document.selectFirst(chapterListSelector())!!
title = postBox.select("h1.post-titulo").first()!!.text()
author = postBox.select("ul.paginaPostItens li:contains(Artista) a").firstOrNull()?.text()
genre = postBox.select("ul.paginaPostItens li:contains(Categorias) a")
.joinToString(", ") { it.text() }
status = SManga.COMPLETED
thumbnail_url = postBox.select("div.paginaPostThumb > img.wp-post-image")
.attr("src")
.withoutSize()
}
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
return document.select(chapterListSelector())
.map { chapterFromElement(it) }
}
override fun chapterListSelector() = "div.meio div.post[itemscope]:has(a[title=Abrir galeria])"
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
name = "Capítulo único"
scanlator = element.select("ul.paginaPostItens li:contains(Tradutor) a").firstOrNull()?.text()
date_upload = element.ownerDocument().select("meta[property=article:published_time]").firstOrNull()
?.attr("content")
.orEmpty()
.toDate()
setUrlWithoutDomain(element.selectFirst("a[title=Abrir galeria]").attr("href"))
}
override fun pageListSelector() = "div.meio div.galeria div.galeria-foto a img"
}

View File

@ -129,7 +129,7 @@ abstract class Gattsu(
return GET(page.imageUrl!!, imageHeaders)
}
private fun String.toDate(): Long {
protected fun String.toDate(): Long {
return try {
DATE_FORMATTER.parse(this.substringBefore("T"))?.time ?: 0L
} catch (e: ParseException) {
@ -137,7 +137,7 @@ abstract class Gattsu(
}
}
private fun String.withoutSize(): String = this.replace(THUMB_SIZE_REGEX, ".")
protected fun String.withoutSize(): String = this.replace(THUMB_SIZE_REGEX, ".")
companion object {
private const val ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9," +

View File

@ -13,7 +13,8 @@ class GattsuGenerator : ThemeSourceGenerator {
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 Season", "https://hentaiseason.com", "pt-BR", isNsfw = true),
SingleLang("Universo Hentai", "https://universohentai.com", "pt-BR", isNsfw = true)
)
companion object {