This commit is contained in:
Thorodinson1 2023-07-12 22:57:44 +05:30
parent 12e8102457
commit b3b07b9c3a
2 changed files with 18 additions and 24 deletions

View file

@ -1,49 +1,42 @@
package com.lagradost.cloudstream3.extractors
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
import kotlinx.coroutines.runBlocking
import org.jsoup.select.Elements
import java.util.regex.Matcher
import java.util.regex.Pattern
class StreamoUpload1 : StreamoUpload() {
class StreamoUpload : StreamoUpload() {
override val mainUrl = "https://streamoupload.xyz"
}
open class StreamoUpload : ExtractorApi(name = "StreamoUpload", url = "", referer = "", quality = "") {
open class StreamoUpload : ExtractorApi() {
override val name = "StreamoUpload"
override val mainUrl = "https://streamoupload.xyz"
override val requiresReferer = true
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
val response = app.get(url, referer = referer)
val scriptElements: Elements = response.document.select("script")
val scriptPattern: Pattern = Pattern.compile("jwplayer\\(\"vplayer\"\\)\\.setup\\((.*?)\\);", Pattern.DOTALL)
val filePattern: Pattern = Pattern.compile("\"file\"\\s*:\\s*\"(.*?)\"")
for (script in scriptElements) {
app.get(url, referer = referer).document.select("script").map { script ->
if (script.data().contains("jwplayer(\"vplayer\").setup(")) {
val dataMatcher: Matcher = scriptPattern.matcher(script.data())
if (dataMatcher.find()) {
val data = dataMatcher.group(1)
val fileMatcher: Matcher = filePattern.matcher(data)
while (fileMatcher.find()) {
val fileUrl = fileMatcher.group(1)
val videoUrl = "$mainUrl$fileUrl"
sources.add(ExtractorLink(videoUrl))
val data = script.data().substringAfter("sources: [")
.substringBefore("],").replace("file", "\"file\"").trim()
tryParseJson<File>(data)?.let {
M3u8Helper.generateM3u8(
name,
it.file,
"$mainUrl/",
).forEach { m3uData -> sources.add(m3uData) }
}
}
}
}
return sources
}
private data class File(
@JsonProperty("file") val file: String,
)
}

View file

@ -387,6 +387,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
Acefile(),
SpeedoStream(),
SpeedoStream1(),
StreamoUpload(),
Zorofile(),
Embedgram(),
Mvidoo(),