mirror of
https://github.com/recloudstream/cloudstream.git
synced 2025-05-17 11:15:54 +08:00
Minor Fix for VidStack (#1666)
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.lagradost.api.Log
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||
import java.net.URI
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.spec.IvParameterSpec
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
@ -18,7 +20,8 @@ open class VidStack : ExtractorApi() {
|
||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||
val headers= mapOf("User-Agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0")
|
||||
val hash=url.substringAfterLast("#")
|
||||
val encoded= app.get("$mainUrl/api/v1/video?id=$hash",headers=headers).text.trim()
|
||||
val baseurl=getBaseUrl(url)
|
||||
val encoded= app.get("$baseurl/api/v1/video?id=$hash",headers=headers).text.trim()
|
||||
val decryptedText = AesHelper.decryptAES(encoded, "kiemtienmua911ca", "0123456789abcdef")
|
||||
val m3u8=Regex("\"source\":\"(.*?)\"").find(decryptedText)?.groupValues?.get(1)?.replace("\\/","/") ?:""
|
||||
return listOf(
|
||||
@ -33,6 +36,14 @@ open class VidStack : ExtractorApi() {
|
||||
}
|
||||
)
|
||||
}
|
||||
private fun getBaseUrl(url: String): String {
|
||||
return try {
|
||||
URI(url).let { "${it.scheme}://${it.host}" }
|
||||
} catch (e: Exception) {
|
||||
Log.e("GDMirrorbot", "getBaseUrl fallback: ${e.message}")
|
||||
mainUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object AesHelper {
|
||||
|
Reference in New Issue
Block a user