mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fix #583
This commit is contained in:
parent
6cce88370a
commit
d17d1e870a
2 changed files with 29 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 2
|
||||
version = 3
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.net.URLDecoder
|
|||
|
||||
class DubokuProvider : MainAPI() {
|
||||
override var mainUrl = "https://www.duboku.tv"
|
||||
private var serverUrl = "https://w.duboku.io"
|
||||
override var name = "Duboku"
|
||||
override val hasMainPage = true
|
||||
override var lang = "zh"
|
||||
|
@ -106,35 +107,41 @@ class DubokuProvider : MainAPI() {
|
|||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
|
||||
app.get(data).document.select("script").map { script ->
|
||||
if (script.data().contains("var player_data={")) {
|
||||
val dataJson =
|
||||
script.data().substringAfter("var player_data={").substringBefore("}")
|
||||
app.get(data).document.selectFirst("script:containsData(var player_data={)")?.data()
|
||||
?.substringAfter("var player_data={")?.substringBefore("}")
|
||||
?: throw IllegalArgumentException()
|
||||
val source = tryParseJson<Sources>("{$dataJson}")
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
this.name,
|
||||
this.name,
|
||||
decode(base64Decode(source?.url ?: return@map)),
|
||||
"https://w.duboku.io/",
|
||||
"${decode(base64Decode(source?.url ?: return false))}${getSign(source.from, data)}",
|
||||
"$serverUrl/",
|
||||
Qualities.Unknown.value,
|
||||
INFER_TYPE,
|
||||
headers = mapOf(
|
||||
"Accept-Language" to "en-US,en;q=0.5",
|
||||
"Origin" to "https://w.duboku.io"
|
||||
"Origin" to serverUrl
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private suspend fun getSign(server: String? = "vidjs24", ref: String): String {
|
||||
return app.get(
|
||||
"$serverUrl/static/player/$server.php",
|
||||
referer = ref
|
||||
).text.substringAfter("PlayUrl+'").substringBefore("'")
|
||||
}
|
||||
|
||||
private fun decode(input: String): String = URLDecoder.decode(input, "utf-8")
|
||||
|
||||
data class Sources(
|
||||
@JsonProperty("url") val url: String?,
|
||||
@JsonProperty("from") val from: String?,
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue