This commit is contained in:
Thorodinson1 2023-07-12 20:54:28 +05:30
parent 52d3c5068a
commit 786958e7d3

View file

@ -4,34 +4,38 @@ 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 org.jsoup.select.Elements
import java.util.regex.Matcher import java.util.regex.Matcher
import java.util.regex.Pattern 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() { open class StreamoUpload : ExtractorApi(name = "StreamoUpload") {
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) 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 scriptPattern: Pattern = Pattern.compile("jwplayer\\(\"vplayer\"\\)\\.setup\\((.*?)\\);", Pattern.DOTALL)
val filePattern: Pattern = Pattern.compile("\"file\"\\s*:\\s*\"(.*?)\"") val filePattern: Pattern = Pattern.compile("\"file\"\\s*:\\s*\"(.*?)\"")
val scriptMatcher: Matcher = scriptPattern.matcher(response.body) for (script in scriptElements) {
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 (scriptMatcher.find()) { while (fileMatcher.find()) {
val scriptData = scriptMatcher.group(1) val fileUrl = fileMatcher.group(1)
val fileMatcher: Matcher = filePattern.matcher(scriptData) val videoUrl = "$mainUrl$fileUrl"
sources.add(ExtractorLink(videoUrl))
while (fileMatcher.find()) { }
val fileUrl = fileMatcher.group(1) }
val videoUrl = "$mainUrl$fileUrl"
sources.add(ExtractorLink(videoUrl))
} }
} }
@ -42,3 +46,4 @@ open class StreamoUpload : ExtractorApi() {
@JsonProperty("file") val file: String, @JsonProperty("file") val file: String,
) )
} }