mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fix
This commit is contained in:
parent
11075c0c7d
commit
c35f0bad57
2 changed files with 18 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 10
|
version = 11
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.lagradost.cloudstream3.fixTitle
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.cloudstream3.utils.fixUrl
|
import com.lagradost.cloudstream3.utils.fixUrl
|
||||||
import com.lagradost.cloudstream3.utils.getAndUnpack
|
import com.lagradost.cloudstream3.utils.getAndUnpack
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
|
@ -32,41 +33,39 @@ open class Streampai : ExtractorApi() {
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
) {
|
) {
|
||||||
val res = app.get(url, referer = referer).text
|
val res = app.get(url, referer = referer).document
|
||||||
val data = getAndUnpack(res)
|
val data = res.selectFirst("script:containsData(player =)")?.data() ?: return
|
||||||
|
|
||||||
val sources = data.substringAfter("sources:[").substringBefore("]").replace("\'", "\"")
|
val sources = data.substringAfter("sources: [").substringBefore("]").replace("\'", "\"")
|
||||||
val tracks = data.substringAfter("\"tracks\":[").substringBefore("]")
|
.addMarks("src")
|
||||||
|
.addMarks("type")
|
||||||
|
.addMarks("size")
|
||||||
|
.replace("\'", "\"")
|
||||||
|
|
||||||
tryParseJson<List<Responses>>("[$sources]")?.forEach {
|
tryParseJson<List<Responses>>("[$sources]")?.forEach {
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
this.name,
|
this.name,
|
||||||
this.name,
|
this.name,
|
||||||
fixUrl(it.file),
|
fixUrl(it.src),
|
||||||
url,
|
url,
|
||||||
getQualityFromName(it.label),
|
it.size ?: Qualities.Unknown.value,
|
||||||
headers = mapOf(
|
headers = mapOf(
|
||||||
"Range" to "bytes=0-",
|
"Range" to "bytes=0-",
|
||||||
)
|
),
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
tryParseJson<List<Responses>>("[$tracks]")?.forEach {
|
|
||||||
subtitleCallback.invoke(
|
|
||||||
SubtitleFile(
|
|
||||||
fixTitle(it.label ?: ""),
|
|
||||||
fixUrl(it.file),
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun String.addMarks(str: String): String {
|
||||||
|
return this.replace(Regex("\"?$str\"?"), "\"$str\"")
|
||||||
|
}
|
||||||
|
|
||||||
data class Responses(
|
data class Responses(
|
||||||
@JsonProperty("file") val file: String,
|
@JsonProperty("src") val src: String,
|
||||||
@JsonProperty("type") val type: String?,
|
@JsonProperty("type") val type: String?,
|
||||||
@JsonProperty("label") val label: String?
|
@JsonProperty("size") val size: Int?
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue