fixed Linkbox (#390)

This commit is contained in:
Hexated 2023-02-25 01:49:53 +07:00 committed by GitHub
parent aeab423d29
commit f722785a37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,13 +18,14 @@ open class Linkbox : ExtractorApi() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val id = Regex("""(/file/|id=)(\S+)[&/?]""").find(url)?.groupValues?.get(2)
app.get("$mainUrl/api/open/get_url?itemId=$id", referer=url).parsedSafe<Responses>()?.data?.rList?.map { link ->
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,
link.url ?: return@map null,
url,
getQualityFromName(link.resolution)
)
@ -32,17 +33,21 @@ open class Linkbox : ExtractorApi() {
}
}
data class RList(
@JsonProperty("url") val url: String,
@JsonProperty("resolution") val resolution: String?,
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("rList") val rList: List<RList>?,
@JsonProperty("itemInfo") val itemInfo: ItemInfo? = null,
)
data class Responses(
@JsonProperty("data") val data: Data?,
@JsonProperty("data") val data: Data? = null,
)
}