This commit is contained in:
alex 2024-01-17 19:51:51 +07:00
parent 32a8516dc0
commit ec7b24052b

View file

@ -36,12 +36,16 @@ open class Streampai : ExtractorApi() {
val res = app.get(url, referer = referer).document val res = app.get(url, referer = referer).document
val data = res.selectFirst("script:containsData(player =)")?.data() ?: return val data = res.selectFirst("script:containsData(player =)")?.data() ?: return
val sources = data.substringAfter("sources: [").substringBefore("]").replace("\'", "\"") val sources = data.substringAfter("sources: [").substringBefore("]")
.addMarks("src") .addMarks("src")
.addMarks("type") .addMarks("type")
.addMarks("size") .addMarks("size")
.replace("\'", "\"") .replace("\'", "\"")
val tracks = data.substringAfter("tracks: [").substringBefore("]")
.replace("\'", "\"")
tryParseJson<List<Responses>>("[$sources]")?.forEach { tryParseJson<List<Responses>>("[$sources]")?.forEach {
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
@ -56,6 +60,15 @@ open class Streampai : ExtractorApi() {
) )
) )
} }
tryParseJson<List<Responses>>("[$tracks]")?.forEach {
subtitleCallback.invoke(
SubtitleFile(
fixTitle(it.label ?: return@forEach),
fixUrl(it.src)
)
)
}
} }
private fun String.addMarks(str: String): String { private fun String.addMarks(str: String): String {
@ -65,6 +78,7 @@ open class Streampai : ExtractorApi() {
data class Responses( data class Responses(
@JsonProperty("src") val src: 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? @JsonProperty("size") val size: Int?
) )