forked from recloudstream/cloudstream
Cuevana domain fix and Okru Extractor fix (#797)
This commit is contained in:
parent
fbfcde0295
commit
3471ee5639
2 changed files with 59 additions and 31 deletions
|
@ -1,7 +1,28 @@
|
|||
package com.lagradost.cloudstream3.extractors
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.utils.*
|
||||
import com.lagradost.cloudstream3.app
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||
|
||||
data class DataOptionsJson (
|
||||
@JsonProperty("flashvars") var flashvars : Flashvars? = Flashvars(),
|
||||
)
|
||||
data class Flashvars (
|
||||
@JsonProperty("metadata") var metadata : String? = null,
|
||||
@JsonProperty("hlsManifestUrl") var hlsManifestUrl : String? = null, //m3u8
|
||||
)
|
||||
|
||||
data class MetadataOkru (
|
||||
@JsonProperty("videos") var videos: ArrayList<Videos> = arrayListOf(),
|
||||
)
|
||||
|
||||
data class Videos (
|
||||
@JsonProperty("name") var name : String,
|
||||
@JsonProperty("url") var url : String,
|
||||
@JsonProperty("seekSchema") var seekSchema : Int? = null,
|
||||
@JsonProperty("disallowed") var disallowed : Boolean? = null
|
||||
)
|
||||
|
||||
open class OkRu : ExtractorApi() {
|
||||
override val name = "Okru"
|
||||
|
@ -10,26 +31,33 @@ open class OkRu : ExtractorApi() {
|
|||
|
||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||
val doc = app.get(url).document
|
||||
val urlString = doc.select("div[data-options]").attr("data-options")
|
||||
.substringAfter("\\\"videos\\\":[{\\\"name\\\":\\\"")
|
||||
.substringBefore("]")
|
||||
urlString.split("{\\\"name\\\":\\\"").reversed().forEach {
|
||||
val extractedUrl = it.substringAfter("url\\\":\\\"")
|
||||
.substringBefore("\\\"")
|
||||
.replace("\\\\u0026", "&")
|
||||
val Quality = it.uppercase().substringBefore("\\\"")
|
||||
|
||||
if (extractedUrl.isNotBlank()) return listOf(
|
||||
ExtractorLink(
|
||||
val sources = ArrayList<ExtractorLink>()
|
||||
val datajson = doc.select("div[data-options]").attr("data-options")
|
||||
if (datajson.isNotBlank()) {
|
||||
val main = parseJson<DataOptionsJson>(datajson)
|
||||
val metadatajson = parseJson<MetadataOkru>(main.flashvars?.metadata!!)
|
||||
val servers = metadatajson.videos
|
||||
servers.forEach {
|
||||
val quality = it.name.uppercase()
|
||||
.replace("MOBILE","144p")
|
||||
.replace("LOWEST","240p")
|
||||
.replace("LOW","360p")
|
||||
.replace("SD","480p")
|
||||
.replace("HD","720p")
|
||||
.replace("FULL","1080p")
|
||||
.replace("QUAD","1440p")
|
||||
.replace("ULTRA","4k")
|
||||
val extractedurl = it.url.replace("\\\\u0026", "&")
|
||||
sources.add(ExtractorLink(
|
||||
name,
|
||||
"$name ${Quality}",
|
||||
extractedUrl,
|
||||
"$name $quality",
|
||||
extractedurl,
|
||||
url,
|
||||
Qualities.Unknown.value,
|
||||
getQualityFromName(quality),
|
||||
isM3u8 = false
|
||||
)
|
||||
)
|
||||
))
|
||||
}
|
||||
}
|
||||
return null
|
||||
return sources
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
|||
import java.util.*
|
||||
|
||||
class CuevanaProvider:MainAPI() {
|
||||
override val mainUrl = "https://cuevana3.io"
|
||||
override val mainUrl = "https://cuevana3.me"
|
||||
override val name = "Cuevana"
|
||||
override val lang = "es"
|
||||
override val hasMainPage = true
|
||||
|
@ -191,19 +191,19 @@ class CuevanaProvider:MainAPI() {
|
|||
): Boolean {
|
||||
app.get(data).document.select("div.TPlayer.embed_div iframe").apmap {
|
||||
val iframe = fixUrl(it.attr("data-src"))
|
||||
if (iframe.contains("api.cuevana3.io/fembed/")) {
|
||||
val femregex = Regex("(https.\\/\\/api\\.cuevana3\\.io\\/fembed\\/\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
||||
if (iframe.contains("api.cuevana3.me/fembed/")) {
|
||||
val femregex = Regex("(https.\\/\\/api\\.cuevana3\\.me\\/fembed\\/\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
||||
femregex.findAll(iframe).map { femreg ->
|
||||
femreg.value
|
||||
}.toList().apmap { fem ->
|
||||
val key = fem.replace("https://api.cuevana3.io/fembed/?h=","")
|
||||
val url = app.post("https://api.cuevana3.io/fembed/api.php", allowRedirects = false, headers = mapOf("Host" to "api.cuevana3.io",
|
||||
val key = fem.replace("https://api.cuevana3.me/fembed/?h=","")
|
||||
val url = app.post("https://api.cuevana3.me/fembed/api.php", allowRedirects = false, headers = mapOf("Host" to "api.cuevana3.me",
|
||||
"User-Agent" to USER_AGENT,
|
||||
"Accept" to "application/json, text/javascript, */*; q=0.01",
|
||||
"Accept-Language" to "en-US,en;q=0.5",
|
||||
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"X-Requested-With" to "XMLHttpRequest",
|
||||
"Origin" to "https://api.cuevana3.io",
|
||||
"Origin" to "https://api.cuevana3.me",
|
||||
"DNT" to "1",
|
||||
"Connection" to "keep-alive",
|
||||
"Sec-Fetch-Dest" to "empty",
|
||||
|
@ -239,12 +239,12 @@ class CuevanaProvider:MainAPI() {
|
|||
data = mapOf(Pair("url",tomkey))
|
||||
).response.headers.values("location").apmap { loc ->
|
||||
if (loc.contains("goto_ddh.php")) {
|
||||
val gotoregex = Regex("(\\/\\/api.cuevana3.io\\/ir\\/goto_ddh.php\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
||||
val gotoregex = Regex("(\\/\\/api.cuevana3.me\\/ir\\/goto_ddh.php\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
||||
gotoregex.findAll(loc).map { goreg ->
|
||||
goreg.value.replace("//api.cuevana3.io/ir/goto_ddh.php?h=","")
|
||||
goreg.value.replace("//api.cuevana3.me/ir/goto_ddh.php?h=","")
|
||||
}.toList().apmap { gotolink ->
|
||||
app.post("https://api.cuevana3.io/ir/redirect_ddh.php", allowRedirects = false,
|
||||
headers = mapOf("Host" to "api.cuevana3.io",
|
||||
app.post("https://api.cuevana3.me/ir/redirect_ddh.php", allowRedirects = false,
|
||||
headers = mapOf("Host" to "api.cuevana3.me",
|
||||
"User-Agent" to USER_AGENT,
|
||||
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
"Accept-Language" to "en-US,en;q=0.5",
|
||||
|
@ -263,12 +263,12 @@ class CuevanaProvider:MainAPI() {
|
|||
}
|
||||
}
|
||||
if (loc.contains("index.php?h=")) {
|
||||
val indexRegex = Regex("(\\/\\/api.cuevana3.io\\/sc\\/index.php\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
||||
val indexRegex = Regex("(\\/\\/api.cuevana3.me\\/sc\\/index.php\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
||||
indexRegex.findAll(loc).map { indreg ->
|
||||
indreg.value.replace("//api.cuevana3.io/sc/index.php?h=","")
|
||||
indreg.value.replace("//api.cuevana3.me/sc/index.php?h=","")
|
||||
}.toList().apmap { inlink ->
|
||||
app.post("https://api.cuevana3.io/sc/r.php", allowRedirects = false,
|
||||
headers = mapOf("Host" to "api.cuevana3.io",
|
||||
app.post("https://api.cuevana3.me/sc/r.php", allowRedirects = false,
|
||||
headers = mapOf("Host" to "api.cuevana3.me",
|
||||
"User-Agent" to USER_AGENT,
|
||||
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
"Accept-Language" to "en-US,en;q=0.5",
|
||||
|
|
Loading…
Reference in a new issue