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.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.app
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.M3u8Helper 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" 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 mainUrl = "https://streamoupload.xyz"
override val requiresReferer = true override val requiresReferer = true
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) app.get(url, referer = referer).document.select("script").map { script ->
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) {
if (script.data().contains("jwplayer(\"vplayer\").setup(")) { if (script.data().contains("jwplayer(\"vplayer\").setup(")) {
val dataMatcher: Matcher = scriptPattern.matcher(script.data()) val data = script.data().substringAfter("sources: [")
if (dataMatcher.find()) { .substringBefore("],").replace("file", "\"file\"").trim()
val data = dataMatcher.group(1) tryParseJson<File>(data)?.let {
val fileMatcher: Matcher = filePattern.matcher(data) M3u8Helper.generateM3u8(
name,
while (fileMatcher.find()) { it.file,
val fileUrl = fileMatcher.group(1) "$mainUrl/",
val videoUrl = "$mainUrl$fileUrl" ).forEach { m3uData -> sources.add(m3uData) }
sources.add(ExtractorLink(videoUrl))
}
} }
} }
} }
return sources return sources
} }
private data class File( private data class File(
@JsonProperty("file") val file: String, @JsonProperty("file") val file: String,
) )
}
}

View file

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