mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed #432
This commit is contained in:
parent
fb73c9eabb
commit
a496f79f05
13 changed files with 31 additions and 208 deletions
|
@ -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<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,
|
||||
)
|
||||
}
|
|
@ -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("."))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue