This commit is contained in:
alex 2024-01-03 07:04:36 +07:00
parent 29c78d2468
commit 76c58dbfc3

View file

@ -9,7 +9,6 @@ import com.hexated.SoraStream.Companion.gdbot
import com.hexated.SoraStream.Companion.hdmovies4uAPI import com.hexated.SoraStream.Companion.hdmovies4uAPI
import com.hexated.SoraStream.Companion.malsyncAPI import com.hexated.SoraStream.Companion.malsyncAPI
import com.hexated.SoraStream.Companion.tvMoviesAPI import com.hexated.SoraStream.Companion.tvMoviesAPI
import com.hexated.SoraStream.Companion.watchflxAPI
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
import com.lagradost.cloudstream3.APIHolder.unixTimeMS import com.lagradost.cloudstream3.APIHolder.unixTimeMS
@ -46,7 +45,6 @@ import javax.crypto.spec.SecretKeySpec
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
import kotlin.math.min 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 var sfServer: String? = null
@ -711,23 +709,6 @@ suspend fun fetchFilmxyCookies(url: String): Map<String, String> {
return cookieJar.plus(defaultCookies) return cookieJar.plus(defaultCookies)
} }
suspend fun getWatchflxCookies() =
watchflxCookies ?: fetchWatchflxCookies().also { watchflxCookies = it }
suspend fun fetchWatchflxCookies(): Map<String, String> {
session.get(watchflxAPI)
val cookies = session.baseClient.cookieJar.loadForRequest(watchflxAPI.toHttpUrl())
.associate { it.name to it.value }
val loginUrl = "$watchflxAPI/cookie-based-login"
session.post(
loginUrl, data = mapOf(
"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 }
}
fun Document.findTvMoviesIframe(): String? { fun Document.findTvMoviesIframe(): String? {
return this.selectFirst("script:containsData(var seconds)")?.data()?.substringAfter("href='") return this.selectFirst("script:containsData(var seconds)")?.data()?.substringAfter("href='")
?.substringBefore("'>") ?.substringBefore("'>")