2022-08-20 07:46:57 +00:00
|
|
|
package com.lagradost.cloudstream3.extractors
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty
|
|
|
|
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.getQualityFromName
|
|
|
|
|
|
|
|
open class VoeExtractor : ExtractorApi() {
|
|
|
|
override val name: String = "Voe"
|
|
|
|
override val mainUrl: String = "https://voe.sx"
|
|
|
|
override val requiresReferer = false
|
|
|
|
|
|
|
|
private data class ResponseLinks(
|
2022-11-12 19:07:08 +00:00
|
|
|
@JsonProperty("hls") val hls: String?,
|
|
|
|
@JsonProperty("mp4") val mp4: String?,
|
2022-08-20 07:46:57 +00:00
|
|
|
@JsonProperty("video_height") val label: Int?
|
|
|
|
//val type: String // Mp4
|
|
|
|
)
|
|
|
|
|
|
|
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
2022-11-12 19:07:08 +00:00
|
|
|
val html = app.get(url).text
|
|
|
|
if (html.isNotBlank()) {
|
|
|
|
val src = html.substringAfter("const sources =").substringBefore(";")
|
|
|
|
// Remove last comma, it is not proper json otherwise
|
2022-08-20 07:46:57 +00:00
|
|
|
.replace("0,", "0")
|
2022-11-12 19:07:08 +00:00
|
|
|
// Make json use the proper quotes
|
|
|
|
.replace("'", "\"")
|
|
|
|
|
2022-08-20 07:46:57 +00:00
|
|
|
//Log.i(this.name, "Result => (src) ${src}")
|
2022-11-12 19:07:08 +00:00
|
|
|
parseJson<ResponseLinks?>(src)?.let { voeLink ->
|
|
|
|
//Log.i(this.name, "Result => (voeLink) ${voeLink}")
|
|
|
|
|
|
|
|
// Always defaults to the hls link, but returns the mp4 if null
|
|
|
|
val linkUrl = voeLink.hls ?: voeLink.mp4
|
|
|
|
val linkLabel = voeLink.label?.toString() ?: ""
|
2022-08-20 07:46:57 +00:00
|
|
|
if (!linkUrl.isNullOrEmpty()) {
|
2022-11-12 19:07:08 +00:00
|
|
|
return listOf(
|
2022-08-20 07:46:57 +00:00
|
|
|
ExtractorLink(
|
|
|
|
name = this.name,
|
|
|
|
source = this.name,
|
|
|
|
url = linkUrl,
|
|
|
|
quality = getQualityFromName(linkLabel),
|
|
|
|
referer = url,
|
2022-11-12 19:07:08 +00:00
|
|
|
isM3u8 = voeLink.hls != null
|
2022-08-20 07:46:57 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-11-12 19:07:08 +00:00
|
|
|
return emptyList()
|
2022-08-20 07:46:57 +00:00
|
|
|
}
|
|
|
|
}
|