fix fastream, tomatomatela, and added okrulink (#320)

This commit is contained in:
Stormunblessed 2023-01-21 03:25:06 -06:00 committed by GitHub
parent b8248d1053
commit 3ecaf47c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 116 additions and 37 deletions

View file

@ -5,35 +5,50 @@ import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8 import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
import com.lagradost.cloudstream3.utils.getAndUnpack
import org.jsoup.nodes.Document
open class Fastream: ExtractorApi() { open class Fastream: ExtractorApi() {
override var mainUrl = "https://fastream.to" override var mainUrl = "https://fastream.to"
override var name = "Fastream" override var name = "Fastream"
override val requiresReferer = false override val requiresReferer = false
suspend fun getstream(
response: Document,
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? { sources: ArrayList<ExtractorLink>): Boolean{
val id = Regex("emb\\.html\\?(.*)\\=(enc|)").find(url)?.destructured?.component1() ?: return emptyList()
val sources = mutableListOf<ExtractorLink>()
val response = app.post("$mainUrl/dl",
data = mapOf(
Pair("op","embed"),
Pair("file_code",id),
Pair("auto","1")
)).document
response.select("script").amap { script -> response.select("script").amap { script ->
if (script.data().contains("sources")) { if (script.data().contains(Regex("eval\\(function\\(p,a,c,k,e,[rd]"))) {
val m3u8regex = Regex("((https:|http:)\\/\\/.*\\.m3u8)") val unpacked = getAndUnpack(script.data())
val m3u8 = m3u8regex.find(script.data())?.value ?: return@amap //val m3u8regex = Regex("((https:|http:)\\/\\/.*\\.m3u8)")
val newm3u8link = unpacked.substringAfter("file:\"").substringBefore("\"")
//val m3u8link = m3u8regex.find(unpacked)?.value ?: return@forEach
generateM3u8( generateM3u8(
name, name,
m3u8, newm3u8link,
mainUrl mainUrl
).forEach { link -> ).forEach { link ->
sources.add(link) sources.add(link)
} }
} }
} }
return true
}
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = ArrayList<ExtractorLink>()
val idregex = Regex("emb.html\\?(.*)=")
if (url.contains(Regex("(emb.html.*fastream)"))) {
val id = idregex.find(url)?.destructured?.component1() ?: ""
val response = app.post("https://fastream.to/dl", allowRedirects = false,
data = mapOf(
"op" to "embed",
"file_code" to id,
"auto" to "1"
)
).document
getstream(response, sources)
}
val response = app.get(url, referer = url).document
getstream(response, sources)
return sources return sources
} }
} }

View file

@ -0,0 +1,39 @@
package com.lagradost.cloudstream3.extractors
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
data class Okrulinkdata (
@JsonProperty("status" ) var status : String? = null,
@JsonProperty("url" ) var url : String? = null
)
open class Okrulink: ExtractorApi() {
override var mainUrl = "https://okru.link"
override var name = "Okrulink"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
val key = url.substringAfter("html?t=")
val request = app.post("https://apizz.okru.link/decoding", allowRedirects = false,
data = mapOf("video" to key)
).parsedSafe<Okrulinkdata>()
if (request?.url != null) {
sources.add(
ExtractorLink(
name,
name,
request.url!!,
"",
Qualities.Unknown.value,
isM3u8 = false
)
)
}
return sources
}
}

View file

@ -1,41 +1,64 @@
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.app import com.lagradost.cloudstream3.app
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.USER_AGENT
import com.lagradost.cloudstream3.mapper
import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
class Cinestart: Tomatomatela() { class Cinestart: Tomatomatela() {
override var name = "Cinestart" override var name: String = "Cinestart"
override var mainUrl = "https://cinestart.net" override val mainUrl: String = "https://cinestart.net"
override val details = "vr.php?v=" override val details = "vr.php?v="
} }
class TomatomatelalClub: Tomatomatela() {
override var name: String = "Tomatomatela"
override val mainUrl: String = "https://tomatomatela.club"
}
open class Tomatomatela : ExtractorApi() { open class Tomatomatela : ExtractorApi() {
override var name = "Tomatomatela" override var name = "Tomatomatela"
override var mainUrl = "https://tomatomatela.com" override val mainUrl = "https://tomatomatela.com"
override val requiresReferer = false override val requiresReferer = false
private data class Tomato ( private data class Tomato (
@JsonProperty("status") val status: Int, @JsonProperty("status") val status: Int,
@JsonProperty("file") val file: String @JsonProperty("file") val file: String?
) )
open val details = "details.php?v=" open val details = "details.php?v="
open val embeddetails = "/embed.html#"
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? { override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
val link = url.replace("$mainUrl/embed.html#","$mainUrl/$details") val link = url.replace("$mainUrl$embeddetails","$mainUrl/$details")
val server = app.get(link, allowRedirects = false).text val sources = ArrayList<ExtractorLink>()
val json = parseJson<Tomato>(server) val server = app.get(link, allowRedirects = false,
if (json.status == 200) return listOf( headers = mapOf(
ExtractorLink( "User-Agent" to USER_AGENT,
name, "Accept" to "application/json, text/javascript, */*; q=0.01",
name, "Accept-Language" to "en-US,en;q=0.5",
json.file, "X-Requested-With" to "XMLHttpRequest",
"", "DNT" to "1",
Qualities.Unknown.value, "Connection" to "keep-alive",
isM3u8 = false "Sec-Fetch-Dest" to "empty",
"Sec-Fetch-Mode" to "cors",
"Sec-Fetch-Site" to "same-origin"
) )
) ).parsedSafe<Tomato>()
return null if (server?.file != null) {
sources.add(
ExtractorLink(
name,
name,
server.file,
"",
Qualities.Unknown.value,
isM3u8 = false
)
)
}
return sources
} }
} }

View file

@ -260,9 +260,11 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
UpstreamExtractor(), UpstreamExtractor(),
Tomatomatela(), Tomatomatela(),
TomatomatelalClub(),
Cinestart(), Cinestart(),
OkRu(), OkRu(),
OkRuHttps(), OkRuHttps(),
Okrulink(),
// dood extractors // dood extractors
DoodCxExtractor(), DoodCxExtractor(),