Update VidSrcExtractor.kt

This commit is contained in:
almightyhak 2024-08-06 01:55:17 +07:00
parent 304c0387b6
commit 173699bd63

View file

@ -56,7 +56,8 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
} }
val vidId = embedLink.substringAfterLast("/").substringBefore("?") val vidId = embedLink.substringAfterLast("/").substringBefore("?")
val apiSlug = encodeID(vidId, ENCRYPTION_KEY1) val apiSlug = encodeID(vidId, ENCRYPTION_KEY1)
val h = encodeID(vidId, ENCRYPTION_KEY2) val h1 = encodeID(vidId, ENCRYPTION_KEY2)
val h2 = encodeID(vidId, ENCRYPTION_KEY3)
return buildString { return buildString {
append("https://") append("https://")
@ -99,9 +100,13 @@ class VidsrcExtractor(private val client: OkHttpClient, private val headers: Hea
} }
} }
private fun vrfDecrypt(input: String): String { private fun vrfDecrypt(input: String, useKey2: Boolean): String {
var vrf = Base64.decode(input.toByteArray(), Base64.URL_SAFE) var vrf = Base64.decode(input.toByteArray(), Base64.URL_SAFE)
val rc4Key = SecretKeySpec(DECRYPTION_KEY.toByteArray(), "RC4") val rc4Key = if (useKey2) {
SecretKeySpec(DECRYPTION_KEY2.toByteArray(), "RC4")
} else {
SecretKeySpec(DECRYPTION_KEY.toByteArray(), "RC4")
}
val cipher = Cipher.getInstance("RC4") val cipher = Cipher.getInstance("RC4")
cipher.init(Cipher.DECRYPT_MODE, rc4Key, cipher.parameters) cipher.init(Cipher.DECRYPT_MODE, rc4Key, cipher.parameters)
vrf = cipher.doFinal(vrf) vrf = cipher.doFinal(vrf)