mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
sora: added Blackvid
This commit is contained in:
parent
836154ac84
commit
f03308bd7e
6 changed files with 114 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
import org.jetbrains.kotlin.konan.properties.Properties
|
||||
|
||||
// use an integer for version numbers
|
||||
version = 177
|
||||
version = 178
|
||||
|
||||
android {
|
||||
defaultConfig {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.hexated
|
||||
|
||||
import com.hexated.AESGCM.decrypt
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
|
@ -2175,6 +2176,49 @@ object SoraExtractor : SoraStream() {
|
|||
|
||||
}
|
||||
|
||||
suspend fun invokeBlackvid(
|
||||
tmdbId: Int? = null,
|
||||
season: Int? = null,
|
||||
episode: Int? = null,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit,
|
||||
) {
|
||||
val key = "c3124ecca65f4e72ef5cb39033cdfed69697e94e"
|
||||
val url = if (season == null) {
|
||||
"$blackvidAPI/v3/movie/sources/$tmdbId?key=$key"
|
||||
} else {
|
||||
"$blackvidAPI/v3/tv/sources/$tmdbId/$season/$episode?key=$key"
|
||||
}
|
||||
|
||||
val data = app.get(url).body.bytes().decrypt(key)
|
||||
val json = tryParseJson<BlackvidResponses>(data)
|
||||
|
||||
json?.sources?.map { source ->
|
||||
source.sources.map s@{ s ->
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
"Blackvid",
|
||||
"Blackvid${source.label}",
|
||||
s.url ?: return@s,
|
||||
"$blackvidAPI/",
|
||||
s.quality?.toIntOrNull() ?: Qualities.Unknown.value,
|
||||
INFER_TYPE
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
json?.subtitles?.map { sub ->
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
sub.language.takeIf { it?.isNotEmpty() == true } ?: return@map,
|
||||
sub.url ?: return@map,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
suspend fun invokeWatchOnline(
|
||||
imdbId: String? = null,
|
||||
title: String? = null,
|
||||
|
|
|
@ -391,4 +391,24 @@ data class EMovieSources(
|
|||
data class EMovieTraks(
|
||||
@JsonProperty("file") val file: String? = null,
|
||||
@JsonProperty("label") val label: String? = null,
|
||||
)
|
||||
|
||||
data class BlackvidSubtitles(
|
||||
@JsonProperty("language") val language: String? = null,
|
||||
@JsonProperty("url") val url: String? = null,
|
||||
)
|
||||
|
||||
data class BlackvidSource(
|
||||
@JsonProperty("quality") var quality: String? = null,
|
||||
@JsonProperty("url") var url: String? = null,
|
||||
)
|
||||
|
||||
data class BlackvidSources(
|
||||
@JsonProperty("label") var label: String? = null,
|
||||
@JsonProperty("sources") var sources: ArrayList<BlackvidSource> = arrayListOf()
|
||||
)
|
||||
|
||||
data class BlackvidResponses(
|
||||
@JsonProperty("sources") var sources: ArrayList<BlackvidSources> = arrayListOf(),
|
||||
@JsonProperty("subtitles") var subtitles: ArrayList<BlackvidSubtitles> = arrayListOf()
|
||||
)
|
|
@ -3,6 +3,7 @@ package com.hexated
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.hexated.SoraExtractor.invoke2embed
|
||||
import com.hexated.SoraExtractor.invokeAnimes
|
||||
import com.hexated.SoraExtractor.invokeBlackvid
|
||||
import com.hexated.SoraExtractor.invokeBollyMaza
|
||||
import com.hexated.SoraExtractor.invokeCryMovies
|
||||
import com.hexated.SoraExtractor.invokeDbgo
|
||||
|
@ -130,6 +131,7 @@ open class SoraStream : TmdbProvider() {
|
|||
const val watchflxAPI = "https://watchflx.tv"
|
||||
const val gomoviesAPI = "https://gomovies-online.cam"
|
||||
const val dotmoviesAPI = "https://dotmovies.today"
|
||||
const val blackvidAPI = "https://prod.api.blackvid.space"
|
||||
|
||||
// INDEX SITE
|
||||
const val dahmerMoviesAPI = "https://edytjedhgmdhm.abfhaqrhbnf.workers.dev"
|
||||
|
@ -736,6 +738,15 @@ open class SoraStream : TmdbProvider() {
|
|||
subtitleCallback,
|
||||
callback
|
||||
)
|
||||
},
|
||||
{
|
||||
if (!res.isAnime) invokeBlackvid(
|
||||
res.id,
|
||||
res.season,
|
||||
res.episode,
|
||||
subtitleCallback,
|
||||
callback
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.hexated
|
|||
|
||||
import com.hexated.SoraExtractor.invoke2embed
|
||||
import com.hexated.SoraExtractor.invokeAnimes
|
||||
import com.hexated.SoraExtractor.invokeBlackvid
|
||||
import com.hexated.SoraExtractor.invokeDbgo
|
||||
import com.hexated.SoraExtractor.invokeDoomovies
|
||||
import com.hexated.SoraExtractor.invokeDramaday
|
||||
|
@ -64,6 +65,15 @@ class SoraStreamLite : SoraStream() {
|
|||
// callback
|
||||
// )
|
||||
// },
|
||||
{
|
||||
if (!res.isAnime) invokeBlackvid(
|
||||
res.id,
|
||||
res.season,
|
||||
res.episode,
|
||||
subtitleCallback,
|
||||
callback
|
||||
)
|
||||
},
|
||||
{
|
||||
if (!res.isAnime) invokeWatchsomuch(
|
||||
res.imdbId,
|
||||
|
|
|
@ -30,12 +30,14 @@ import okhttp3.RequestBody.Companion.toRequestBody
|
|||
import org.jsoup.nodes.Document
|
||||
import java.math.BigInteger
|
||||
import java.net.*
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.security.*
|
||||
import java.security.spec.PKCS8EncodedKeySpec
|
||||
import java.security.spec.X509EncodedKeySpec
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.spec.GCMParameterSpec
|
||||
import javax.crypto.spec.IvParameterSpec
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
import kotlin.collections.ArrayList
|
||||
|
@ -1641,4 +1643,30 @@ object CryptoJS {
|
|||
SecureRandom().nextBytes(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object AESGCM {
|
||||
fun ByteArray.decrypt(pass: String): String {
|
||||
val (key, iv) = generateKeyAndIv(pass)
|
||||
val cipher = Cipher.getInstance("AES/GCM/NoPadding")
|
||||
cipher.init(Cipher.DECRYPT_MODE, SecretKeySpec(key, "AES"), GCMParameterSpec(128, iv))
|
||||
return String(cipher.doFinal(this), StandardCharsets.UTF_8)
|
||||
}
|
||||
|
||||
private fun generateKeyAndIv(pass: String): Pair<ByteArray, ByteArray> {
|
||||
val datePart = getCurrentUTCDateString().take(16)
|
||||
val hexString = datePart + pass
|
||||
val byteArray = hexString.toByteArray(StandardCharsets.UTF_8)
|
||||
val digest = MessageDigest.getInstance("SHA-256").digest(byteArray)
|
||||
return digest.copyOfRange(0, digest.size / 2) to digest.copyOfRange(
|
||||
digest.size / 2,
|
||||
digest.size
|
||||
)
|
||||
}
|
||||
|
||||
private fun getCurrentUTCDateString(): String {
|
||||
val dateFormat = SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.getDefault())
|
||||
dateFormat.timeZone = TimeZone.getTimeZone("GMT")
|
||||
return dateFormat.format(Date())
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue