Extractors: fix acefile, pixeldrain & vidplay tracks (#854)

Co-authored-by: ghost <ghost@gmail.com>
This commit is contained in:
Sofie 2024-01-05 23:08:48 +07:00 committed by GitHub
parent dbba6d7f27
commit f687508521
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 39 deletions

View file

@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.extractors
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.base64Decode
import com.lagradost.cloudstream3.utils.*
@ -9,31 +10,34 @@ open class Acefile : ExtractorApi() {
override val mainUrl = "https://acefile.co"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
app.get(url).document.select("script").map { script ->
if (script.data().contains("eval(function(p,a,c,k,e,d)")) {
val data = getAndUnpack(script.data())
val id = data.substringAfter("{\"id\":\"").substringBefore("\",")
val key = data.substringAfter("var nfck=\"").substringBefore("\";")
app.get("https://acefile.co/local/$id?key=$key").text.let {
base64Decode(
it.substringAfter("JSON.parse(atob(\"").substringBefore("\"))")
).let { res ->
sources.add(
ExtractorLink(
name,
name,
res.substringAfter("\"file\":\"").substringBefore("\","),
"$mainUrl/",
Qualities.Unknown.value,
)
)
}
}
}
}
return sources
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val script = getAndUnpack(app.get(url).text)
val id = script.substringAfter("\"code\":\"").substringBefore("\",")
val doc = app.get("https://drive.google.com/uc?id=${base64Decode(id)}&export=download").document
val form = doc.select("form#download-form").attr("action")
val uc = doc.select("input#uc-download-link").attr("value")
val video = app.post(
form, data = mapOf(
"uc-download-link" to uc
)
).url
callback.invoke(
ExtractorLink(
this.name,
this.name,
video,
"",
Qualities.Unknown.value,
INFER_TYPE
)
)
}
}

View file

@ -2,7 +2,6 @@
package com.lagradost.cloudstream3.extractors
import android.util.Log
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.*
@ -12,19 +11,14 @@ open class PixelDrain : ExtractorApi() {
override val requiresReferer = true
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
val ext_ref = referer ?: ""
val pixel_id = Regex("""([^\/]+)(?=\?download)""").find(url)?.groupValues?.get(1)
val downloadLink = "${mainUrl}/api/file/${pixel_id}?download"
Log.d("Kekik_${this.name}", "downloadLink » ${downloadLink}")
val mId = Regex("/([ul]/[\\da-zA-Z\\-]+)(?:\\?download)?").find(url)?.groupValues?.get(1)?.split("/")
callback.invoke(
ExtractorLink(
source = "pixeldrain - ${pixel_id}",
name = "pixeldrain - ${pixel_id}",
url = downloadLink,
referer = "${mainUrl}/u/${pixel_id}?download",
quality = Qualities.Unknown.value,
type = INFER_TYPE
this.name,
this.name,
"$mainUrl/api/file/${mId?.last() ?: return}?download",
url,
Qualities.Unknown.value,
)
)
}

View file

@ -43,9 +43,9 @@ open class Vidplay : ExtractorApi() {
"Accept" to "application/json, text/javascript, */*; q=0.01",
"X-Requested-With" to "XMLHttpRequest",
), referer = url
).parsedSafe<Response>()?.result?.sources
).parsedSafe<Response>()?.result
res?.map {
res?.sources?.map {
M3u8Helper.generateM3u8(
this.name,
it.file ?: return@map,
@ -53,6 +53,12 @@ open class Vidplay : ExtractorApi() {
).forEach(callback)
}
res?.tracks?.filter { it.kind == "captions" }?.map {
subtitleCallback.invoke(
SubtitleFile(it.label ?: return@map, it.file ?: return@map)
)
}
}
private suspend fun getKeys(): List<String> {
@ -88,12 +94,19 @@ open class Vidplay : ExtractorApi() {
return base64Encode(input).replace("/", "_")
}
data class Tracks(
@JsonProperty("file") val file: String? = null,
@JsonProperty("label") val label: String? = null,
@JsonProperty("kind") val kind: String? = null,
)
data class Sources(
@JsonProperty("file") val file: String? = null,
)
data class Result(
@JsonProperty("sources") val sources: ArrayList<Sources>? = arrayListOf(),
@JsonProperty("tracks") val tracks: ArrayList<Tracks>? = arrayListOf(),
)
data class Response(