diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamEmbed.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamEmbed.kt new file mode 100644 index 0000000000..c89f4d226c --- /dev/null +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamEmbed.kt @@ -0,0 +1,43 @@ +package com.lagradost.cloudstream3.extractors + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.SubtitleFile +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.AppUtils.parseJson +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.M3u8Helper + +open class StreamEmbed : ExtractorApi() { + override var name = "StreamEmbed" + override var mainUrl = "https://watch.gxplayer.xyz" + override val requiresReferer = true + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val jsonString = app.get(url, referer = mainUrl).text + .substringAfter("var video = ").substringBefore(";") + val video = parseJson
(jsonString) + + M3u8Helper.generateM3u8( + this.name, + "$mainUrl/m3u8/${video.uid}/${video.md5}/master.txt?s=1&id=${video.id}&cache=${video.status}", + referer = "$mainUrl/", + ).forEach(callback) + } + + private data class Details( + @JsonProperty("id") val id: String, + @JsonProperty("uid") val uid: String, + @JsonProperty("slug") val slug: String, + @JsonProperty("title") val title: String, + @JsonProperty("quality") val quality: String, + @JsonProperty("type") val type: String, + @JsonProperty("status") val status: String, + @JsonProperty("md5") val md5: String, + ) +} diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt index c0d5c5da70..604ea78e90 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -191,6 +191,7 @@ import com.lagradost.cloudstream3.extractors.Smoothpre import com.lagradost.cloudstream3.extractors.Sobreatsesuyp import com.lagradost.cloudstream3.extractors.Solidfiles import com.lagradost.cloudstream3.extractors.Ssbstream +import com.lagradost.cloudstream3.extractors.StreamEmbed import com.lagradost.cloudstream3.extractors.StreamM4u import com.lagradost.cloudstream3.extractors.StreamSB import com.lagradost.cloudstream3.extractors.StreamSB1 @@ -1173,6 +1174,7 @@ val extractorApis: MutableList = arrayListOf( SfastwishCom(), Playerwish(), Vidnest(), + StreamEmbed(), EmturbovidExtractor(), Vtbe(), EPlayExtractor(),