HentaiHere: show all tags, minor fixes (#10879)
* Rewrite mangaDetailsParse and show all tags * auto format * fix text search encoding
This commit is contained in:
parent
5d98d87628
commit
c546ec30df
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'HentaiHere'
|
extName = 'HentaiHere'
|
||||||
pkgNameSuffix = 'en.hentaihere'
|
pkgNameSuffix = 'en.hentaihere'
|
||||||
extClass = '.HentaiHere'
|
extClass = '.HentaiHere'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import eu.kanade.tachiyomi.source.model.SManga
|
|||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
@ -44,7 +45,11 @@ class HentaiHere : ParsedHttpSource() {
|
|||||||
searchMangaNextPageSelector()
|
searchMangaNextPageSelector()
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
override fun fetchSearchManga(
|
||||||
|
page: Int,
|
||||||
|
query: String,
|
||||||
|
filters: FilterList
|
||||||
|
): Observable<MangasPage> {
|
||||||
return if (query.startsWith(PREFIX_ID_SEARCH)) {
|
return if (query.startsWith(PREFIX_ID_SEARCH)) {
|
||||||
val id = query.removePrefix(PREFIX_ID_SEARCH)
|
val id = query.removePrefix(PREFIX_ID_SEARCH)
|
||||||
client.newCall(searchMangaByIdRequest(id))
|
client.newCall(searchMangaByIdRequest(id))
|
||||||
@ -78,27 +83,32 @@ class HentaiHere : ParsedHttpSource() {
|
|||||||
val alphabetItem = alphabetFilterList[alphabetIndex]
|
val alphabetItem = alphabetFilterList[alphabetIndex]
|
||||||
val alphabet = if (alphabetIndex != 0) "/${alphabetItem.first}" else ""
|
val alphabet = if (alphabetIndex != 0) "/${alphabetItem.first}" else ""
|
||||||
|
|
||||||
return when {
|
val url = when {
|
||||||
// query + sort_min ~ /search?s=ore&sort=most-popular
|
// query + sort_min ~ /search?s=ore&sort=most-popular
|
||||||
query.isNotBlank() -> {
|
query.isNotBlank() -> {
|
||||||
GET("$baseUrl/search?s=$query&sort=$sortMin&page=$page")
|
"$baseUrl/search".toHttpUrl().newBuilder().apply {
|
||||||
|
addQueryParameter("s", query)
|
||||||
|
addQueryParameter("sort", sortMin)
|
||||||
|
addQueryParameter("page", page.toString())
|
||||||
|
}.toString()
|
||||||
}
|
}
|
||||||
// category + sort_min + alphabet (optional) ~ /search/t34/newest/a
|
// category + sort_min + alphabet (optional) ~ /search/t34/newest/a
|
||||||
categoryFilter.state != 0 -> {
|
categoryFilter.state != 0 -> {
|
||||||
val category = categoryFilterList[categoryFilter.state].first
|
val category = categoryFilterList[categoryFilter.state].first
|
||||||
GET("$baseUrl/search/$category/$sortMin$alphabet?page=$page")
|
"$baseUrl/search/$category/$sortMin$alphabet?page=$page"
|
||||||
}
|
}
|
||||||
// status + alphabet (optional) ~ /directory/ongoing/a
|
// status + alphabet (optional) ~ /directory/ongoing/a
|
||||||
statusFilter.state != 0 -> {
|
statusFilter.state != 0 -> {
|
||||||
val status = statusFilterList[statusFilter.state].first
|
val status = statusFilterList[statusFilter.state].first
|
||||||
GET("$baseUrl/directory/$status$alphabet?page=$page")
|
"$baseUrl/directory/$status$alphabet?page=$page"
|
||||||
}
|
}
|
||||||
// sort + alphabet (optional) ~ /directory/staff-pick/a
|
// sort + alphabet (optional) ~ /directory/staff-pick/a
|
||||||
else -> {
|
else -> {
|
||||||
val sort = sortItem.first
|
val sort = sortItem.first
|
||||||
GET("$baseUrl/directory/$sort$alphabet?page=$page")
|
"$baseUrl/directory/$sort$alphabet?page=$page"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return GET(url, headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaSelector() = ".item"
|
override fun searchMangaSelector() = ".item"
|
||||||
@ -138,24 +148,32 @@ class HentaiHere : ParsedHttpSource() {
|
|||||||
searchMangaNextPageSelector()
|
searchMangaNextPageSelector()
|
||||||
|
|
||||||
// Details
|
// Details
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||||
val genres = document.select("#info > div:nth-child(10) > a")
|
val categories = document.select("#info .text-info:contains(Cat) ~ a")
|
||||||
val licensed = genres.find { it.text() == "Licensed" }
|
val contents = document.select("#info .text-info:contains(Content:) ~ a")
|
||||||
|
val licensed = categories.find { it.text() == "Licensed" }
|
||||||
|
|
||||||
return SManga.create().apply {
|
title = document.select("*[itemprop='name']").first()!!.text()
|
||||||
title = document.select("*[itemprop='name']").text().trim()
|
author = document.select("#info .text-info:contains(Artist:) ~ a")
|
||||||
author = document.select("#info > div:nth-child(9) > a").text()
|
.joinToString { it.text() }
|
||||||
description = document.select("#info > div:last-child").text()
|
|
||||||
.substringAfter("Brief Summary:")
|
description = document.select("#info > div:has(> .text-info:contains(Brief Summary:))")
|
||||||
.trim()
|
.first()
|
||||||
genre = genres.joinToString(", ") { it.text() }
|
?.ownText()
|
||||||
status = if (licensed != null) {
|
if (description == "Nothing yet!") { description = "" }
|
||||||
SManga.LICENSED
|
|
||||||
} else {
|
genre = (categories + contents).joinToString { it.text() }
|
||||||
document.select("#info > div:nth-child(4) > a").text().trim().toStatus()
|
status = when (licensed) {
|
||||||
}
|
null -> document.select("#info .text-info:contains(Status:) ~ a")
|
||||||
thumbnail_url = document.select("#cover img").attr("src")
|
.first()
|
||||||
|
?.text()
|
||||||
|
?.toStatus()
|
||||||
|
?: SManga.UNKNOWN
|
||||||
|
else -> SManga.LICENSED
|
||||||
}
|
}
|
||||||
|
thumbnail_url = document.select("#cover img")
|
||||||
|
.first()!!
|
||||||
|
.attr("src")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chapters
|
// Chapters
|
||||||
|
Loading…
x
Reference in New Issue
Block a user