From c3d3205ab52db0e651e8d82d11e1556897244e09 Mon Sep 17 00:00:00 2001 From: helo Date: Fri, 22 Sep 2023 16:38:38 +0700 Subject: [PATCH] Nimegami: fixed missing source --- Nimegami/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Extractors.kt | 7 +----- .../src/main/kotlin/com/hexated/Nimegami.kt | 23 ++++++++++++++----- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Nimegami/build.gradle.kts b/Nimegami/build.gradle.kts index a1e4ca98..c6a3c32a 100644 --- a/Nimegami/build.gradle.kts +++ b/Nimegami/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 5 +version = 6 cloudstream { diff --git a/Nimegami/src/main/kotlin/com/hexated/Extractors.kt b/Nimegami/src/main/kotlin/com/hexated/Extractors.kt index a7f36f2e..1f1f5389 100644 --- a/Nimegami/src/main/kotlin/com/hexated/Extractors.kt +++ b/Nimegami/src/main/kotlin/com/hexated/Extractors.kt @@ -32,13 +32,8 @@ open class Mitedrive : ExtractorApi() { this.name, this.name, video ?: return, - "$mainUrl/", + "", Qualities.Unknown.value, - headers = mapOf( - "Accept" to "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5", - "Sec-Fetch-Dest" to "video", - "Sec-Fetch-Mode" to "no-cors", - ) ) ) diff --git a/Nimegami/src/main/kotlin/com/hexated/Nimegami.kt b/Nimegami/src/main/kotlin/com/hexated/Nimegami.kt index 5fffdd9d..ed1353f7 100644 --- a/Nimegami/src/main/kotlin/com/hexated/Nimegami.kt +++ b/Nimegami/src/main/kotlin/com/hexated/Nimegami.kt @@ -104,7 +104,8 @@ class Nimegami : MainAPI() { val episodes = document.select("div.list_eps_stream li") .mapNotNull { - val episode = Regex("Episode\\s?(\\d+)").find(it.text())?.groupValues?.getOrNull(0)?.toIntOrNull() + val episode = Regex("Episode\\s?(\\d+)").find(it.text())?.groupValues?.getOrNull(0) + ?.toIntOrNull() val link = it.attr("data") Episode(link, episode = episode) } @@ -120,7 +121,7 @@ class Nimegami : MainAPI() { } } - val tracker = APIHolder.getTracker(listOf(title),TrackerType.getTypes(type),year,true) + val tracker = APIHolder.getTracker(listOf(title), TrackerType.getTypes(type), year, true) return newAnimeLoadResponse(title, url, type) { engName = title @@ -148,7 +149,13 @@ class Nimegami : MainAPI() { tryParseJson>(base64Decode(data))?.map { sources -> sources.url?.apmap { url -> - loadFixedExtractor(url.fixIframe(), sources.format, "$mainUrl/", subtitleCallback, callback) + loadFixedExtractor( + url.fixIframe(), + sources.format, + "$mainUrl/", + subtitleCallback, + callback + ) } } @@ -184,18 +191,22 @@ class Nimegami : MainAPI() { } } - private fun Elements.getContent(css: String) : Elements { + private fun Elements.getContent(css: String): Elements { return this.select("tr:contains($css) td:last-child") } - private fun String.fixIframe() : String { + private fun String.fixIframe(): String { val url = base64Decode(this.substringAfter("url=").substringAfter("id=")) - val host = getBaseUrl(url) return when { url.contains("hxfile") -> { + val host = getBaseUrl(url) val id = url.substringAfterLast("/") "$host/embed-$id.html" } + url.startsWith("https://mitedrive.my.id") -> url.replace( + "https://mitedrive.my.id", + "https://mitedrive.com" + ) else -> fixUrl(url) } }