This commit is contained in:
Thorodinson1 2023-07-18 18:13:32 +05:30
parent d92e7093fc
commit 2876f00545

View file

@ -22,24 +22,24 @@ open class StreamoUpload : ExtractorApi() {
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> { override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>() val sources = mutableListOf<ExtractorLink>()
val response = app.get(url, referer = referer) val response = app.get(url, referer = referer)
val scriptElements = response.document.select("script") val scriptElements = response.document.select("script").map { script ->
for (script in scriptElements) { if (script.data().contains("eval(function(p,a,c,k,e,d)")) {
if (script.data().contains("eval(function(p,a,c,k,e,d)")) { val data = getAndUnpack(script.data()).substringAfter("sources: [").substringBefore("],").replace("file", "\"file\"").trim()
val data = getAndUnpack(script.data()).substringAfter("sources: [") tryParseJson<File>(data)?.let {
.substringBefore("],").replace("file", "\"file\"").trim() M3u8Helper.generateM3u8(
tryParseJson<List<File>>(data)?.let { name,
M3u8Helper.generateM3u8( it.file,
name, "$mainUrl/",
it.map { file -> file.file }, ).forEach { m3uData -> sources.add(m3uData) }
"$mainUrl/", }
).forEach { m3uData -> sources.add(m3uData) }
} }
} }
return sources
} }
return sources
}
private data class File( private data class File(
@JsonProperty("file") val file: String, @JsonProperty("file") val file: String,
) )
}
}