|
| 1 | +package com.lagradost.cloudstream3.extractors |
| 2 | + |
| 3 | +import com.fasterxml.jackson.annotation.JsonProperty |
| 4 | +import com.lagradost.cloudstream3.SubtitleFile |
| 5 | +import com.lagradost.cloudstream3.app |
| 6 | +import com.lagradost.cloudstream3.utils.AppUtils.parseJson |
| 7 | +import com.lagradost.cloudstream3.utils.ExtractorApi |
| 8 | +import com.lagradost.cloudstream3.utils.ExtractorLink |
| 9 | +import com.lagradost.cloudstream3.utils.M3u8Helper |
| 10 | + |
| 11 | +open class StreamEmbed : ExtractorApi() { |
| 12 | + override var name = "StreamEmbed" |
| 13 | + override var mainUrl = "https://watch.gxplayer.xyz" |
| 14 | + override val requiresReferer = true |
| 15 | + |
| 16 | + override suspend fun getUrl( |
| 17 | + url: String, |
| 18 | + referer: String?, |
| 19 | + subtitleCallback: (SubtitleFile) -> Unit, |
| 20 | + callback: (ExtractorLink) -> Unit |
| 21 | + ) { |
| 22 | + val jsonString = app.get(url, referer = mainUrl).text |
| 23 | + .substringAfter("var video = ").substringBefore(";") |
| 24 | + val video = parseJson<Details>(jsonString) |
| 25 | + |
| 26 | + M3u8Helper.generateM3u8( |
| 27 | + this.name, |
| 28 | + "$mainUrl/m3u8/${video.uid}/${video.md5}/master.txt?s=1&id=${video.id}&cache=${video.status}", |
| 29 | + referer = "$mainUrl/", |
| 30 | + ).forEach(callback) |
| 31 | + } |
| 32 | + |
| 33 | + private data class Details( |
| 34 | + @JsonProperty("id") val id: String, |
| 35 | + @JsonProperty("uid") val uid: String, |
| 36 | + @JsonProperty("slug") val slug: String, |
| 37 | + @JsonProperty("title") val title: String, |
| 38 | + @JsonProperty("quality") val quality: String, |
| 39 | + @JsonProperty("type") val type: String, |
| 40 | + @JsonProperty("status") val status: String, |
| 41 | + @JsonProperty("md5") val md5: String, |
| 42 | + ) |
| 43 | +} |
0 commit comments