mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
streamo upload extractor fix
This commit is contained in:
parent
91d2d4dc47
commit
efaaf044f7
1 changed files with 20 additions and 11 deletions
|
@ -21,17 +21,26 @@ open class StreamoUpload : ExtractorApi() {
|
|||
|
||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||
val sources = mutableListOf<ExtractorLink>()
|
||||
app.get(url, referer = referer).document.select("script").map { script ->
|
||||
val response = app.get(url, referer = referer)
|
||||
val scriptElements = response.document.select("script")
|
||||
for (script in scriptElements) {
|
||||
if (script.data().contains("eval(function(p,a,c,k,e,d)")) {
|
||||
val data =
|
||||
getAndUnpack(script.data()).substringAfter("sources: [")
|
||||
.substringBefore("],").replace("file", "\"file\"").trim()
|
||||
tryParseJson<File>(data)?.let {
|
||||
M3u8Helper.generateM3u8(
|
||||
name,
|
||||
it.file,
|
||||
"$mainUrl/",
|
||||
).forEach { m3uData -> sources.add(m3uData) }
|
||||
val data = getAndUnpack(script.data())
|
||||
.substringAfter("sources: [")
|
||||
.substringBefore("],")
|
||||
.replace("file", "\"file\"")
|
||||
.trim()
|
||||
|
||||
tryParseJson<List<File>>(data)?.let { fileList ->
|
||||
for (fileData in fileList) {
|
||||
M3u8Helper.generateM3u8(
|
||||
name,
|
||||
fileData.file,
|
||||
"$mainUrl/"
|
||||
).forEach { m3uData ->
|
||||
sources.add(m3uData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +48,6 @@ open class StreamoUpload : ExtractorApi() {
|
|||
}
|
||||
|
||||
private data class File(
|
||||
@JsonProperty("file") val file: String,
|
||||
@JsonProperty("file") val file: String
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue