From a496f79f05ac75923fd922b84f79a21c8eb21e99 Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 6 Dec 2023 11:15:42 +0700 Subject: [PATCH] fixed #432 --- Animasu/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Animasu.kt | 10 ++- .../src/main/kotlin/com/hexated/Extractors.kt | 84 ------------------ Gomov/src/main/kotlin/com/hexated/Gomov.kt | 19 +--- .../src/main/kotlin/com/hexated/Extractors.kt | 2 +- Minioppai/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Extractors.kt | 4 +- .../src/main/kotlin/com/hexated/Minioppai.kt | 2 +- SoraStream/build.gradle.kts | 2 +- .../src/main/kotlin/com/hexated/Extractors.kt | 88 ++----------------- .../main/kotlin/com/hexated/SoraExtractor.kt | 18 +--- .../kotlin/com/hexated/SoraStreamPlugin.kt | 1 + .../src/main/kotlin/com/hexated/SoraUtils.kt | 5 +- 13 files changed, 31 insertions(+), 208 deletions(-) diff --git a/Animasu/build.gradle.kts b/Animasu/build.gradle.kts index 7dc626dd..c2504dae 100644 --- a/Animasu/build.gradle.kts +++ b/Animasu/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 7 +version = 8 cloudstream { diff --git a/Animasu/src/main/kotlin/com/hexated/Animasu.kt b/Animasu/src/main/kotlin/com/hexated/Animasu.kt index f5989d85..4e726b6e 100644 --- a/Animasu/src/main/kotlin/com/hexated/Animasu.kt +++ b/Animasu/src/main/kotlin/com/hexated/Animasu.kt @@ -138,7 +138,7 @@ class Animasu : MainAPI() { document.select(".mobius > .mirror > option").mapNotNull { fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src")) to it.text() }.apmap { (iframe, quality) -> - loadFixedExtractor(iframe, quality, "$mainUrl/", subtitleCallback, callback) + loadFixedExtractor(iframe.fixIframe(), quality, "$mainUrl/", subtitleCallback, callback) } return true } @@ -166,6 +166,14 @@ class Animasu : MainAPI() { } } + private fun String.fixIframe() : String { + return if(this.startsWith("https://dl.berkasdrive.com")) { + base64Decode(this.substringAfter("id=")) + } else { + this + } + } + private fun getIndexQuality(str: String?): Int { return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull() ?: Qualities.Unknown.value diff --git a/Gomov/src/main/kotlin/com/hexated/Extractors.kt b/Gomov/src/main/kotlin/com/hexated/Extractors.kt index 35e1bc5d..8cb8cc50 100644 --- a/Gomov/src/main/kotlin/com/hexated/Extractors.kt +++ b/Gomov/src/main/kotlin/com/hexated/Extractors.kt @@ -1,21 +1,14 @@ package com.hexated -import com.fasterxml.jackson.annotation.JsonProperty -import com.lagradost.cloudstream3.ErrorLoadingException import com.lagradost.cloudstream3.SubtitleFile import com.lagradost.cloudstream3.apmap import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.base64Decode import com.lagradost.cloudstream3.extractors.* -import com.lagradost.cloudstream3.extractors.helper.AesHelper -import com.lagradost.cloudstream3.utils.AppUtils import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.M3u8Helper import com.lagradost.cloudstream3.utils.loadExtractor -import org.jsoup.nodes.Document -import org.mozilla.javascript.Context -import org.mozilla.javascript.Scriptable open class Uplayer : ExtractorApi() { override val name = "Uplayer" @@ -94,81 +87,4 @@ class Likessb : StreamSB() { class DbGdriveplayer : Gdriveplayer() { override var mainUrl = "https://database.gdriveplayer.us" -} - -object NineTv { - - suspend fun getUrl( - url: String, - referer: String?, - subtitleCallback: (SubtitleFile) -> Unit, - callback: (ExtractorLink) -> Unit - ) { - val mainUrl = getBaseUrl(url) - val res = app.get(url, headers = mapOf( - "Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", - "Accept-Language" to "en-US,en;q=0.5", - "Referer" to (referer ?: ""), - )) - val master = Regex("\\s*=\\s*'([^']+)").find(res.text)?.groupValues?.get(1) - val key = "tSIsE8FgpRkv3QQQ" - val decrypt = AesHelper.cryptoAESHandler(master ?: return, key.toByteArray(), false) - ?.replace("\\", "") - ?: throw ErrorLoadingException("failed to decrypt") - - val source = Regex(""""?file"?:\s*"([^"]+)""").find(decrypt)?.groupValues?.get(1) - val tracks = Regex("""tracks:\s*\[(.+)]""").find(decrypt)?.groupValues?.get(1) - val name = url.getHost() - - M3u8Helper.generateM3u8( - name, - source ?: return, - "$mainUrl/", - headers = mapOf( - "Accept" to "*/*", - "Connection" to "keep-alive", - "Sec-Fetch-Dest" to "empty", - "Sec-Fetch-Mode" to "cors", - "Sec-Fetch-Site" to "cross-site", - "Origin" to mainUrl, - ) - ).forEach(callback) - - AppUtils.tryParseJson>("[$tracks]") - ?.filter { it.kind == "captions" }?.map { track -> - subtitleCallback.invoke( - SubtitleFile( - track.label ?: "", - track.file ?: return@map null - ) - ) - } - } - - 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( - @JsonProperty("file") val file: String? = null, - @JsonProperty("label") val label: String? = null, - @JsonProperty("kind") val kind: String? = null, - ) } \ No newline at end of file diff --git a/Gomov/src/main/kotlin/com/hexated/Gomov.kt b/Gomov/src/main/kotlin/com/hexated/Gomov.kt index 948686b9..d1a8b699 100644 --- a/Gomov/src/main/kotlin/com/hexated/Gomov.kt +++ b/Gomov/src/main/kotlin/com/hexated/Gomov.kt @@ -20,7 +20,6 @@ open class Gomov : MainAPI() { TvType.TvSeries, TvType.AsianDrama ) - private val sources = arrayOf("https://chillx.top", "https://watchx.top", "https://bestx.stream") override val mainPage = mainPageOf( "page/%d/?s&search=advanced&post_type=movie" to "Movies", @@ -159,12 +158,7 @@ open class Gomov : MainAPI() { val iframe = app.get(fixUrl(ele.attr("href"))).document.selectFirst("div.gmr-embed-responsive iframe") .getIframeAttr()?.let { httpsify(it) } ?: return@apmap - when { - sources.any { iframe.startsWith(it) } -> NineTv.getUrl(iframe, "$directUrl/", subtitleCallback, callback) - else -> { - loadExtractor(iframe, "$directUrl/", subtitleCallback, callback) - } - } + loadExtractor(iframe, "$directUrl/", subtitleCallback, callback) } } else { document.select("div.tab-content-ajax").apmap { ele -> @@ -173,12 +167,7 @@ open class Gomov : MainAPI() { data = mapOf("action" to "muvipro_player_content", "tab" to ele.attr("id"), "post_id" to "$id") ).document.select("iframe").attr("src").let { httpsify(it) } - when { - sources.any { server.startsWith(it) } -> NineTv.getUrl(server, "$directUrl/", subtitleCallback, callback) - else -> { - loadExtractor(server, "$directUrl/", subtitleCallback, callback) - } - } + loadExtractor(server, "$directUrl/", subtitleCallback, callback) } } @@ -207,8 +196,4 @@ fun getBaseUrl(url: String): String { return URI(url).let { "${it.scheme}://${it.host}" } -} - -fun String.getHost(): String { - return fixTitle(URI(this).host.substringBeforeLast(".").substringAfterLast(".")) } \ No newline at end of file diff --git a/KuramanimeProvider/src/main/kotlin/com/hexated/Extractors.kt b/KuramanimeProvider/src/main/kotlin/com/hexated/Extractors.kt index e393fbc0..2b55fd0d 100644 --- a/KuramanimeProvider/src/main/kotlin/com/hexated/Extractors.kt +++ b/KuramanimeProvider/src/main/kotlin/com/hexated/Extractors.kt @@ -86,7 +86,7 @@ open class Kuramadrive : ExtractorApi() { val token = doc.select("meta[name=csrf-token]").attr("content") val routeCheckAvl = doc.select("input#routeCheckAvl").attr("value") - val json = app.post( + val json = app.get( routeCheckAvl, headers = mapOf( "X-Requested-With" to "XMLHttpRequest", "X-CSRF-TOKEN" to token diff --git a/Minioppai/build.gradle.kts b/Minioppai/build.gradle.kts index ee49ee06..87203b16 100644 --- a/Minioppai/build.gradle.kts +++ b/Minioppai/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 8 +version = 9 cloudstream { diff --git a/Minioppai/src/main/kotlin/com/hexated/Extractors.kt b/Minioppai/src/main/kotlin/com/hexated/Extractors.kt index 6a82e5d3..3e172453 100644 --- a/Minioppai/src/main/kotlin/com/hexated/Extractors.kt +++ b/Minioppai/src/main/kotlin/com/hexated/Extractors.kt @@ -44,10 +44,12 @@ open class Streampai : ExtractorApi() { this.name, this.name, fixUrl(it.file), - "$mainUrl/", + url, getQualityFromName(it.label), headers = mapOf( "Accept" to "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5", + "Accept-Language" to "en-US,en;q=0.5", + "DNT" to "1", "Range" to "bytes=0-", "Sec-Fetch-Dest" to "video", "Sec-Fetch-Mode" to "no-cors", diff --git a/Minioppai/src/main/kotlin/com/hexated/Minioppai.kt b/Minioppai/src/main/kotlin/com/hexated/Minioppai.kt index 2dc220a1..7eedfd01 100644 --- a/Minioppai/src/main/kotlin/com/hexated/Minioppai.kt +++ b/Minioppai/src/main/kotlin/com/hexated/Minioppai.kt @@ -127,7 +127,7 @@ class Minioppai : MainAPI() { val name = it.selectFirst("div.epl-num")?.text() val link = fixUrlNull(it.selectFirst("a")?.attr("href")) ?: return@mapNotNull null Episode(link, name = name) - }.reversed() + } return newAnimeLoadResponse(title, url, TvType.NSFW) { engName = title diff --git a/SoraStream/build.gradle.kts b/SoraStream/build.gradle.kts index cad26cc1..7d131b74 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 = 199 +version = 200 android { defaultConfig { diff --git a/SoraStream/src/main/kotlin/com/hexated/Extractors.kt b/SoraStream/src/main/kotlin/com/hexated/Extractors.kt index 917351ca..84985a8f 100644 --- a/SoraStream/src/main/kotlin/com/hexated/Extractors.kt +++ b/SoraStream/src/main/kotlin/com/hexated/Extractors.kt @@ -6,17 +6,13 @@ import com.lagradost.cloudstream3.extractors.StreamSB import com.lagradost.cloudstream3.extractors.Voe import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.APIHolder.getCaptchaToken -import com.lagradost.cloudstream3.ErrorLoadingException import com.lagradost.cloudstream3.SubtitleFile import com.lagradost.cloudstream3.apmap import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.base64Decode import com.lagradost.cloudstream3.extractors.Pixeldrain -import com.lagradost.cloudstream3.extractors.helper.AesHelper +import com.lagradost.cloudstream3.extractors.ZplayerV2 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 @@ -238,83 +234,6 @@ open class VCloud : ExtractorApi() { } -object NineTv { - - suspend fun getUrl( - url: String, - referer: String?, - subtitleCallback: (SubtitleFile) -> Unit, - callback: (ExtractorLink) -> Unit - ) { - val mainUrl = getBaseUrl(url) - val res = app.get(url, headers = mapOf( - "Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", - "Accept-Language" to "en-US,en;q=0.5", - "Referer" to (referer ?: ""), - )) - val master = Regex("\\s*=\\s*'([^']+)").find(res.text)?.groupValues?.get(1) - val key = "tSIsE8FgpRkv3QQQ" - val decrypt = AesHelper.cryptoAESHandler(master ?: return, key.toByteArray(), false) - ?.replace("\\", "") - ?: throw ErrorLoadingException("failed to decrypt") - - val source = Regex(""""?file"?:\s*"([^"]+)""").find(decrypt)?.groupValues?.get(1) - val tracks = Regex("""tracks:\s*\[(.+)]""").find(decrypt)?.groupValues?.get(1) - val name = url.getHost() - - M3u8Helper.generateM3u8( - name, - source ?: return, - "$mainUrl/", - headers = mapOf( - "Accept" to "*/*", - "Connection" to "keep-alive", - "Sec-Fetch-Dest" to "empty", - "Sec-Fetch-Mode" to "cors", - "Sec-Fetch-Site" to "cross-site", - "Origin" to mainUrl, - ) - ).forEach(callback) - - AppUtils.tryParseJson>("[$tracks]") - ?.filter { it.kind == "captions" }?.map { track -> - subtitleCallback.invoke( - SubtitleFile( - track.label ?: "", - track.file ?: return@map null - ) - ) - } - } - - 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( - @JsonProperty("file") val file: String? = null, - @JsonProperty("label") val label: String? = null, - @JsonProperty("kind") val kind: String? = null, - ) -} - open class Streamruby : ExtractorApi() { override val name = "Streamruby" override val mainUrl = "https://streamruby.com" @@ -447,4 +366,9 @@ class Yipsu : Voe() { class Embedwish : Filesim() { override val name = "Embedwish" override var mainUrl = "https://embedwish.com" +} + +class Netembed: ZplayerV2() { + override var name: String = "Netembed" + override var mainUrl: String = "https://play.netembed.xyz" } \ 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 9a22d127..cca52441 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -246,6 +246,7 @@ object SoraExtractor : SoraStream() { } else { "$multimoviesAPI/episodes/$fixTitle-${season}x${episode}" } + invokeWpmovies(null, url, subtitleCallback, callback) } suspend fun invokeNetmovies( @@ -326,20 +327,7 @@ object SoraExtractor : SoraStream() { else -> it.embed_url } } ?: return@apmap - 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") -> { loadCustomExtractor(name, source, "$referer/", subtitleCallback, callback) } @@ -2078,7 +2066,7 @@ object SoraExtractor : SoraStream() { "$blackvidAPI/v3/tv/sources/$tmdbId/$season/$episode?key=$key" } - val data = app.get(url, timeout = 120L, referer = ref).okhttpResponse.peekBody(1024 * 1024).bytes().decrypt("2378f8e4e844f2dc839ab48f66e00acc2305a401") + val data = app.get(url, timeout = 120L, referer = ref).okhttpResponse.peekBody(1024 * 128).bytes().decrypt("2378f8e4e844f2dc839ab48f66e00acc2305a401") val json = tryParseJson(data) json?.sources?.map { source -> @@ -2254,7 +2242,7 @@ object SoraExtractor : SoraStream() { val iframe = app.get(url, referer = "https://pressplay.top/").document.selectFirst("iframe") ?.attr("src") - NineTv.getUrl(iframe ?: return, "$nineTvAPI/", subtitleCallback, callback) + loadExtractor(iframe ?: return, "$nineTvAPI/", subtitleCallback, callback) } diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt index d8d2431a..d79cb6dd 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt @@ -28,5 +28,6 @@ class SoraStreamPlugin: Plugin() { registerExtractorAPI(Embedwish()) registerExtractorAPI(Wishfast()) registerExtractorAPI(Uploadever()) + registerExtractorAPI(Netembed()) } } \ No newline at end of file diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt index 6ea13e9c..5ff06e4b 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt @@ -766,9 +766,8 @@ suspend fun getTvMoviesServer(url: String, season: Int?, episode: Int?): Pair>>()?.first()?.get("link") +suspend fun fetchSfServer(): String { + return app.get("https://raw.githubusercontent.com/hexated/cloudstream-resources/main/sfmovies_server").text } suspend fun getFilmxyCookies(url: String) = filmxyCookies ?: fetchFilmxyCookies(url).also { filmxyCookies = it }