Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjohn committed Dec 8, 2023
1 parent 21947a3 commit 1922d6d
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 50 deletions.
14 changes: 6 additions & 8 deletions SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
9 changes: 9 additions & 0 deletions SoraStream/src/main/kotlin/com/hexated/SoraParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,13 @@ data class RidoSearch(
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,
)
2 changes: 1 addition & 1 deletion SoraStream/src/main/kotlin/com/hexated/SoraStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ open class SoraStream : TmdbProvider() {
},
{
if (!res.isAnime) invokeSmashyStream(
res.id,
res.imdbId,
res.season,
res.episode,
subtitleCallback,
Expand Down
2 changes: 1 addition & 1 deletion SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class SoraStreamLite : SoraStream() {
},
{
if (!res.isAnime) invokeSmashyStream(
res.id,
res.imdbId,
res.season,
res.episode,
subtitleCallback,
Expand Down
105 changes: 65 additions & 40 deletions SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
}

}
Expand Down Expand Up @@ -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",
Expand All @@ -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
}
Expand Down Expand Up @@ -536,25 +548,26 @@ 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 ->
val href = base64Decode(ele.attr("href").substringAfterLast("/")).let {
if(it.contains("hubcloud.lol")) it.replace("hubcloud.lol", "hubcloud.in") else it
}
loadExtractor(href, "$hdmovies4uAPI/", subtitleCallback) { link ->
callback.invoke(
ExtractorLink(
link.source,
"${link.name} $tags [$size]",
link.url,
link.referer,
link.quality,
link.type,
link.headers,
link.extractorData
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
}
loadExtractor(href, "$hdmovies4uAPI/", subtitleCallback) { link ->
callback.invoke(
ExtractorLink(
link.source,
"${link.name} $tags [$size]",
link.url,
link.referer,
link.quality,
link.type,
link.headers,
link.extractorData
)
)
)
}
}
}
}

suspend fun bypassBqrecipes(url: String): String? {
Expand Down Expand Up @@ -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(
Expand All @@ -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)
}
Expand All @@ -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)
Expand All @@ -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? {
Expand Down Expand Up @@ -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))
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1922d6d

Please sign in to comment.