mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Update StreamoUpload.kt
This commit is contained in:
parent
c71e7b915b
commit
52d3c5068a
1 changed files with 17 additions and 15 deletions
|
@ -1,11 +1,11 @@
|
||||||
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 java.util.regex.Matcher
|
||||||
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
class StreamoUpload1 : StreamoUpload() {
|
class StreamoUpload1 : StreamoUpload() {
|
||||||
override val mainUrl = "https://streamoupload.xyz"
|
override val mainUrl = "https://streamoupload.xyz"
|
||||||
|
@ -18,25 +18,27 @@ 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>()
|
||||||
app.get(url, referer = referer).document.select("script").map { script ->
|
val response = app.get(url, referer = referer)
|
||||||
if (script.data().contains("jwplayer(\"vplayer\").setup(")) {
|
val scriptPattern: Pattern = Pattern.compile("jwplayer\\(\"vplayer\"\\)\\.setup\\((.*?)\\);", Pattern.DOTALL)
|
||||||
val data = script.data().substringAfter("sources: [")
|
val filePattern: Pattern = Pattern.compile("\"file\"\\s*:\\s*\"(.*?)\"")
|
||||||
.substringBefore("],").replace("file", "\"file\"").trim()
|
|
||||||
tryParseJson<File>(data)?.let {
|
val scriptMatcher: Matcher = scriptPattern.matcher(response.body)
|
||||||
M3u8Helper.generateM3u8(
|
|
||||||
name,
|
while (scriptMatcher.find()) {
|
||||||
it.file,
|
val scriptData = scriptMatcher.group(1)
|
||||||
"$mainUrl/",
|
val fileMatcher: Matcher = filePattern.matcher(scriptData)
|
||||||
).forEach { m3uData -> sources.add(m3uData) }
|
|
||||||
}
|
while (fileMatcher.find()) {
|
||||||
|
val fileUrl = fileMatcher.group(1)
|
||||||
|
val videoUrl = "$mainUrl$fileUrl"
|
||||||
|
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,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue