Add HentaiEra (#3382)

* Add HentaiEra

* typo fix
This commit is contained in:
KenjieDec 2024-06-04 12:23:41 +07:00 committed by GitHub
parent 7beef1de27
commit 6cf71d6490
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,10 @@
ext {
extName = 'HentaiEra'
extClass = '.HentaiEraFactory'
themePkg = 'galleryadults'
baseUrl = 'https://hentaiera.com'
overrideVersionCode = 0
isNsfw = true
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,104 @@
package eu.kanade.tachiyomi.extension.all.hentaiera
import eu.kanade.tachiyomi.multisrc.galleryadults.GalleryAdults
import eu.kanade.tachiyomi.multisrc.galleryadults.Genre
import eu.kanade.tachiyomi.multisrc.galleryadults.SearchFlagFilter
import eu.kanade.tachiyomi.multisrc.galleryadults.imgAttr
import eu.kanade.tachiyomi.multisrc.galleryadults.toBinary
import eu.kanade.tachiyomi.network.GET
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class HentaiEra(
lang: String = "all",
override val mangaLang: String = LANGUAGE_MULTI,
) : GalleryAdults(
"HentaiEra",
"https://hentaiera.com",
lang = lang,
) {
override val supportsLatest = true
override val useIntermediateSearch: Boolean = true
override val supportSpeechless: Boolean = true
override fun Element.mangaTitle(selector: String): String? =
mangaFullTitle(selector.replace("caption", "gallery_title")).let {
if (preferences.shortTitle) it?.shortenTitle() else it
}
override fun Element.mangaLang() =
select("a:has(.g_flag)").attr("href")
.removeSuffix("/").substringAfterLast("/")
.let {
// Include Speechless in search results
if (it == LANGUAGE_SPEECHLESS) mangaLang else it
}
override fun popularMangaRequest(page: Int): Request {
// Only for query string or multiple tags
val url = "$baseUrl/search".toHttpUrl().newBuilder().apply {
addQueryParameter("pp", "1")
getLanguageURIs().forEach { pair ->
addQueryParameter(
pair.second,
toBinary(mangaLang == pair.first || mangaLang == LANGUAGE_MULTI),
)
}
addPageUri(page)
}
return GET(url.build())
}
/* Details */
override fun Element.getInfo(tag: String): String {
return select("li:has(.tags_text:contains($tag)) .tag .item_name")
.joinToString {
val name = it.ownText()
if (tag.contains(regexTag)) {
genres[name] = it.parent()!!.attr("href")
.removeSuffix("/").substringAfterLast('/')
}
listOf(
name,
it.select(".split_tag").text()
.trim()
.removePrefix("| "),
)
.filter { s -> s.isNotBlank() }
.joinToString()
}
}
override fun Element.getCover() =
selectFirst(".left_cover img")?.imgAttr()
override fun tagsParser(document: Document): List<Genre> {
return document.select("h2.gallery_title a")
.mapNotNull {
Genre(
it.text(),
it.attr("href")
.removeSuffix("/").substringAfterLast('/'),
)
}
}
override val mangaDetailInfoSelector = ".gallery_first"
/* Pages */
override val thumbnailSelector = ".gthumb"
override val pageUri = "view"
override fun getCategoryURIs() = listOf(
SearchFlagFilter("Manga", "mg"),
SearchFlagFilter("Doujinshi", "dj"),
SearchFlagFilter("Western", "ws"),
SearchFlagFilter("Image Set", "is"),
SearchFlagFilter("Artist CG", "ac"),
SearchFlagFilter("Game CG", "gc"),
)
}

View File

@ -0,0 +1,19 @@
package eu.kanade.tachiyomi.extension.all.hentaiera
import eu.kanade.tachiyomi.multisrc.galleryadults.GalleryAdults
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
class HentaiEraFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
HentaiEra("en", GalleryAdults.LANGUAGE_ENGLISH),
HentaiEra("ja", GalleryAdults.LANGUAGE_JAPANESE),
HentaiEra("es", GalleryAdults.LANGUAGE_SPANISH),
HentaiEra("fr", GalleryAdults.LANGUAGE_FRENCH),
HentaiEra("ko", GalleryAdults.LANGUAGE_KOREAN),
HentaiEra("de", GalleryAdults.LANGUAGE_GERMAN),
HentaiEra("ru", GalleryAdults.LANGUAGE_RUSSIAN),
HentaiEra("all", GalleryAdults.LANGUAGE_MULTI),
)
}