mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Extractors: fix acefile, pixeldrain & vidplay tracks (#854)
Co-authored-by: ghost <ghost@gmail.com>
This commit is contained in:
parent
dbba6d7f27
commit
f687508521
3 changed files with 50 additions and 39 deletions
|
@ -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(
|
||||
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(
|
||||
name,
|
||||
name,
|
||||
res.substringAfter("\"file\":\"").substringBefore("\","),
|
||||
"$mainUrl/",
|
||||
this.name,
|
||||
this.name,
|
||||
video,
|
||||
"",
|
||||
Qualities.Unknown.value,
|
||||
INFER_TYPE
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sources
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue