mirror of
https://github.com/recloudstream/cloudstream.git
synced 2025-05-17 19:25:55 +08:00
Fixed VidGuard and StreamSilk extractors (#1292)
This commit is contained in:
@ -16,7 +16,9 @@ open class StreamSilk : ExtractorApi() {
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val response = app.get(url, referer = referer)
|
||||
val response = app.get(url, headers = mapOf(
|
||||
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
),)
|
||||
response.document.select("script").firstOrNull {
|
||||
it.html().contains("h,u,n,t,e,r")
|
||||
}?.html()?.let { hunted ->
|
||||
@ -25,7 +27,7 @@ open class StreamSilk : ExtractorApi() {
|
||||
M3u8Helper.generateM3u8(
|
||||
name,
|
||||
link,
|
||||
mainUrl,
|
||||
"$mainUrl/"
|
||||
).forEach(callback)
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,14 @@ import org.mozilla.javascript.NativeObject
|
||||
import org.mozilla.javascript.Scriptable
|
||||
import java.util.Base64
|
||||
|
||||
class Vidguardto1 : Vidguardto() {
|
||||
override val mainUrl = "https://bembed.net"
|
||||
}
|
||||
|
||||
class Vidguardto2 : Vidguardto() {
|
||||
override val mainUrl = "https://listeamed.net"
|
||||
}
|
||||
|
||||
open class Vidguardto : ExtractorApi() {
|
||||
override val name = "Vidguard"
|
||||
override val mainUrl = "https://vidguard.to"
|
||||
@ -25,8 +33,8 @@ open class Vidguardto : ExtractorApi() {
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val res = app.get(url)
|
||||
val resc = res.document.select("script:containsData(eval)").firstOrNull()?.data()
|
||||
val res = app.get(url)
|
||||
val resc = res.document.select("script:containsData(eval)").firstOrNull()?.data()
|
||||
resc?.let {
|
||||
val jsonStr2 = AppUtils.parseJson<SvgObject>(runJS2(it))
|
||||
val watchlink = sigDecode(jsonStr2.stream)
|
||||
@ -69,28 +77,41 @@ open class Vidguardto : ExtractorApi() {
|
||||
}
|
||||
|
||||
private fun runJS2(hideMyHtmlContent: String): String {
|
||||
Log.d("runJS", "start")
|
||||
val rhino = Context.enter()
|
||||
rhino.initSafeStandardObjects()
|
||||
rhino.optimizationLevel = -1
|
||||
val scope: Scriptable = rhino.initSafeStandardObjects()
|
||||
scope.put("window", scope, scope)
|
||||
var result = ""
|
||||
try {
|
||||
Log.d("runJS", "Executing JavaScript: $hideMyHtmlContent")
|
||||
rhino.evaluateString(scope, hideMyHtmlContent, "JavaScript", 1, null)
|
||||
val svgObject = scope.get("svg", scope)
|
||||
result = if (svgObject is NativeObject) {
|
||||
NativeJSON.stringify(Context.getCurrentContext(), scope, svgObject, null, null).toString()
|
||||
} else {
|
||||
Context.toString(svgObject)
|
||||
val r = Runnable {
|
||||
Log.d("runJS", "start")
|
||||
val rhino = Context.enter()
|
||||
rhino.initSafeStandardObjects()
|
||||
rhino.optimizationLevel = -1
|
||||
val scope: Scriptable = rhino.initSafeStandardObjects()
|
||||
scope.put("window", scope, scope)
|
||||
try {
|
||||
Log.d("runJS", "Executing JavaScript: $hideMyHtmlContent")
|
||||
rhino.evaluateString(
|
||||
scope,
|
||||
hideMyHtmlContent,
|
||||
"JavaScript",
|
||||
1,
|
||||
null
|
||||
)
|
||||
val svgObject = scope.get("svg", scope)
|
||||
result = if (svgObject is NativeObject) {
|
||||
NativeJSON.stringify(Context.getCurrentContext(), scope, svgObject, null, null)
|
||||
.toString()
|
||||
} else {
|
||||
Context.toString(svgObject)
|
||||
}
|
||||
Log.d("runJS", "Result: $result")
|
||||
} catch (e: Exception) {
|
||||
Log.e("runJS", "Error executing JavaScript: ${e.message}")
|
||||
} finally {
|
||||
Context.exit()
|
||||
}
|
||||
Log.d("runJS", "Result: $result")
|
||||
} catch (e: Exception) {
|
||||
Log.e("runJS", "Error executing JavaScript: ${e.message}")
|
||||
} finally {
|
||||
Context.exit()
|
||||
}
|
||||
val t = Thread(ThreadGroup("A"), r, "thread_rhino", 2000000)// StackSize 2Mb: Run in a thread because rhino requires more stack size for large scripts.
|
||||
t.start();
|
||||
t.join()
|
||||
t.interrupt()
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -272,6 +272,8 @@ import com.lagradost.cloudstream3.extractors.Vidxstream
|
||||
import com.lagradost.cloudstream3.extractors.Boltx
|
||||
import com.lagradost.cloudstream3.extractors.Vectorx
|
||||
import com.lagradost.cloudstream3.extractors.Boosterx
|
||||
import com.lagradost.cloudstream3.extractors.Vidguardto1
|
||||
import com.lagradost.cloudstream3.extractors.Vidguardto2
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||
import kotlinx.coroutines.delay
|
||||
@ -951,6 +953,8 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
||||
Vtbe(),
|
||||
EPlayExtractor(),
|
||||
Vidguardto(),
|
||||
Vidguardto1(),
|
||||
Vidguardto2(),
|
||||
Simpulumlamerop(),
|
||||
Urochsunloath(),
|
||||
Yipsu(),
|
||||
|
Reference in New Issue
Block a user