This commit is contained in:
jack 2023-12-09 04:10:52 +07:00
parent 21947a3b1d
commit 1922d6dc26
5 changed files with 82 additions and 50 deletions

View file

@ -1634,17 +1634,15 @@ object SoraExtractor : SoraStream() {
app.get(
url, referer = "https://smashystream.com/"
).document.select("div#_default-servers a.server").map {
it.attr("data-id") to it.text()
it.attr("data-url") to it.text()
}.apmap {
when {
it.second.contains(Regex("(Player F|Player SE|Player N|Player D)")) -> {
when (it.second) {
"Player F" -> {
invokeSmashyFfix(it.second, it.first, url, callback)
}
it.second.equals("Player FM", true) -> invokeSmashyFm(
it.second, it.first, url, callback
)
"Player D (Hindi)" -> {
invokeSmashyD(it.first, url, callback)
}
else -> return@apmap
}
}

View file

@ -425,3 +425,12 @@ data class SmashySources(
@JsonProperty("sourceUrls") var sourceUrls: ArrayList<String>? = arrayListOf(),
@JsonProperty("subtitleUrls") var subtitleUrls: String? = null,
)
data class SmashyDSources(
@JsonProperty("sourceUrls") var sourceUrls: ArrayList<SmashyDSourcesUrls>? = arrayListOf(),
)
data class SmashyDSourcesUrls(
@JsonProperty("file") var file: String? = null,
@JsonProperty("title") var title: String? = null,
)

View file

@ -536,7 +536,7 @@ open class SoraStream : TmdbProvider() {
},
{
if (!res.isAnime) invokeSmashyStream(
res.id,
res.imdbId,
res.season,
res.episode,
subtitleCallback,

View file

@ -144,7 +144,7 @@ class SoraStreamLite : SoraStream() {
},
{
if (!res.isAnime) invokeSmashyStream(
res.id,
res.imdbId,
res.season,
res.episode,
subtitleCallback,

View file

@ -45,7 +45,7 @@ import kotlin.collections.ArrayList
import kotlin.math.min
var watchflxCookies: Map<String, String>? = null
var filmxyCookies: Map<String,String>? = null
var filmxyCookies: Map<String, String>? = null
var sfServer: String? = null
val encodedIndex = arrayOf(
@ -131,6 +131,7 @@ fun String.filterMedia(title: String?, yearNum: Int?, seasonNum: Int?): Boolean
seasonNum > 1 -> this.contains(Regex("(?i)(Season\\s0?1-0?$seasonNum)|(S0?1-S?0?$seasonNum)")) && this.contains(
Regex("(?i)($fixTitle)|($title)")
)
else -> this.contains(Regex("(?i)(Season\\s0?1)|(S0?1)")) && this.contains(
Regex("(?i)($fixTitle)|($title)")
) && this.contains("$yearNum")
@ -449,22 +450,31 @@ suspend fun invokeSmashyFfix(
ref: String,
callback: (ExtractorLink) -> Unit,
) {
val res = app.get(url, referer = ref).text
val source = Regex("['\"]?file['\"]?:\\s*\"([^\"]+)").find(res)?.groupValues?.get(1) ?: return
val json = app.get(url, referer = ref, headers = mapOf("X-Requested-With" to "XMLHttpRequest"))
.parsedSafe<SmashySources>()
json?.sourceUrls?.map {
M3u8Helper.generateM3u8(
"Smashy [$name]",
it,
""
).forEach(callback)
}
source.split(",").map { links ->
val quality = Regex("\\[(\\S+)]").find(links)?.groupValues?.getOrNull(1)?.trim()
val link = links.removePrefix("[$quality]").trim()
callback.invoke(
ExtractorLink(
"Smashy [$name]",
"Smashy [$name]",
decode(link).replace("\\/", "/"),
smashyStreamAPI,
getQualityFromName(quality),
INFER_TYPE,
)
)
}
suspend fun invokeSmashyD(
url: String,
ref: String,
callback: (ExtractorLink) -> Unit,
) {
val json = app.get(url, referer = ref, headers = mapOf("X-Requested-With" to "XMLHttpRequest"))
.parsedSafe<SmashyDSources>()
json?.sourceUrls?.apmap {
M3u8Helper.generateM3u8(
"Smashy [Player D ${it.title}]",
it.file ?: return@apmap,
""
).forEach(callback)
}
}
@ -492,6 +502,7 @@ suspend fun getDumpIdAndType(title: String?, year: Int?, season: Int?): Pair<Str
true
) && it.releaseTime == "$year" && it.domainType == 0
}
1 -> {
it.name?.contains(
"$title",
@ -501,6 +512,7 @@ suspend fun getDumpIdAndType(title: String?, year: Int?, season: Int?): Pair<Str
true
)) && it.domainType == 1
}
else -> {
it.name?.contains(Regex("(?i)$title\\s?($season|${season.toRomanNumeral()}|Season\\s$season)")) == true && it.releaseTime == "$year" && it.domainType == 1
}
@ -536,9 +548,10 @@ suspend fun invokeDrivetot(
) {
val res = app.get(url)
val data = res.document.select("form input").associate { it.attr("name") to it.attr("value") }
app.post(res.url, data = data, cookies = res.cookies).document.select("div.card-body a").apmap { ele ->
app.post(res.url, data = data, cookies = res.cookies).document.select("div.card-body a")
.apmap { ele ->
val href = base64Decode(ele.attr("href").substringAfterLast("/")).let {
if(it.contains("hubcloud.lol")) it.replace("hubcloud.lol", "hubcloud.in") else it
if (it.contains("hubcloud.lol")) it.replace("hubcloud.lol", "hubcloud.in") else it
}
loadExtractor(href, "$hdmovies4uAPI/", subtitleCallback) { link ->
callback.invoke(
@ -773,10 +786,13 @@ suspend fun fetchSfServer(): String {
return app.get("https://raw.githubusercontent.com/hexated/cloudstream-resources/main/sfmovies_server").text
}
suspend fun getFilmxyCookies(url: String) = filmxyCookies ?: fetchFilmxyCookies(url).also { filmxyCookies = it }
suspend fun getFilmxyCookies(url: String) =
filmxyCookies ?: fetchFilmxyCookies(url).also { filmxyCookies = it }
suspend fun fetchFilmxyCookies(url: String): Map<String, String> {
val defaultCookies = mutableMapOf("G_ENABLED_IDPS" to "google", "true_checker" to "1", "XID" to "1")
val defaultCookies =
mutableMapOf("G_ENABLED_IDPS" to "google", "true_checker" to "1", "XID" to "1")
session.get(
url,
headers = mapOf(
@ -789,7 +805,10 @@ suspend fun fetchFilmxyCookies(url: String): Map<String, String> {
defaultCookies["PHPSESSID"] = phpsessid
val userNonce =
app.get("$filmxyAPI/login/?redirect_to=$filmxyAPI/", cookies = defaultCookies).document.select("script")
app.get(
"$filmxyAPI/login/?redirect_to=$filmxyAPI/",
cookies = defaultCookies
).document.select("script")
.find { it.data().contains("var userNonce") }?.data()?.let {
Regex("var\\suserNonce.*?\"(\\S+?)\";").find(it)?.groupValues?.get(1)
}
@ -813,7 +832,8 @@ suspend fun fetchFilmxyCookies(url: String): Map<String, String> {
return cookieJar.plus(defaultCookies)
}
suspend fun getWatchflxCookies() = watchflxCookies ?: fetchWatchflxCookies().also { watchflxCookies = it }
suspend fun getWatchflxCookies() =
watchflxCookies ?: fetchWatchflxCookies().also { watchflxCookies = it }
suspend fun fetchWatchflxCookies(): Map<String, String> {
session.get(watchflxAPI)
@ -825,7 +845,8 @@ suspend fun fetchWatchflxCookies(): Map<String, String> {
"continue_as_temp" to "true"
), cookies = cookies, headers = mapOf("X-Requested-With" to "XMLHttpRequest")
)
return session.baseClient.cookieJar.loadForRequest(loginUrl.toHttpUrl()).associate { it.name to it.value }
return session.baseClient.cookieJar.loadForRequest(loginUrl.toHttpUrl())
.associate { it.name to it.value }
}
fun Document.findTvMoviesIframe(): String? {
@ -1160,7 +1181,11 @@ fun String.decodePrimewireXor(key: String): String {
fun vidsrctoDecrypt(text: String): String {
val parse = Base64.decode(text.toByteArray(), Base64.URL_SAFE)
val cipher = Cipher.getInstance("RC4")
cipher.init(Cipher.DECRYPT_MODE, SecretKeySpec("8z5Ag5wgagfsOuhz".toByteArray(), "RC4"), cipher.parameters)
cipher.init(
Cipher.DECRYPT_MODE,
SecretKeySpec("8z5Ag5wgagfsOuhz".toByteArray(), "RC4"),
cipher.parameters
)
return decode(cipher.doFinal(parse).toString(Charsets.UTF_8))
}
@ -1300,7 +1325,7 @@ fun isUpcoming(dateString: String?): Boolean {
}
}
fun getDate() : TmdbDate {
fun getDate(): TmdbDate {
val formatter = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val calender = Calendar.getInstance()
val today = formatter.format(calender.time)