From 25e2deb2493801723dc0463064a7bb8252c68b86 Mon Sep 17 00:00:00 2001 From: hexated Date: Thu, 29 Dec 2022 18:48:41 +0700 Subject: [PATCH] fixed Otakudesu, Rebahin, Kuramanime --- KuramanimeProvider/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/KuramanimeProvider.kt | 13 +++++++++---- OtakudesuProvider/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/OtakudesuProvider.kt | 2 +- RebahinProvider/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/RebahinProvider.kt | 2 +- .../src/main/kotlin/com/hexated/SoraExtractor.kt | 8 ++------ 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/KuramanimeProvider/build.gradle.kts b/KuramanimeProvider/build.gradle.kts index 06299be3..e4eb4e4d 100644 --- a/KuramanimeProvider/build.gradle.kts +++ b/KuramanimeProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 5 +version = 6 cloudstream { diff --git a/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt b/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt index 0128f0ee..e79b0153 100644 --- a/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt +++ b/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt @@ -91,7 +91,7 @@ class KuramanimeProvider : MainAPI() { val link = "$mainUrl/anime?search=$query&order_by=latest" val document = app.get(link).document - return document.select("div#animeList div.col-lg-4.col-md-6.col-sm-6").mapNotNull { + return document.select("div#animeList div.product__item").mapNotNull { it.toSearchResult() } } @@ -123,12 +123,17 @@ class KuramanimeProvider : MainAPI() { ) ).parsedSafe()?.data?.media?.id - val episodes = - Jsoup.parse(document.select("#episodeLists").attr("data-content")).select("a").map { + val episodes = mutableListOf() + + for (i in 1..5) { + val doc = app.get("$url?page=$i").document + val eps = Jsoup.parse(doc.select("#episodeLists").attr("data-content")).select("a").mapNotNull { val name = it.text().trim() val link = it.attr("href") Episode(link, name) - } + }.filter { it.name?.contains(Regex("(?i)(Terlama)|(Terbaru)")) == false } + if(eps.isEmpty()) break else episodes.addAll(eps) + } val recommendations = document.select("div#randomList > a").mapNotNull { val epHref = it.attr("href") diff --git a/OtakudesuProvider/build.gradle.kts b/OtakudesuProvider/build.gradle.kts index 00e70778..f3134bcd 100644 --- a/OtakudesuProvider/build.gradle.kts +++ b/OtakudesuProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 5 +version = 6 cloudstream { diff --git a/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProvider.kt b/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProvider.kt index 8857f63c..45fded6f 100644 --- a/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProvider.kt +++ b/OtakudesuProvider/src/main/kotlin/com/hexated/OtakudesuProvider.kt @@ -181,7 +181,7 @@ class OtakudesuProvider : MainAPI() { data // , interceptor = interceptor ).document - val scriptData = document.select("script").last()?.data() + val scriptData = document.select("script:containsData(action:)").lastOrNull()?.data() val token = scriptData?.substringAfter("{action:\"")?.substringBefore("\"}").toString() val nonce = app.post("$mainUrl/wp-admin/admin-ajax.php", data = mapOf("action" to token)) diff --git a/RebahinProvider/build.gradle.kts b/RebahinProvider/build.gradle.kts index 09a8646d..6749964c 100644 --- a/RebahinProvider/build.gradle.kts +++ b/RebahinProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 4 +version = 5 cloudstream { diff --git a/RebahinProvider/src/main/kotlin/com/hexated/RebahinProvider.kt b/RebahinProvider/src/main/kotlin/com/hexated/RebahinProvider.kt index 883fb34f..e8e5ad1e 100644 --- a/RebahinProvider/src/main/kotlin/com/hexated/RebahinProvider.kt +++ b/RebahinProvider/src/main/kotlin/com/hexated/RebahinProvider.kt @@ -13,7 +13,7 @@ import org.jsoup.nodes.Element import java.net.URI open class RebahinProvider : MainAPI() { - override var mainUrl = "http://104.237.198.197" + override var mainUrl = "http://104.237.198.198" override var name = "Rebahin" override val hasMainPage = true override var lang = "id" diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 02dfa4a1..320c9b25 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -1565,17 +1565,13 @@ object SoraExtractor : SoraStream() { subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ) { - val fixTitle = title?.replace(":", "") + val fixTitle = title?.fixTitle()?.replace("-", " ") val doc = app.get("$moviezAddAPI/?s=$fixTitle").document - // TODO find better way val matchMedia = doc.select("article.mh-loop-item").map { it.select("a").attr("href") to it.select("a").text() }.find { - (it.second.contains("$fixTitle", true) || it.second.contains( - "$title", - true - )) && it.first.contains("$year") + it.second.contains(Regex("(?i)($fixTitle)|($title)")) && it.first.contains("$year") } val detailLink =