mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed NontonAnimeID detail
This commit is contained in:
parent
b37dbc8ee9
commit
e02ad2a089
2 changed files with 17 additions and 38 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 4
|
version = 5
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -64,35 +64,8 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
return HomePageResponse(homePageList)
|
return HomePageResponse(homePageList)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getProperAnimeLink(uri: String): String {
|
|
||||||
return if (uri.contains("/anime/")) {
|
|
||||||
uri
|
|
||||||
} else {
|
|
||||||
var title = uri.substringAfter("$mainUrl/")
|
|
||||||
val fixTitle = Regex("(.*)-episode.*").find(title)?.groupValues?.getOrNull(1).toString()
|
|
||||||
title = when {
|
|
||||||
title.contains("utawarerumono-season-3") -> fixTitle.replace(
|
|
||||||
"season-3",
|
|
||||||
"futari-no-hakuoro"
|
|
||||||
)
|
|
||||||
title.contains("kingdom-season-4") -> fixTitle.replace("season-4", "4th-season")
|
|
||||||
title.contains("maou-sama-season-2") -> fixTitle.replace("season-2", "2")
|
|
||||||
title.contains("overlord-season-4") -> fixTitle.replace("season-4", "iv")
|
|
||||||
title.contains("kyoushitsu-e-season-2") -> fixTitle.replace(
|
|
||||||
"kyoushitsu-e-season-2",
|
|
||||||
"kyoushitsu-e-tv-2nd-season"
|
|
||||||
)
|
|
||||||
title.contains("season-2") -> fixTitle.replace("season-2", "2nd-season")
|
|
||||||
title.contains("season-3") -> fixTitle.replace("season-3", "3rd-season")
|
|
||||||
title.contains("movie") -> title.substringBefore("-movie")
|
|
||||||
else -> fixTitle
|
|
||||||
}
|
|
||||||
"$mainUrl/anime/$title"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Element.toSearchResult(): AnimeSearchResponse? {
|
private fun Element.toSearchResult(): AnimeSearchResponse? {
|
||||||
val href = getProperAnimeLink(fixUrl(this.selectFirst("a")!!.attr("href")))
|
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
|
||||||
val title = this.selectFirst("h3.title")?.text() ?: return null
|
val title = this.selectFirst("h3.title")?.text() ?: return null
|
||||||
val posterUrl = fixUrl(this.select("img").attr("data-src"))
|
val posterUrl = fixUrl(this.select("img").attr("data-src"))
|
||||||
|
|
||||||
|
@ -104,7 +77,7 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Element.toSearchResultPopular(): AnimeSearchResponse? {
|
private fun Element.toSearchResultPopular(): AnimeSearchResponse? {
|
||||||
val href = getProperAnimeLink(fixUrl(this.selectFirst("a")!!.attr("href")))
|
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
|
||||||
val title = this.selectFirst("h4")?.text()?.trim() ?: return null
|
val title = this.selectFirst("h4")?.text()?.trim() ?: return null
|
||||||
val posterUrl = fixUrl(this.select("img").attr("data-src"))
|
val posterUrl = fixUrl(this.select("img").attr("data-src"))
|
||||||
|
|
||||||
|
@ -134,15 +107,14 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class EpResponse(
|
override suspend fun load(url: String): LoadResponse? {
|
||||||
@JsonProperty("posts") val posts: String?,
|
val fixUrl = if (url.contains("/anime/")) {
|
||||||
@JsonProperty("max_page") val max_page: Int?,
|
url
|
||||||
@JsonProperty("found_posts") val found_posts: Int?,
|
} else {
|
||||||
@JsonProperty("content") val content: String
|
app.get(url).document.selectFirst("div.nvs.nvsc a")?.attr("href")
|
||||||
)
|
}
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
val document = app.get(fixUrl ?: return null).document
|
||||||
val document = app.get(url).document
|
|
||||||
|
|
||||||
val title = document.selectFirst("h1.entry-title.cs")!!.text().trim()
|
val title = document.selectFirst("h1.entry-title.cs")!!.text().trim()
|
||||||
val poster = document.selectFirst(".poster > img")?.attr("data-src")
|
val poster = document.selectFirst(".poster > img")?.attr("data-src")
|
||||||
|
@ -254,4 +226,11 @@ class NontonAnimeIDProvider : MainAPI() {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private data class EpResponse(
|
||||||
|
@JsonProperty("posts") val posts: String?,
|
||||||
|
@JsonProperty("max_page") val max_page: Int?,
|
||||||
|
@JsonProperty("found_posts") val found_posts: Int?,
|
||||||
|
@JsonProperty("content") val content: String
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue