mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
updated
This commit is contained in:
parent
02e87830a9
commit
1c6c99a4e8
1 changed files with 21 additions and 20 deletions
|
@ -5,9 +5,9 @@ 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.getAndUnpack
|
||||||
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
import java.util.regex.Matcher
|
|
||||||
import java.util.regex.Pattern
|
|
||||||
import org.jsoup.select.Elements
|
import org.jsoup.select.Elements
|
||||||
|
|
||||||
class StreamoUpload1 : StreamoUpload() {
|
class StreamoUpload1 : StreamoUpload() {
|
||||||
|
@ -21,27 +21,28 @@ 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>()
|
||||||
val response = app.get(url, referer = referer)
|
app.get(url, referer = referer).document.select("script").map {it.data() }
|
||||||
val scriptElements: Elements = response.document.select("script")
|
.filter { it.contains("eval(function(p,a,c,k,e,d)") }
|
||||||
val scriptPattern: Pattern = Pattern.compile("jwplayer\\(\"vplayer\"\\).setup\\((.*?)\\);", Pattern.DOTALL)
|
.map { script ->
|
||||||
val filePattern: Pattern = Pattern.compile("\"file\"\\s*:\\s*\"(.*?)\"")
|
val unpacked = if (script.contains("m3u8")) getAndUnpack(script)
|
||||||
|
|
||||||
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 extractorLink = ExtractorLink(fileUrl, Qualities.Unknown.value,)
|
).forEach { m3uData -> sources.add(m3uData) }
|
||||||
sources.add(extractorLink)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sources
|
return sources
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private data class File(
|
||||||
|
@JsonProperty("file") val file: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue