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.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
import com.lagradost.cloudstream3.utils.getAndUnpack
import org.jsoup.nodes.Document
open class Fastream: ExtractorApi() {
override var mainUrl = "https://fastream.to"
override var name = "Fastream"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
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
suspend fun getstream(
response: Document,
sources: ArrayList<ExtractorLink>): Boolean{
response.select("script").amap { script ->
if (script.data().contains("sources")) {
val m3u8regex = Regex("((https:|http:)\\/\\/.*\\.m3u8)")
val m3u8 = m3u8regex.find(script.data())?.value ?: return@amap
if (script.data().contains(Regex("eval\\(function\\(p,a,c,k,e,[rd]"))) {
val unpacked = getAndUnpack(script.data())
//val m3u8regex = Regex("((https:|http:)\\/\\/.*\\.m3u8)")
val newm3u8link = unpacked.substringAfter("file:\"").substringBefore("\"")
//val m3u8link = m3u8regex.find(unpacked)?.value ?: return@forEach
generateM3u8(
name,
m3u8,
newm3u8link,
mainUrl
).forEach { 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
}
}

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