2022-08-20 07:46:57 +00:00
|
|
|
package com.lagradost.cloudstream3.extractors
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty
|
2023-01-19 23:44:26 +00:00
|
|
|
import com.lagradost.cloudstream3.SubtitleFile
|
2022-08-20 07:46:57 +00:00
|
|
|
import com.lagradost.cloudstream3.app
|
|
|
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
|
|
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
|
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
|
|
|
|
2022-11-06 11:13:45 +00:00
|
|
|
open class Linkbox : ExtractorApi() {
|
2022-08-20 07:46:57 +00:00
|
|
|
override val name = "Linkbox"
|
|
|
|
override val mainUrl = "https://www.linkbox.to"
|
|
|
|
override val requiresReferer = true
|
|
|
|
|
2023-01-19 23:44:26 +00:00
|
|
|
override suspend fun getUrl(
|
|
|
|
url: String,
|
|
|
|
referer: String?,
|
|
|
|
subtitleCallback: (SubtitleFile) -> Unit,
|
|
|
|
callback: (ExtractorLink) -> Unit
|
|
|
|
) {
|
2023-12-08 16:28:16 +00:00
|
|
|
val token = Regex("""(?:/f/|/file/|\?id=)(\w+)""").find(url)?.groupValues?.get(1)
|
|
|
|
val id = app.get("$mainUrl/api/file/share_out_list/?sortField=utime&sortAsc=0&pageNo=1&pageSize=50&shareToken=$token").parsedSafe<Responses>()?.data?.itemId
|
2023-02-24 18:49:53 +00:00
|
|
|
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)
|
|
|
|
)
|
2022-08-20 07:46:57 +00:00
|
|
|
)
|
2023-02-24 18:49:53 +00:00
|
|
|
}
|
2022-08-20 07:46:57 +00:00
|
|
|
}
|
|
|
|
|
2023-02-24 18:49:53 +00:00
|
|
|
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(),
|
2022-08-20 07:46:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
data class Data(
|
2023-02-24 18:49:53 +00:00
|
|
|
@JsonProperty("itemInfo") val itemInfo: ItemInfo? = null,
|
2023-12-08 16:28:16 +00:00
|
|
|
@JsonProperty("itemId") val itemId: String? = null,
|
2022-08-20 07:46:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
data class Responses(
|
2023-02-24 18:49:53 +00:00
|
|
|
@JsonProperty("data") val data: Data? = null,
|
2022-08-20 07:46:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
}
|