forked from recloudstream/cloudstream
Added CineGrabber Extractor
This commit is contained in:
parent
cf08c958eb
commit
f49d9de09b
2 changed files with 65 additions and 17 deletions
|
@ -1,9 +1,16 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
|
|
||||||
|
class CineGrabber : GuardareStream() {
|
||||||
|
override var name = "CineGrabber"
|
||||||
|
override var mainUrl = "https://cinegrabber.com"
|
||||||
|
}
|
||||||
|
|
||||||
open class GuardareStream : ExtractorApi() {
|
open class GuardareStream : ExtractorApi() {
|
||||||
override var name = "Guardare"
|
override var name = "Guardare"
|
||||||
override var mainUrl = "https://guardare.stream"
|
override var mainUrl = "https://guardare.stream"
|
||||||
|
@ -11,6 +18,7 @@ open class GuardareStream : ExtractorApi() {
|
||||||
|
|
||||||
data class GuardareJsonData(
|
data class GuardareJsonData(
|
||||||
@JsonProperty("data") val data: List<GuardareData>,
|
@JsonProperty("data") val data: List<GuardareData>,
|
||||||
|
@JsonProperty("captions") val captions: List<GuardareCaptions?>?,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class GuardareData(
|
data class GuardareData(
|
||||||
|
@ -19,10 +27,31 @@ open class GuardareStream : ExtractorApi() {
|
||||||
@JsonProperty("type") val type: String
|
@JsonProperty("type") val type: String
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
|
||||||
val response = app.post(url.replace("/v/","/api/source/"), data = mapOf("d" to mainUrl)).text
|
// https://cinegrabber.com/asset/userdata/224879/caption/gqdmzh-71ez76z8/876438.srt
|
||||||
val jsonvideodata = AppUtils.parseJson<GuardareJsonData>(response)
|
data class GuardareCaptions(
|
||||||
return jsonvideodata.data.map {
|
@JsonProperty("id") val id: String,
|
||||||
|
@JsonProperty("hash") val hash: String,
|
||||||
|
@JsonProperty("language") val language: String?,
|
||||||
|
@JsonProperty("extension") val extension: String
|
||||||
|
) {
|
||||||
|
fun getUrl(mainUrl: String, userId: String): String {
|
||||||
|
return "$mainUrl/asset/userdata/$userId/caption/$hash/$id.$extension"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val response =
|
||||||
|
app.post(url.replace("/v/", "/api/source/"), data = mapOf("d" to mainUrl)).text
|
||||||
|
|
||||||
|
val jsonVideoData = AppUtils.parseJson<GuardareJsonData>(response)
|
||||||
|
jsonVideoData.data.forEach {
|
||||||
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
it.file + ".${it.type}",
|
it.file + ".${it.type}",
|
||||||
this.name,
|
this.name,
|
||||||
|
@ -31,6 +60,24 @@ open class GuardareStream : ExtractorApi() {
|
||||||
it.label.filter { it.isDigit() }.toInt(),
|
it.label.filter { it.isDigit() }.toInt(),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!jsonVideoData.captions.isNullOrEmpty()){
|
||||||
|
val iframe = app.get(url)
|
||||||
|
// var USER_ID = '224879';
|
||||||
|
val userIdRegex = Regex("""USER_ID.*?(\d+)""")
|
||||||
|
val userId = userIdRegex.find(iframe.text)?.groupValues?.getOrNull(1) ?: return
|
||||||
|
jsonVideoData.captions.forEach {
|
||||||
|
if (it == null) return@forEach
|
||||||
|
val subUrl = it.getUrl(mainUrl, userId)
|
||||||
|
subtitleCallback.invoke(
|
||||||
|
SubtitleFile(
|
||||||
|
it.language ?: "",
|
||||||
|
subUrl
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -283,6 +283,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
||||||
Userload(),
|
Userload(),
|
||||||
Supervideo(),
|
Supervideo(),
|
||||||
GuardareStream(),
|
GuardareStream(),
|
||||||
|
CineGrabber(),
|
||||||
|
|
||||||
// StreamSB.kt works
|
// StreamSB.kt works
|
||||||
// SBPlay(),
|
// SBPlay(),
|
||||||
|
|
Loading…
Reference in a new issue