forked from recloudstream/cloudstream
53 lines
1.7 KiB
Kotlin
53 lines
1.7 KiB
Kotlin
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.ExtractorApi
|
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
|
|
|
open class Linkbox : ExtractorApi() {
|
|
override val name = "Linkbox"
|
|
override val mainUrl = "https://www.linkbox.to"
|
|
override val requiresReferer = true
|
|
|
|
override suspend fun getUrl(
|
|
url: String,
|
|
referer: String?,
|
|
subtitleCallback: (SubtitleFile) -> Unit,
|
|
callback: (ExtractorLink) -> Unit
|
|
) {
|
|
val id = Regex("""(?:/f/|/file/|\?id=)(\w+)""").find(url)?.groupValues?.get(1)
|
|
app.get("$mainUrl/api/file/detail?itemId=$id", referer = url)
|
|
.parsedSafe<Responses>()?.data?.itemInfo?.resolutionList?.map { link ->
|
|
callback.invoke(
|
|
ExtractorLink(
|
|
name,
|
|
name,
|
|
link.url ?: return@map null,
|
|
url,
|
|
getQualityFromName(link.resolution)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
data class Resolutions(
|
|
@JsonProperty("url") val url: String? = null,
|
|
@JsonProperty("resolution") val resolution: String? = null,
|
|
)
|
|
|
|
data class ItemInfo(
|
|
@JsonProperty("resolutionList") val resolutionList: ArrayList<Resolutions>? = arrayListOf(),
|
|
)
|
|
|
|
data class Data(
|
|
@JsonProperty("itemInfo") val itemInfo: ItemInfo? = null,
|
|
)
|
|
|
|
data class Responses(
|
|
@JsonProperty("data") val data: Data? = null,
|
|
)
|
|
|
|
} |