mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
added sub to streamsb & xtreamCdn
This commit is contained in:
parent
4c0f6df1a2
commit
8ed5c8354d
4 changed files with 62 additions and 19 deletions
|
@ -7,7 +7,11 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
|
|||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||
|
||||
class SpeedoStream : ExtractorApi() {
|
||||
class SpeedoStream1 : SpeedoStream() {
|
||||
override val mainUrl = "https://speedostream.nl"
|
||||
}
|
||||
|
||||
open class SpeedoStream : ExtractorApi() {
|
||||
override val name = "SpeedoStream"
|
||||
override val mainUrl = "https://speedostream.com"
|
||||
override val requiresReferer = true
|
||||
|
|
|
@ -93,15 +93,15 @@ open class StreamSB : ExtractorApi() {
|
|||
}
|
||||
|
||||
data class Subs (
|
||||
@JsonProperty("file") val file: String,
|
||||
@JsonProperty("label") val label: String,
|
||||
@JsonProperty("file") val file: String? = null,
|
||||
@JsonProperty("label") val label: String? = null,
|
||||
)
|
||||
|
||||
data class StreamData (
|
||||
@JsonProperty("file") val file: String,
|
||||
@JsonProperty("cdn_img") val cdnImg: String,
|
||||
@JsonProperty("hash") val hash: String,
|
||||
@JsonProperty("subs") val subs: List<Subs>?,
|
||||
@JsonProperty("subs") val subs: ArrayList<Subs>? = arrayListOf(),
|
||||
@JsonProperty("length") val length: String,
|
||||
@JsonProperty("id") val id: String,
|
||||
@JsonProperty("title") val title: String,
|
||||
|
@ -141,5 +141,14 @@ open class StreamSB : ExtractorApi() {
|
|||
url,
|
||||
headers = headers
|
||||
).forEach(callback)
|
||||
|
||||
mapped.streamData.subs?.map {sub ->
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
sub.label.toString(),
|
||||
sub.file ?: return@map null,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,18 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.SubtitleFile
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.utils.AppUtils
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||
|
||||
class Kotakajair: XStreamCdn() {
|
||||
override val name: String = "Kotakajair"
|
||||
override val mainUrl: String = "https://kotakajair.xyz"
|
||||
}
|
||||
|
||||
class FEnet: XStreamCdn() {
|
||||
override val name: String = "FEnet"
|
||||
override val mainUrl: String = "https://fembed.net"
|
||||
|
@ -59,44 +65,66 @@ open class XStreamCdn : ExtractorApi() {
|
|||
//val type: String // Mp4
|
||||
)
|
||||
|
||||
private data class Player(
|
||||
@JsonProperty("poster_file") val poster_file: String? = null,
|
||||
)
|
||||
|
||||
private data class ResponseJson(
|
||||
@JsonProperty("success") val success: Boolean,
|
||||
@JsonProperty("data") val data: List<ResponseData>?
|
||||
@JsonProperty("player") val player: Player? = null,
|
||||
@JsonProperty("data") val data: List<ResponseData>?,
|
||||
@JsonProperty("captions") val captions: List<Captions>?,
|
||||
)
|
||||
|
||||
private data class Captions(
|
||||
@JsonProperty("id") val id: String,
|
||||
@JsonProperty("hash") val hash: String,
|
||||
@JsonProperty("language") val language: String,
|
||||
)
|
||||
|
||||
override fun getExtractorUrl(id: String): String {
|
||||
return "$domainUrl/api/source/$id"
|
||||
}
|
||||
|
||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||
override suspend fun getUrl(
|
||||
url: String,
|
||||
referer: String?,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val headers = mapOf(
|
||||
"Referer" to url,
|
||||
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0",
|
||||
)
|
||||
val id = url.trimEnd('/').split("/").last()
|
||||
val newUrl = "https://${domainUrl}/api/source/${id}"
|
||||
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
|
||||
with(app.post(newUrl, headers = headers)) {
|
||||
if (this.code != 200) return listOf()
|
||||
val text = this.text
|
||||
if (text.isEmpty()) return listOf()
|
||||
if (text == """{"success":false,"data":"Video not found or has been removed"}""") return listOf()
|
||||
AppUtils.parseJson<ResponseJson?>(text)?.let {
|
||||
app.post(newUrl, headers = headers).let { res ->
|
||||
val sources = tryParseJson<ResponseJson?>(res.text)
|
||||
sources?.let {
|
||||
if (it.success && it.data != null) {
|
||||
it.data.forEach { data ->
|
||||
extractedLinksList.add(
|
||||
it.data.map { source ->
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
name,
|
||||
name = name,
|
||||
data.file,
|
||||
source.file,
|
||||
url,
|
||||
getQualityFromName(data.label),
|
||||
getQualityFromName(source.label),
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val userData = sources?.player?.poster_file?.split("/")?.get(2)
|
||||
sources?.captions?.map {
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
it.language,
|
||||
"$mainUrl/asset/userdata/$userData/caption/${it.hash}/${it.id}.srt"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
return extractedLinksList
|
||||
}
|
||||
}
|
|
@ -246,6 +246,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
|||
LayarKaca(),
|
||||
Rasacintaku(),
|
||||
FEnet(),
|
||||
Kotakajair(),
|
||||
// WatchSB(), 'cause StreamSB.kt works
|
||||
Uqload(),
|
||||
Uqload1(),
|
||||
|
@ -317,6 +318,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
|||
Linkbox(),
|
||||
Acefile(),
|
||||
SpeedoStream(),
|
||||
SpeedoStream1(),
|
||||
Zorofile(),
|
||||
Embedgram(),
|
||||
Mvidoo(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue