Skip to content

Commit

Permalink
fixed #432
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjohn committed Dec 6, 2023
1 parent fb73c9e commit a496f79
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 208 deletions.
2 changes: 1 addition & 1 deletion Animasu/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 7
version = 8


cloudstream {
Expand Down
10 changes: 9 additions & 1 deletion Animasu/src/main/kotlin/com/hexated/Animasu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
84 changes: 0 additions & 84 deletions Gomov/src/main/kotlin/com/hexated/Extractors.kt
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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<List<Tracks>>("[$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,
)
}
19 changes: 2 additions & 17 deletions Gomov/src/main/kotlin/com/hexated/Gomov.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 ->
Expand All @@ -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)

}
}
Expand Down Expand Up @@ -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("."))
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Minioppai/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 8
version = 9


cloudstream {
Expand Down
4 changes: 3 additions & 1 deletion Minioppai/src/main/kotlin/com/hexated/Extractors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion Minioppai/src/main/kotlin/com/hexated/Minioppai.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion SoraStream/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties

// use an integer for version numbers
version = 199
version = 200

android {
defaultConfig {
Expand Down
88 changes: 6 additions & 82 deletions SoraStream/src/main/kotlin/com/hexated/Extractors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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<List<Tracks>>("[$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"
Expand Down Expand Up @@ -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"
}
18 changes: 3 additions & 15 deletions SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ object SoraExtractor : SoraStream() {
} else {
"$multimoviesAPI/episodes/$fixTitle-${season}x${episode}"
}
invokeWpmovies(null, url, subtitleCallback, callback)
}

suspend fun invokeNetmovies(
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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<BlackvidResponses>(data)

json?.sources?.map { source ->
Expand Down Expand Up @@ -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)

}

Expand Down
1 change: 1 addition & 0 deletions SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ class SoraStreamPlugin: Plugin() {
registerExtractorAPI(Embedwish())
registerExtractorAPI(Wishfast())
registerExtractorAPI(Uploadever())
registerExtractorAPI(Netembed())
}
}
Loading

0 comments on commit a496f79

Please sign in to comment.