From c034103e815b8b08088a42b67c03946fd278ec0f Mon Sep 17 00:00:00 2001 From: hexated Date: Sat, 30 Sep 2023 23:31:50 +0700 Subject: [PATCH] solved #299 --- Gomov/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Extractors.kt | 45 ++++++++++++----- Gomov/src/main/kotlin/com/hexated/Ngefilm.kt | 2 +- SoraStream/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Extractors.kt | 48 +++++++++++++------ .../main/kotlin/com/hexated/SoraExtractor.kt | 2 +- build.gradle.kts | 2 +- 7 files changed, 70 insertions(+), 33 deletions(-) diff --git a/Gomov/build.gradle.kts b/Gomov/build.gradle.kts index 5ef214de..bbf54acd 100644 --- a/Gomov/build.gradle.kts +++ b/Gomov/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.konan.properties.Properties // use an integer for version numbers -version = 18 +version = 19 android { defaultConfig { diff --git a/Gomov/src/main/kotlin/com/hexated/Extractors.kt b/Gomov/src/main/kotlin/com/hexated/Extractors.kt index fe627ba9..182ba35f 100644 --- a/Gomov/src/main/kotlin/com/hexated/Extractors.kt +++ b/Gomov/src/main/kotlin/com/hexated/Extractors.kt @@ -9,6 +9,9 @@ import com.lagradost.cloudstream3.extractors.helper.AesHelper import com.lagradost.cloudstream3.utils.AppUtils import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.M3u8Helper +import org.jsoup.nodes.Document +import org.mozilla.javascript.Context +import org.mozilla.javascript.Scriptable class Doods : DoodLaExtractor() { override var name = "Doods" @@ -49,10 +52,8 @@ class DbGdriveplayer : Gdriveplayer() { override var mainUrl = "https://database.gdriveplayer.us" } -class NineTv { +object NineTv { - companion object { - private const val key = "B#8G4o2\$WWFz" suspend fun getUrl( url: String, referer: String?, @@ -60,22 +61,20 @@ class NineTv { callback: (ExtractorLink) -> Unit ) { val mainUrl = getBaseUrl(url) - val master = Regex("MasterJS\\s*=\\s*'([^']+)").find( - app.get( - url, - referer = referer - ).text - )?.groupValues?.get(1) + val res = app.get(url, referer = referer) + val master = Regex("MasterJS\\s*=\\s*'([^']+)").find(res.text)?.groupValues?.get(1) + val key = res.document.getKeys() ?: throw ErrorLoadingException("can't generate key") val decrypt = AesHelper.cryptoAESHandler(master ?: return, key.toByteArray(), false) - ?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt") + ?.replace("\\", "") + ?: throw ErrorLoadingException("failed to decrypt") - val name = url.getHost() val source = Regex(""""?file"?:\s*"([^"]+)""").find(decrypt)?.groupValues?.get(1) val tracks = Regex("""tracks:\s*\[(.+)]""").find(decrypt)?.groupValues?.get(1) + val name = source?.getHost() M3u8Helper.generateM3u8( - name, - source ?: return, + name ?: return, + source, "$mainUrl/", headers = mapOf( "Accept" to "*/*", @@ -97,6 +96,26 @@ class NineTv { ) } } + + private fun Document.getKeys(): String? { + val script = (this.selectFirst("script:containsData(eval\\()")?.data() + ?.replace("eval(", "var result=")?.removeSuffix(");") + ";").trimIndent() + val run = script.runJS("result") + return """,\s*'([^']+)""".toRegex().find(run)?.groupValues?.getOrNull(1) + } + + fun String.runJS(variable: String): String { + val rhino = Context.enter() + rhino.optimizationLevel = -1 + val scope: Scriptable = rhino.initSafeStandardObjects() + val result: String + try { + rhino.evaluateString(scope, this, "JavaScript", 1, null) + result = Context.toString(scope.get(variable, scope)) + } finally { + Context.exit() + } + return result } data class Tracks( diff --git a/Gomov/src/main/kotlin/com/hexated/Ngefilm.kt b/Gomov/src/main/kotlin/com/hexated/Ngefilm.kt index 5fc0a5ee..ee9ec89e 100644 --- a/Gomov/src/main/kotlin/com/hexated/Ngefilm.kt +++ b/Gomov/src/main/kotlin/com/hexated/Ngefilm.kt @@ -9,7 +9,7 @@ import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.loadExtractor class Ngefilm : Gomov() { - override var mainUrl = "https://ngef-film21.online" + override var mainUrl = "https://nge-film21.store" override var name = "Ngefilm" override val mainPage = mainPageOf( diff --git a/SoraStream/build.gradle.kts b/SoraStream/build.gradle.kts index a3522600..bb4a8615 100644 --- a/SoraStream/build.gradle.kts +++ b/SoraStream/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.konan.properties.Properties // use an integer for version numbers -version = 176 +version = 177 android { defaultConfig { diff --git a/SoraStream/src/main/kotlin/com/hexated/Extractors.kt b/SoraStream/src/main/kotlin/com/hexated/Extractors.kt index eb034448..4caadfd4 100644 --- a/SoraStream/src/main/kotlin/com/hexated/Extractors.kt +++ b/SoraStream/src/main/kotlin/com/hexated/Extractors.kt @@ -14,6 +14,9 @@ import com.lagradost.cloudstream3.base64Decode import com.lagradost.cloudstream3.extractors.Pixeldrain import com.lagradost.cloudstream3.extractors.helper.AesHelper import com.lagradost.cloudstream3.utils.* +import org.jsoup.nodes.Document +import org.mozilla.javascript.Context +import org.mozilla.javascript.Scriptable import java.math.BigInteger import java.security.MessageDigest @@ -235,10 +238,8 @@ open class VCloud : ExtractorApi() { } -class NineTv { +object NineTv { - companion object { - private const val key = "B#8G4o2\$WWFz" suspend fun getUrl( url: String, referer: String?, @@ -246,22 +247,20 @@ class NineTv { callback: (ExtractorLink) -> Unit ) { val mainUrl = getBaseUrl(url) - val master = Regex("MasterJS\\s*=\\s*'([^']+)").find( - app.get( - url, - referer = referer - ).text - )?.groupValues?.get(1) + val res = app.get(url, referer = referer) + val master = Regex("MasterJS\\s*=\\s*'([^']+)").find(res.text)?.groupValues?.get(1) + val key = res.document.getKeys() ?: throw ErrorLoadingException("can't generate key") val decrypt = AesHelper.cryptoAESHandler(master ?: return, key.toByteArray(), false) - ?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt") + ?.replace("\\", "") + ?: throw ErrorLoadingException("failed to decrypt") - val name = url.getHost() val source = Regex(""""?file"?:\s*"([^"]+)""").find(decrypt)?.groupValues?.get(1) val tracks = Regex("""tracks:\s*\[(.+)]""").find(decrypt)?.groupValues?.get(1) + val name = source?.getHost() M3u8Helper.generateM3u8( - name, - source ?: return, + name ?: return, + source, "$mainUrl/", headers = mapOf( "Accept" to "*/*", @@ -283,6 +282,26 @@ class NineTv { ) } } + + private fun Document.getKeys(): String? { + val script = (this.selectFirst("script:containsData(eval\\()")?.data() + ?.replace("eval(", "var result=")?.removeSuffix(");") + ";").trimIndent() + val run = script.runJS("result") + return """,\s*'([^']+)""".toRegex().find(run)?.groupValues?.getOrNull(1) + } + + private fun String.runJS(variable: String): String { + val rhino = Context.enter() + rhino.optimizationLevel = -1 + val scope: Scriptable = rhino.initSafeStandardObjects() + val result: String + try { + rhino.evaluateString(scope, this, "JavaScript", 1, null) + result = Context.toString(scope.get(variable, scope)) + } finally { + Context.exit() + } + return result } data class Tracks( @@ -329,5 +348,4 @@ class MultimoviesSB : StreamSB() { class Yipsu : Voe() { override val name = "Yipsu" override var mainUrl = "https://yip.su" -} - +} \ No newline at end of file diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 6f0b0c3f..da2fc734 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -303,7 +303,7 @@ object SoraExtractor : SoraStream() { else -> it.embed_url } } ?: return@apmap - val sources = arrayOf("https://chillx.top", "https://watchx.top", "https://bestx.stream") + val sources = arrayOf("https://chillx.top", "https://watchx.top", "https://bestx.stream", "https://w1.moviesapi.club") when { sources.any { source.startsWith(it) } -> NineTv.getUrl(source, "$referer/", subtitleCallback, callback) !source.contains("youtube") -> { diff --git a/build.gradle.kts b/build.gradle.kts index ce352dd2..81a4d9e1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -78,7 +78,7 @@ subprojects { // but you dont need to include any of them if you dont need them // https://github.com/recloudstream/cloudstream/blob/master/app/build.gradle implementation(kotlin("stdlib")) // adds standard kotlin features, like listOf, mapOf etc - implementation("com.github.Blatzar:NiceHttp:0.4.2") // http library + implementation("com.github.Blatzar:NiceHttp:0.4.3") // http library implementation("org.jsoup:jsoup:1.15.3") // html parser implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1") implementation("io.karn:khttp-android:0.1.2")