mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
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
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.app
|
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() {
|
open class OkRu : ExtractorApi() {
|
||||||
override val name = "Okru"
|
override val name = "Okru"
|
||||||
|
@ -10,26 +31,33 @@ open class OkRu : ExtractorApi() {
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||||
val doc = app.get(url).document
|
val doc = app.get(url).document
|
||||||
val urlString = doc.select("div[data-options]").attr("data-options")
|
val sources = ArrayList<ExtractorLink>()
|
||||||
.substringAfter("\\\"videos\\\":[{\\\"name\\\":\\\"")
|
val datajson = doc.select("div[data-options]").attr("data-options")
|
||||||
.substringBefore("]")
|
if (datajson.isNotBlank()) {
|
||||||
urlString.split("{\\\"name\\\":\\\"").reversed().forEach {
|
val main = parseJson<DataOptionsJson>(datajson)
|
||||||
val extractedUrl = it.substringAfter("url\\\":\\\"")
|
val metadatajson = parseJson<MetadataOkru>(main.flashvars?.metadata!!)
|
||||||
.substringBefore("\\\"")
|
val servers = metadatajson.videos
|
||||||
.replace("\\\\u0026", "&")
|
servers.forEach {
|
||||||
val Quality = it.uppercase().substringBefore("\\\"")
|
val quality = it.name.uppercase()
|
||||||
|
.replace("MOBILE","144p")
|
||||||
if (extractedUrl.isNotBlank()) return listOf(
|
.replace("LOWEST","240p")
|
||||||
ExtractorLink(
|
.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,
|
||||||
"$name ${Quality}",
|
"$name $quality",
|
||||||
extractedUrl,
|
extractedurl,
|
||||||
url,
|
url,
|
||||||
Qualities.Unknown.value,
|
getQualityFromName(quality),
|
||||||
isM3u8 = false
|
isM3u8 = false
|
||||||
)
|
))
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return null
|
}
|
||||||
|
return sources
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class CuevanaProvider:MainAPI() {
|
class CuevanaProvider:MainAPI() {
|
||||||
override val mainUrl = "https://cuevana3.io"
|
override val mainUrl = "https://cuevana3.me"
|
||||||
override val name = "Cuevana"
|
override val name = "Cuevana"
|
||||||
override val lang = "es"
|
override val lang = "es"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
|
@ -191,19 +191,19 @@ class CuevanaProvider:MainAPI() {
|
||||||
): Boolean {
|
): Boolean {
|
||||||
app.get(data).document.select("div.TPlayer.embed_div iframe").apmap {
|
app.get(data).document.select("div.TPlayer.embed_div iframe").apmap {
|
||||||
val iframe = fixUrl(it.attr("data-src"))
|
val iframe = fixUrl(it.attr("data-src"))
|
||||||
if (iframe.contains("api.cuevana3.io/fembed/")) {
|
if (iframe.contains("api.cuevana3.me/fembed/")) {
|
||||||
val femregex = Regex("(https.\\/\\/api\\.cuevana3\\.io\\/fembed\\/\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
val femregex = Regex("(https.\\/\\/api\\.cuevana3\\.me\\/fembed\\/\\?h=[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
||||||
femregex.findAll(iframe).map { femreg ->
|
femregex.findAll(iframe).map { femreg ->
|
||||||
femreg.value
|
femreg.value
|
||||||
}.toList().apmap { fem ->
|
}.toList().apmap { fem ->
|
||||||
val key = fem.replace("https://api.cuevana3.io/fembed/?h=","")
|
val key = fem.replace("https://api.cuevana3.me/fembed/?h=","")
|
||||||
val url = app.post("https://api.cuevana3.io/fembed/api.php", allowRedirects = false, headers = mapOf("Host" to "api.cuevana3.io",
|
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,
|
"User-Agent" to USER_AGENT,
|
||||||
"Accept" to "application/json, text/javascript, */*; q=0.01",
|
"Accept" to "application/json, text/javascript, */*; q=0.01",
|
||||||
"Accept-Language" to "en-US,en;q=0.5",
|
"Accept-Language" to "en-US,en;q=0.5",
|
||||||
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
|
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
"X-Requested-With" to "XMLHttpRequest",
|
"X-Requested-With" to "XMLHttpRequest",
|
||||||
"Origin" to "https://api.cuevana3.io",
|
"Origin" to "https://api.cuevana3.me",
|
||||||
"DNT" to "1",
|
"DNT" to "1",
|
||||||
"Connection" to "keep-alive",
|
"Connection" to "keep-alive",
|
||||||
"Sec-Fetch-Dest" to "empty",
|
"Sec-Fetch-Dest" to "empty",
|
||||||
|
@ -239,12 +239,12 @@ class CuevanaProvider:MainAPI() {
|
||||||
data = mapOf(Pair("url",tomkey))
|
data = mapOf(Pair("url",tomkey))
|
||||||
).response.headers.values("location").apmap { loc ->
|
).response.headers.values("location").apmap { loc ->
|
||||||
if (loc.contains("goto_ddh.php")) {
|
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 ->
|
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 ->
|
}.toList().apmap { gotolink ->
|
||||||
app.post("https://api.cuevana3.io/ir/redirect_ddh.php", allowRedirects = false,
|
app.post("https://api.cuevana3.me/ir/redirect_ddh.php", allowRedirects = false,
|
||||||
headers = mapOf("Host" to "api.cuevana3.io",
|
headers = mapOf("Host" to "api.cuevana3.me",
|
||||||
"User-Agent" to USER_AGENT,
|
"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" 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",
|
"Accept-Language" to "en-US,en;q=0.5",
|
||||||
|
@ -263,12 +263,12 @@ class CuevanaProvider:MainAPI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (loc.contains("index.php?h=")) {
|
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 ->
|
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 ->
|
}.toList().apmap { inlink ->
|
||||||
app.post("https://api.cuevana3.io/sc/r.php", allowRedirects = false,
|
app.post("https://api.cuevana3.me/sc/r.php", allowRedirects = false,
|
||||||
headers = mapOf("Host" to "api.cuevana3.io",
|
headers = mapOf("Host" to "api.cuevana3.me",
|
||||||
"User-Agent" to USER_AGENT,
|
"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" 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",
|
"Accept-Language" to "en-US,en;q=0.5",
|
||||||
|
|
Loading…
Reference in a new issue