mirror of
https://github.com/recloudstream/cloudstream-extensions.git
synced 2024-08-15 03:03:54 +00:00
Sflix fix
This commit is contained in:
parent
95c9aba1c2
commit
0dedfa35ea
2 changed files with 13 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -304,6 +304,7 @@ open class SflixProvider : MainAPI() {
|
|||
|
||||
data class SourceObjectEncrypted(
|
||||
@JsonProperty("sources") val sources: String?,
|
||||
@JsonProperty("encrypted") val encrypted: Boolean?,
|
||||
@JsonProperty("sources_1") val sources1: String?,
|
||||
@JsonProperty("sources_2") val sources2: String?,
|
||||
@JsonProperty("sourcesBackup") val sourcesBackup: String?,
|
||||
|
@ -779,16 +780,19 @@ open class SflixProvider : MainAPI() {
|
|||
)
|
||||
)
|
||||
|
||||
println("Sflix response: $response")
|
||||
val sourceObject = if (response.text.contains("encrypted") && decryptKey != null) {
|
||||
val encryptedMap = response.parsedSafe<SourceObjectEncrypted>()
|
||||
val sources =
|
||||
encryptedMap?.sources ?: throw RuntimeException("NO SOURCES $encryptedMap")
|
||||
|
||||
val decrypted = decryptMapped<List<Sources>>(sources, decryptKey)
|
||||
SourceObject(
|
||||
sources = decrypted,
|
||||
tracks = encryptedMap.tracks
|
||||
)
|
||||
val sources = encryptedMap?.sources
|
||||
if (sources == null || encryptedMap.encrypted == false) {
|
||||
response.parsedSafe()
|
||||
} else {
|
||||
val decrypted = decryptMapped<List<Sources>>(sources, decryptKey)
|
||||
SourceObject(
|
||||
sources = decrypted,
|
||||
tracks = encryptedMap.tracks
|
||||
)
|
||||
}
|
||||
} else {
|
||||
response.parsedSafe()
|
||||
} ?: return@suspendSafeApiCall
|
||||
|
|
Loading…
Reference in a new issue