mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
sora: fixed Gmovies [temp]
This commit is contained in:
parent
b6e3934593
commit
ed3c2f87c6
2 changed files with 33 additions and 6 deletions
|
@ -2919,3 +2919,7 @@ data class TgarMedia(
|
||||||
data class TgarData(
|
data class TgarData(
|
||||||
@JsonProperty("results") val results: ArrayList<TgarMedia>? = arrayListOf(),
|
@JsonProperty("results") val results: ArrayList<TgarMedia>? = arrayListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class Gdflix(
|
||||||
|
@JsonProperty("url") val url: String
|
||||||
|
)
|
|
@ -249,14 +249,37 @@ suspend fun extractGdflix(url: String): String? {
|
||||||
?.attr("href") ?: return null
|
?.attr("href") ?: return null
|
||||||
val base = getBaseUrl(iframeGdflix)
|
val base = getBaseUrl(iframeGdflix)
|
||||||
|
|
||||||
val gdfDoc = app.get(iframeGdflix).document.selectFirst("script:containsData(replace)")?.data()
|
val req = app.get(iframeGdflix).document.selectFirst("script:containsData(replace)")?.data()
|
||||||
?.substringAfter("replace(\"")
|
?.substringAfter("replace(\"")
|
||||||
?.substringBefore("\")")?.let {
|
?.substringBefore("\")")?.let {
|
||||||
app.get(fixUrl(it, base)).document
|
app.get(fixUrl(it, base))
|
||||||
}
|
} ?: return null
|
||||||
val iframeDrivebot2 = gdfDoc?.selectFirst("a.btn.btn-outline-warning")?.attr("href")
|
|
||||||
|
// Drivebot dead
|
||||||
|
// val iframeDrivebot2 = gdfDoc?.selectFirst("a.btn.btn-outline-warning")?.attr("href")
|
||||||
|
// return getDrivebotLink(iframeDrivebot2)
|
||||||
|
|
||||||
|
val reqUrl = req.url
|
||||||
|
val ssid = req.cookies["PHPSESSID"]
|
||||||
|
val script = req.document.selectFirst("script:containsData(formData =)")?.data()
|
||||||
|
val key = Regex("append\\(\"key\", \"(\\S+?)\"\\);").find(script ?: return null)?.groupValues?.get(1)
|
||||||
|
|
||||||
|
val body = FormBody.Builder()
|
||||||
|
.addEncoded("action", "direct")
|
||||||
|
.addEncoded("key", "$key")
|
||||||
|
.addEncoded("action_token", "cf_token")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val gdriveUrl = app.post(
|
||||||
|
reqUrl, requestBody = body,
|
||||||
|
cookies = mapOf("PHPSESSID" to "$ssid"),
|
||||||
|
headers = mapOf(
|
||||||
|
"x-token" to URI(reqUrl).host
|
||||||
|
)
|
||||||
|
).parsedSafe<Gdflix>()?.url
|
||||||
|
|
||||||
|
return getDirectGdrive(gdriveUrl ?: return null)
|
||||||
|
|
||||||
return getDrivebotLink(iframeDrivebot2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getDrivebotLink(url: String?): String? {
|
suspend fun getDrivebotLink(url: String?): String? {
|
||||||
|
@ -342,7 +365,7 @@ suspend fun getDirectGdrive(url: String): String {
|
||||||
url
|
url
|
||||||
} else {
|
} else {
|
||||||
"https://drive.google.com/uc?id=${
|
"https://drive.google.com/uc?id=${
|
||||||
url.substringAfter("/d/").substringBefore("/")
|
Regex("(?:\\?id=|/d/)(\\S+)/").find("$url/")?.groupValues?.get(1)
|
||||||
}&export=download"
|
}&export=download"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue