AnimeIndo: fix homepage

This commit is contained in:
hexated 2023-08-30 15:03:08 +07:00
parent 54a7268902
commit 610bb856c5
2 changed files with 9 additions and 9 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 12 version = 13
cloudstream { cloudstream {

View file

@ -60,22 +60,22 @@ class AnimeIndoProvider : MainAPI() {
return if (uri.contains("/anime/")) { return if (uri.contains("/anime/")) {
uri uri
} else { } else {
var title = uri.substringAfter("nonton/") var title = uri.substringAfter("$mainUrl/")
title = when { title = when {
(title.contains("-episode")) && !(title.contains("-movie")) -> Regex("(.+)-episode").find( (title.contains("-episode")) && !(title.contains("-movie")) -> title.substringBefore(
title "-episode"
)?.groupValues?.get(1).toString() )
(title.contains("-movie")) -> Regex("(.+)-movie").find(title)?.groupValues?.get(
1 (title.contains("-movie")) -> title.substringBefore("-movie")
).toString()
else -> title else -> title
} }
"$mainUrl/anime/$title" "$mainUrl/anime/$title"
} }
} }
private fun Element.toSearchResult(): AnimeSearchResponse { private fun Element.toSearchResult(): AnimeSearchResponse {
val title = this.selectFirst("div.titlex, h2.entry-title, h4")?.text()?.trim() ?: "" val title = this.selectFirst("div.title, h2.entry-title, h4")?.text()?.trim() ?: ""
val href = getProperAnimeLink(this.selectFirst("a")!!.attr("href")) val href = getProperAnimeLink(this.selectFirst("a")!!.attr("href"))
val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src")) val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src"))
val epNum = this.selectFirst("span.episode")?.ownText()?.replace(Regex("\\D"), "")?.trim() val epNum = this.selectFirst("span.episode")?.ownText()?.replace(Regex("\\D"), "")?.trim()