mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Added new Extractors (#461)
This commit is contained in:
parent
0f00b1baf0
commit
8c9d52bc0e
10 changed files with 554 additions and 1 deletions
|
@ -0,0 +1,135 @@
|
||||||
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
import javax.crypto.Cipher
|
||||||
|
import javax.crypto.SecretKeyFactory
|
||||||
|
import javax.crypto.spec.IvParameterSpec
|
||||||
|
import javax.crypto.spec.PBEKeySpec
|
||||||
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
|
||||||
|
class Bestx : Chillx() {
|
||||||
|
override val name = "Bestx"
|
||||||
|
override val mainUrl = "https://bestx.stream"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Watchx : Chillx() {
|
||||||
|
override val name = "Watchx"
|
||||||
|
override val mainUrl = "https://watchx.top"
|
||||||
|
}
|
||||||
|
open class Chillx : ExtractorApi() {
|
||||||
|
override val name = "Chillx"
|
||||||
|
override val mainUrl = "https://chillx.top"
|
||||||
|
override val requiresReferer = true
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val KEY = "4VqE3#N7zt&HEP^a"
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val master = Regex("MasterJS\\s*=\\s*'([^']+)").find(
|
||||||
|
app.get(
|
||||||
|
url,
|
||||||
|
referer = referer
|
||||||
|
).text
|
||||||
|
)?.groupValues?.get(1)
|
||||||
|
val encData = AppUtils.tryParseJson<AESData>(base64Decode(master ?: return))
|
||||||
|
val decrypt = cryptoAESHandler(encData ?: return, KEY, false)
|
||||||
|
|
||||||
|
val source = Regex("""sources:\s*\[\{"file":"([^"]+)""").find(decrypt)?.groupValues?.get(1)
|
||||||
|
val tracks = Regex("""tracks:\s*\[(.+)]""").find(decrypt)?.groupValues?.get(1)
|
||||||
|
|
||||||
|
// required
|
||||||
|
val 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,
|
||||||
|
)
|
||||||
|
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
name,
|
||||||
|
name,
|
||||||
|
source ?: return,
|
||||||
|
"$mainUrl/",
|
||||||
|
Qualities.P1080.value,
|
||||||
|
headers = headers,
|
||||||
|
isM3u8 = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
AppUtils.tryParseJson<List<Tracks>>("[$tracks]")
|
||||||
|
?.filter { it.kind == "captions" }?.map { track ->
|
||||||
|
subtitleCallback.invoke(
|
||||||
|
SubtitleFile(
|
||||||
|
track.label ?: "",
|
||||||
|
track.file ?: return@map null
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun cryptoAESHandler(
|
||||||
|
data: AESData,
|
||||||
|
pass: String,
|
||||||
|
encrypt: Boolean = true
|
||||||
|
): String {
|
||||||
|
val factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512")
|
||||||
|
val spec = PBEKeySpec(
|
||||||
|
pass.toCharArray(),
|
||||||
|
data.salt?.hexToByteArray(),
|
||||||
|
data.iterations?.toIntOrNull() ?: 1,
|
||||||
|
256
|
||||||
|
)
|
||||||
|
val key = factory.generateSecret(spec)
|
||||||
|
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||||
|
return if (!encrypt) {
|
||||||
|
cipher.init(
|
||||||
|
Cipher.DECRYPT_MODE,
|
||||||
|
SecretKeySpec(key.encoded, "AES"),
|
||||||
|
IvParameterSpec(data.iv?.hexToByteArray())
|
||||||
|
)
|
||||||
|
String(cipher.doFinal(base64DecodeArray(data.ciphertext.toString())))
|
||||||
|
} else {
|
||||||
|
cipher.init(
|
||||||
|
Cipher.ENCRYPT_MODE,
|
||||||
|
SecretKeySpec(key.encoded, "AES"),
|
||||||
|
IvParameterSpec(data.iv?.hexToByteArray())
|
||||||
|
)
|
||||||
|
base64Encode(cipher.doFinal(data.ciphertext?.toByteArray()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun String.hexToByteArray(): ByteArray {
|
||||||
|
check(length % 2 == 0) { "Must have an even length" }
|
||||||
|
return chunked(2)
|
||||||
|
.map { it.toInt(16).toByte() }
|
||||||
|
|
||||||
|
.toByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
data class AESData(
|
||||||
|
@JsonProperty("ciphertext") val ciphertext: String? = null,
|
||||||
|
@JsonProperty("iv") val iv: String? = null,
|
||||||
|
@JsonProperty("salt") val salt: String? = null,
|
||||||
|
@JsonProperty("iterations") val iterations: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Tracks(
|
||||||
|
@JsonProperty("file") val file: String? = null,
|
||||||
|
@JsonProperty("label") val label: String? = null,
|
||||||
|
@JsonProperty("kind") val kind: String? = null,
|
||||||
|
)
|
||||||
|
}
|
|
@ -5,6 +5,25 @@ import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
|
import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
|
||||||
|
|
||||||
|
class Moviesm4u : Filesim() {
|
||||||
|
override val mainUrl = "https://moviesm4u.com"
|
||||||
|
override val name = "Moviesm4u"
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileMoonIn : Filesim() {
|
||||||
|
override val mainUrl = "https://filemoon.in"
|
||||||
|
override val name = "FileMoon"
|
||||||
|
}
|
||||||
|
|
||||||
|
class StreamhideCom : Filesim() {
|
||||||
|
override var name: String = "Streamhide"
|
||||||
|
override var mainUrl: String = "https://streamhide.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Movhide : Filesim() {
|
||||||
|
override var name: String = "Movhide"
|
||||||
|
override var mainUrl: String = "https://movhide.pro"
|
||||||
|
}
|
||||||
|
|
||||||
class Ztreamhub : Filesim() {
|
class Ztreamhub : Filesim() {
|
||||||
override val mainUrl: String = "https://ztreamhub.com" //Here 'cause works
|
override val mainUrl: String = "https://ztreamhub.com" //Here 'cause works
|
||||||
|
@ -35,7 +54,7 @@ open class Filesim : ExtractorApi() {
|
||||||
response.select("script[type=text/javascript]").map { script ->
|
response.select("script[type=text/javascript]").map { script ->
|
||||||
if (script.data().contains(Regex("eval\\(function\\(p,a,c,k,e,[rd]"))) {
|
if (script.data().contains(Regex("eval\\(function\\(p,a,c,k,e,[rd]"))) {
|
||||||
val unpackedscript = getAndUnpack(script.data())
|
val unpackedscript = getAndUnpack(script.data())
|
||||||
val m3u8Regex = Regex("file.\\\"(.*?m3u8.*?)\\\"")
|
val m3u8Regex = Regex("file.\"(.*?m3u8.*?)\"")
|
||||||
val m3u8 = m3u8Regex.find(unpackedscript)?.destructured?.component1() ?: ""
|
val m3u8 = m3u8Regex.find(unpackedscript)?.destructured?.component1() ?: ""
|
||||||
if (m3u8.isNotEmpty()) {
|
if (m3u8.isNotEmpty()) {
|
||||||
generateM3u8(
|
generateM3u8(
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
|
import com.lagradost.cloudstream3.app
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
|
||||||
|
open class Gofile : ExtractorApi() {
|
||||||
|
override val name = "Gofile"
|
||||||
|
override val mainUrl = "https://gofile.io"
|
||||||
|
override val requiresReferer = false
|
||||||
|
private val mainApi = "https://api.gofile.io"
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val id = Regex("/(?:\\?c=|d/)([\\da-zA-Z]+)").find(url)?.groupValues?.get(1)
|
||||||
|
val token = app.get("$mainApi/createAccount").parsedSafe<Account>()?.data?.get("token")
|
||||||
|
app.get("$mainApi/getContent?contentId=$id&token=$token&websiteToken=12345")
|
||||||
|
.parsedSafe<Source>()?.data?.contents?.forEach {
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
this.name,
|
||||||
|
this.name,
|
||||||
|
it.value["link"] ?: return,
|
||||||
|
"",
|
||||||
|
getQuality(it.value["name"]),
|
||||||
|
headers = mapOf(
|
||||||
|
"Cookie" to "accountToken=$token"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getQuality(str: String?): Int {
|
||||||
|
return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||||
|
?: Qualities.Unknown.value
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Account(
|
||||||
|
@JsonProperty("data") val data: HashMap<String, String>? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Data(
|
||||||
|
@JsonProperty("contents") val contents: HashMap<String, HashMap<String, String>>? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Source(
|
||||||
|
@JsonProperty("data") val data: Data? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
|
import com.lagradost.cloudstream3.app
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
import com.lagradost.cloudstream3.utils.httpsify
|
||||||
|
|
||||||
|
open class Krakenfiles : ExtractorApi() {
|
||||||
|
override val name = "Krakenfiles"
|
||||||
|
override val mainUrl = "https://krakenfiles.com"
|
||||||
|
override val requiresReferer = false
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val id = Regex("/(?:view|embed-video)/([\\da-zA-Z]+)").find(url)?.groupValues?.get(1)
|
||||||
|
val doc = app.get("$mainUrl/embed-video/$id").document
|
||||||
|
val link = doc.selectFirst("source")?.attr("src")
|
||||||
|
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
this.name,
|
||||||
|
this.name,
|
||||||
|
httpsify(link ?: return),
|
||||||
|
"",
|
||||||
|
Qualities.Unknown.value
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,6 +7,21 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
|
|
||||||
|
class Sbasian : StreamSB() {
|
||||||
|
override var mainUrl = "https://sbasian.pro"
|
||||||
|
override var name = "Sbasian"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Sbnet : StreamSB() {
|
||||||
|
override var name = "Sbnet"
|
||||||
|
override var mainUrl = "https://sbnet.one"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Keephealth : StreamSB() {
|
||||||
|
override var name = "Keephealth"
|
||||||
|
override var mainUrl = "https://keephealth.info"
|
||||||
|
}
|
||||||
|
|
||||||
class Sbspeed : StreamSB() {
|
class Sbspeed : StreamSB() {
|
||||||
override var name = "Sbspeed"
|
override var name = "Sbspeed"
|
||||||
override var mainUrl = "https://sbspeed.com"
|
override var mainUrl = "https://sbspeed.com"
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
|
import com.lagradost.cloudstream3.app
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
|
||||||
|
open class Uservideo : ExtractorApi() {
|
||||||
|
override val name: String = "Uservideo"
|
||||||
|
override val mainUrl: String = "https://uservideo.xyz"
|
||||||
|
override val requiresReferer = false
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val script = app.get(url).document.selectFirst("script:containsData(hosts =)")?.data()
|
||||||
|
val host = script?.substringAfter("hosts = [\"")?.substringBefore("\"];")
|
||||||
|
val servers = script?.substringAfter("servers = \"")?.substringBefore("\";")
|
||||||
|
|
||||||
|
val sources = app.get("$host/s/$servers").text.substringAfter("\"sources\":[").substringBefore("],").let {
|
||||||
|
AppUtils.tryParseJson<List<Sources>>("[$it]")
|
||||||
|
}
|
||||||
|
val quality = Regex("(\\d{3,4})[Pp]").find(url)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||||
|
|
||||||
|
sources?.map { source ->
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
name,
|
||||||
|
name,
|
||||||
|
source.src ?: return@map null,
|
||||||
|
url,
|
||||||
|
quality ?: Qualities.Unknown.value,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Sources(
|
||||||
|
@JsonProperty("src") val src: String? = null,
|
||||||
|
@JsonProperty("type") val type: String? = null,
|
||||||
|
@JsonProperty("label") val label: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
|
import com.lagradost.cloudstream3.app
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
|
|
||||||
|
open class Vicloud : ExtractorApi() {
|
||||||
|
override val name: String = "Vicloud"
|
||||||
|
override val mainUrl: String = "https://vicloud.sbs"
|
||||||
|
override val requiresReferer = false
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val id = Regex("\"apiQuery\":\"(.*?)\"").find(app.get(url).text)?.groupValues?.getOrNull(1)
|
||||||
|
app.get(
|
||||||
|
"$mainUrl/api/?$id=&_=${System.currentTimeMillis()}",
|
||||||
|
headers = mapOf(
|
||||||
|
"X-Requested-With" to "XMLHttpRequest"
|
||||||
|
),
|
||||||
|
referer = url
|
||||||
|
).parsedSafe<Responses>()?.sources?.map { source ->
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
name,
|
||||||
|
name,
|
||||||
|
source.file ?: return@map null,
|
||||||
|
url,
|
||||||
|
getQualityFromName(source.label),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private data class Sources(
|
||||||
|
@JsonProperty("file") val file: String? = null,
|
||||||
|
@JsonProperty("label") val label: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
private data class Responses(
|
||||||
|
@JsonProperty("sources") val sources: List<Sources>? = arrayListOf(),
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,16 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
|
|
||||||
|
class StreamM4u : XStreamCdn() {
|
||||||
|
override val name: String = "StreamM4u"
|
||||||
|
override val mainUrl: String = "https://streamm4u.club"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Fembed9hd : XStreamCdn() {
|
||||||
|
override var mainUrl = "https://fembed9hd.com"
|
||||||
|
override var name = "Fembed9hd"
|
||||||
|
}
|
||||||
|
|
||||||
class Cdnplayer: XStreamCdn() {
|
class Cdnplayer: XStreamCdn() {
|
||||||
override val name: String = "Cdnplayer"
|
override val name: String = "Cdnplayer"
|
||||||
override val mainUrl: String = "https://cdnplayer.online"
|
override val mainUrl: String = "https://cdnplayer.online"
|
||||||
|
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.lagradost.cloudstream3.extractors.helper
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.app
|
||||||
|
import com.lagradost.cloudstream3.base64Decode
|
||||||
|
import com.lagradost.cloudstream3.base64DecodeArray
|
||||||
|
import com.lagradost.cloudstream3.base64Encode
|
||||||
|
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||||
|
import com.lagradost.cloudstream3.mvvm.safeApiCall
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils
|
||||||
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
import java.net.URI
|
||||||
|
import javax.crypto.Cipher
|
||||||
|
import javax.crypto.spec.IvParameterSpec
|
||||||
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
|
||||||
|
object GogoHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id base64Decode(show_id) + IV
|
||||||
|
* @return the encryption key
|
||||||
|
* */
|
||||||
|
private fun getKey(id: String): String? {
|
||||||
|
return normalSafeApiCall {
|
||||||
|
id.map {
|
||||||
|
it.code.toString(16)
|
||||||
|
}.joinToString("").substring(0, 32)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/saikou-app/saikou/blob/45d0a99b8a72665a29a1eadfb38c506b842a29d7/app/src/main/java/ani/saikou/parsers/anime/extractors/GogoCDN.kt#L97
|
||||||
|
// No Licence on the function
|
||||||
|
private fun cryptoHandler(
|
||||||
|
string: String,
|
||||||
|
iv: String,
|
||||||
|
secretKeyString: String,
|
||||||
|
encrypt: Boolean = true
|
||||||
|
): String {
|
||||||
|
//println("IV: $iv, Key: $secretKeyString, encrypt: $encrypt, Message: $string")
|
||||||
|
val ivParameterSpec = IvParameterSpec(iv.toByteArray())
|
||||||
|
val secretKey = SecretKeySpec(secretKeyString.toByteArray(), "AES")
|
||||||
|
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||||
|
return if (!encrypt) {
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParameterSpec)
|
||||||
|
String(cipher.doFinal(base64DecodeArray(string)))
|
||||||
|
} else {
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivParameterSpec)
|
||||||
|
base64Encode(cipher.doFinal(string.toByteArray()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param iframeUrl something like https://gogoplay4.com/streaming.php?id=XXXXXX
|
||||||
|
* @param mainApiName used for ExtractorLink names and source
|
||||||
|
* @param iv secret iv from site, required non-null if isUsingAdaptiveKeys is off
|
||||||
|
* @param secretKey secret key for decryption from site, required non-null if isUsingAdaptiveKeys is off
|
||||||
|
* @param secretDecryptKey secret key to decrypt the response json, required non-null if isUsingAdaptiveKeys is off
|
||||||
|
* @param isUsingAdaptiveKeys generates keys from IV and ID, see getKey()
|
||||||
|
* @param isUsingAdaptiveData generate encrypt-ajax data based on $("script[data-name='episode']")[0].dataset.value
|
||||||
|
* */
|
||||||
|
suspend fun extractVidstream(
|
||||||
|
iframeUrl: String,
|
||||||
|
mainApiName: String,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
iv: String?,
|
||||||
|
secretKey: String?,
|
||||||
|
secretDecryptKey: String?,
|
||||||
|
// This could be removed, but i prefer it verbose
|
||||||
|
isUsingAdaptiveKeys: Boolean,
|
||||||
|
isUsingAdaptiveData: Boolean,
|
||||||
|
// If you don't want to re-fetch the document
|
||||||
|
iframeDocument: Document? = null
|
||||||
|
) = safeApiCall {
|
||||||
|
if ((iv == null || secretKey == null || secretDecryptKey == null) && !isUsingAdaptiveKeys)
|
||||||
|
return@safeApiCall
|
||||||
|
|
||||||
|
val id = Regex("id=([^&]+)").find(iframeUrl)!!.value.removePrefix("id=")
|
||||||
|
|
||||||
|
var document: Document? = iframeDocument
|
||||||
|
val foundIv =
|
||||||
|
iv ?: (document ?: app.get(iframeUrl).document.also { document = it })
|
||||||
|
.select("""div.wrapper[class*=container]""")
|
||||||
|
.attr("class").split("-").lastOrNull() ?: return@safeApiCall
|
||||||
|
val foundKey = secretKey ?: getKey(base64Decode(id) + foundIv) ?: return@safeApiCall
|
||||||
|
val foundDecryptKey = secretDecryptKey ?: foundKey
|
||||||
|
|
||||||
|
val uri = URI(iframeUrl)
|
||||||
|
val mainUrl = "https://" + uri.host
|
||||||
|
|
||||||
|
val encryptedId = cryptoHandler(id, foundIv, foundKey)
|
||||||
|
val encryptRequestData = if (isUsingAdaptiveData) {
|
||||||
|
// Only fetch the document if necessary
|
||||||
|
val realDocument = document ?: app.get(iframeUrl).document
|
||||||
|
val dataEncrypted =
|
||||||
|
realDocument.select("script[data-name='episode']").attr("data-value")
|
||||||
|
val headers = cryptoHandler(dataEncrypted, foundIv, foundKey, false)
|
||||||
|
"id=$encryptedId&alias=$id&" + headers.substringAfter("&")
|
||||||
|
} else {
|
||||||
|
"id=$encryptedId&alias=$id"
|
||||||
|
}
|
||||||
|
|
||||||
|
val jsonResponse =
|
||||||
|
app.get(
|
||||||
|
"$mainUrl/encrypt-ajax.php?$encryptRequestData",
|
||||||
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
||||||
|
)
|
||||||
|
val dataencrypted =
|
||||||
|
jsonResponse.text.substringAfter("{\"data\":\"").substringBefore("\"}")
|
||||||
|
val datadecrypted = cryptoHandler(dataencrypted, foundIv, foundDecryptKey, false)
|
||||||
|
val sources = AppUtils.parseJson<GogoSources>(datadecrypted)
|
||||||
|
|
||||||
|
suspend fun invokeGogoSource(
|
||||||
|
source: GogoSource,
|
||||||
|
sourceCallback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
if (source.file.contains(".m3u8")) {
|
||||||
|
M3u8Helper.generateM3u8(
|
||||||
|
mainApiName,
|
||||||
|
source.file,
|
||||||
|
mainUrl,
|
||||||
|
headers = mapOf("Origin" to "https://plyr.link")
|
||||||
|
).forEach(sourceCallback)
|
||||||
|
} else {
|
||||||
|
sourceCallback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
mainApiName,
|
||||||
|
mainApiName,
|
||||||
|
source.file,
|
||||||
|
mainUrl,
|
||||||
|
getQualityFromName(source.label),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sources.source?.forEach {
|
||||||
|
invokeGogoSource(it, callback)
|
||||||
|
}
|
||||||
|
sources.sourceBk?.forEach {
|
||||||
|
invokeGogoSource(it, callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GogoSources(
|
||||||
|
@JsonProperty("source") val source: List<GogoSource>?,
|
||||||
|
@JsonProperty("sourceBk") val sourceBk: List<GogoSource>?,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GogoSource(
|
||||||
|
@JsonProperty("file") val file: String,
|
||||||
|
@JsonProperty("label") val label: String?,
|
||||||
|
@JsonProperty("type") val type: String?,
|
||||||
|
@JsonProperty("default") val default: String? = null
|
||||||
|
)
|
||||||
|
}
|
|
@ -342,6 +342,24 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
||||||
DesuOdvip(),
|
DesuOdvip(),
|
||||||
DesuDrive(),
|
DesuDrive(),
|
||||||
|
|
||||||
|
Chillx(),
|
||||||
|
Watchx(),
|
||||||
|
Bestx(),
|
||||||
|
Keephealth(),
|
||||||
|
Sbnet(),
|
||||||
|
Sbasian(),
|
||||||
|
Sblongvu(),
|
||||||
|
Fembed9hd(),
|
||||||
|
StreamM4u(),
|
||||||
|
Krakenfiles(),
|
||||||
|
Gofile(),
|
||||||
|
Vicloud(),
|
||||||
|
Uservideo(),
|
||||||
|
|
||||||
|
Movhide(),
|
||||||
|
StreamhideCom(),
|
||||||
|
FileMoonIn(),
|
||||||
|
Moviesm4u(),
|
||||||
Filesim(),
|
Filesim(),
|
||||||
FileMoon(),
|
FileMoon(),
|
||||||
FileMoonSx(),
|
FileMoonSx(),
|
||||||
|
|
Loading…
Reference in a new issue