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

View file

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

View file

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