mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
- Add StreamTape clones[Streamtape.net, ShaveTape.cash] - optimize imports for AstreamHub, GMplayer
44 lines
1.4 KiB
Kotlin
44 lines
1.4 KiB
Kotlin
package com.lagradost.cloudstream3.extractors
|
|
|
|
import com.lagradost.cloudstream3.app
|
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
import com.lagradost.cloudstream3.utils.Qualities
|
|
|
|
open class GMPlayer : ExtractorApi() {
|
|
override val name = "GM Player"
|
|
override val mainUrl = "https://gmplayer.xyz"
|
|
override val requiresReferer = true
|
|
|
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
|
val ref = referer ?: return null
|
|
val id = url.substringAfter("/video/").substringBefore("/")
|
|
|
|
val m3u8 = app.post(
|
|
"$mainUrl/player/index.php?data=$id&do=getVideo",
|
|
mapOf(
|
|
"accept" to "*/*",
|
|
"referer" to ref,
|
|
"x-requested-with" to "XMLHttpRequest",
|
|
"origin" to mainUrl
|
|
),
|
|
data = mapOf("hash" to id, "r" to ref)
|
|
).parsed<GmResponse>().videoSource ?: return null
|
|
|
|
return listOf(
|
|
ExtractorLink(
|
|
this.name,
|
|
this.name,
|
|
m3u8,
|
|
ref,
|
|
Qualities.Unknown.value,
|
|
headers = mapOf("accept" to "*/*"),
|
|
isM3u8 = true
|
|
)
|
|
)
|
|
}
|
|
|
|
private data class GmResponse(
|
|
val videoSource: String? = null
|
|
)
|
|
} |