33 lines
1.0 KiB
Kotlin
33 lines
1.0 KiB
Kotlin
package com.lagradost.cloudstream3.extractors
|
|
|
|
import com.lagradost.cloudstream3.app
|
|
import com.lagradost.cloudstream3.network.WebViewResolver
|
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
|
|
|
|
|
open class GenericM3U8 : ExtractorApi() {
|
|
override var name = "Upstream"
|
|
override var mainUrl = "https://upstream.to"
|
|
override val requiresReferer = false
|
|
|
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
|
val response = app.get(
|
|
url, interceptor = WebViewResolver(
|
|
Regex("""master\.m3u8""")
|
|
)
|
|
)
|
|
val sources = mutableListOf<ExtractorLink>()
|
|
if (response.url.contains("m3u8"))
|
|
M3u8Helper.generateM3u8(
|
|
name,
|
|
response.url,
|
|
url,
|
|
headers = response.headers.toMap()
|
|
).forEach { link ->
|
|
sources.add(link)
|
|
}
|
|
return sources
|
|
}
|
|
} |