From 610bb856c5503d9ec4a4f20ee1a985fae55a97d2 Mon Sep 17 00:00:00 2001 From: hexated Date: Wed, 30 Aug 2023 15:03:08 +0700 Subject: [PATCH] AnimeIndo: fix homepage --- AnimeIndoProvider/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/AnimeIndoProvider.kt | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AnimeIndoProvider/build.gradle.kts b/AnimeIndoProvider/build.gradle.kts index e2cc3499..d52cf888 100644 --- a/AnimeIndoProvider/build.gradle.kts +++ b/AnimeIndoProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 12 +version = 13 cloudstream { diff --git a/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt b/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt index 91f8de5e..aee7726e 100644 --- a/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt +++ b/AnimeIndoProvider/src/main/kotlin/com/hexated/AnimeIndoProvider.kt @@ -60,22 +60,22 @@ class AnimeIndoProvider : MainAPI() { return if (uri.contains("/anime/")) { uri } else { - var title = uri.substringAfter("nonton/") + var title = uri.substringAfter("$mainUrl/") title = when { - (title.contains("-episode")) && !(title.contains("-movie")) -> Regex("(.+)-episode").find( - title - )?.groupValues?.get(1).toString() - (title.contains("-movie")) -> Regex("(.+)-movie").find(title)?.groupValues?.get( - 1 - ).toString() + (title.contains("-episode")) && !(title.contains("-movie")) -> title.substringBefore( + "-episode" + ) + + (title.contains("-movie")) -> title.substringBefore("-movie") else -> title } + "$mainUrl/anime/$title" } } 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 posterUrl = fixUrlNull(this.selectFirst("img")?.attr("src")) val epNum = this.selectFirst("span.episode")?.ownText()?.replace(Regex("\\D"), "")?.trim()