mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
added sub into Gdriveplayer
This commit is contained in:
parent
c027501a76
commit
7a169dae7e
2 changed files with 42 additions and 14 deletions
|
@ -3,6 +3,7 @@ package com.lagradost.cloudstream3.extractors
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import org.jsoup.nodes.Element
|
||||
import java.security.DigestException
|
||||
import java.security.MessageDigest
|
||||
|
@ -10,6 +11,10 @@ import javax.crypto.Cipher
|
|||
import javax.crypto.spec.IvParameterSpec
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
|
||||
class DatabaseGdrive2 : Gdriveplayer() {
|
||||
override var mainUrl = "https://databasegdriveplayer.co"
|
||||
}
|
||||
|
||||
class DatabaseGdrive : Gdriveplayer() {
|
||||
override var mainUrl = "https://series.databasegdriveplayer.co"
|
||||
}
|
||||
|
@ -136,6 +141,10 @@ open class Gdriveplayer : ExtractorApi() {
|
|||
return find(str)?.groupValues?.getOrNull(1)
|
||||
}
|
||||
|
||||
private fun String.addMarks(str: String): String {
|
||||
return this.replace(Regex("\"?$str\"?"), "\"$str\"")
|
||||
}
|
||||
|
||||
override suspend fun getUrl(
|
||||
url: String,
|
||||
referer: String?,
|
||||
|
@ -145,18 +154,19 @@ open class Gdriveplayer : ExtractorApi() {
|
|||
val document = app.get(url).document
|
||||
|
||||
val eval = unpackJs(document)?.replace("\\", "") ?: return
|
||||
val data = AppUtils.tryParseJson<AesData>(Regex("data='(\\S+?)'").first(eval)) ?: return
|
||||
val data = tryParseJson<AesData>(Regex("data='(\\S+?)'").first(eval)) ?: return
|
||||
val password = Regex("null,['|\"](\\w+)['|\"]").first(eval)
|
||||
?.split(Regex("\\D+"))
|
||||
?.joinToString("") {
|
||||
Char(it.toInt()).toString()
|
||||
}.let { Regex("var pass = \"(\\S+?)\"").first(it ?: return)?.toByteArray() }
|
||||
?: throw ErrorLoadingException("can't find password")
|
||||
val decryptedData =
|
||||
cryptoAESHandler(data, password, false)?.let { getAndUnpack(it) }?.replace("\\", "")
|
||||
?.substringAfter("sources:[")?.substringBefore("],")
|
||||
val decryptedData = cryptoAESHandler(data, password, false)?.let { getAndUnpack(it) }?.replace("\\", "")
|
||||
|
||||
Regex("\"file\":\"(\\S+?)\".*?res=(\\d+)").findAll(decryptedData ?: return).map {
|
||||
val sourceData = decryptedData?.substringAfter("sources:[")?.substringBefore("],")
|
||||
val subData = decryptedData?.substringAfter("tracks:[")?.substringBefore("],")
|
||||
|
||||
Regex("\"file\":\"(\\S+?)\".*?res=(\\d+)").findAll(sourceData ?: return).map {
|
||||
it.groupValues[1] to it.groupValues[2]
|
||||
}.toList().distinctBy { it.second }.map { (link, quality) ->
|
||||
callback.invoke(
|
||||
|
@ -171,6 +181,17 @@ open class Gdriveplayer : ExtractorApi() {
|
|||
)
|
||||
}
|
||||
|
||||
subData?.addMarks("file")?.addMarks("kind")?.addMarks("label").let { dataSub ->
|
||||
tryParseJson<List<Tracks>>("[$dataSub]")?.map { sub ->
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
sub.label,
|
||||
httpsify(sub.file)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data class AesData(
|
||||
|
@ -179,4 +200,10 @@ open class Gdriveplayer : ExtractorApi() {
|
|||
@JsonProperty("s") val s: String
|
||||
)
|
||||
|
||||
data class Tracks(
|
||||
@JsonProperty("file") val file: String,
|
||||
@JsonProperty("kind") val kind: String,
|
||||
@JsonProperty("label") val label: String
|
||||
)
|
||||
|
||||
}
|
|
@ -341,6 +341,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
|||
Gdriveplayerco(),
|
||||
Gdriveplayer(),
|
||||
DatabaseGdrive(),
|
||||
DatabaseGdrive2(),
|
||||
|
||||
YoutubeExtractor(),
|
||||
YoutubeShortLinkExtractor(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue