mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
updated streamo
This commit is contained in:
parent
c41cc4799e
commit
a35b48a940
1 changed files with 20 additions and 12 deletions
|
@ -6,6 +6,9 @@ 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 java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
import org.jsoup.select.Elements
|
||||
|
||||
class StreamoUpload1 : StreamoUpload() {
|
||||
override val mainUrl = "https://streamoupload.xyz"
|
||||
|
@ -18,25 +21,30 @@ 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: 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(")) {
|
||||
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) }
|
||||
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)
|
||||
sources.add(ExtractorLink(fileUrl))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sources
|
||||
}
|
||||
|
||||
private data class File(
|
||||
@JsonProperty("file") val file: String,
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue