sora: fix filmxy

This commit is contained in:
hexated 2023-07-28 19:36:39 +07:00
parent 22e734f17d
commit 6fa564f9d3
3 changed files with 15 additions and 23 deletions

View file

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties
// use an integer for version numbers
version = 149
version = 150
android {
defaultConfig {

View file

@ -596,16 +596,16 @@ object SoraExtractor : SoraStream() {
} else {
"${filmxyAPI}/tv/$imdbId"
}
val filmxyCookies = getFilmxyCookies(imdbId, season)
val filmxyCookies = getFilmxyCookies(imdbId, season) ?: return
val cookiesDoc = mapOf(
val cookies = mapOf(
"G_ENABLED_IDPS" to "google",
"wordpress_logged_in_8bf9d5433ac88cc9a3a396d6b154cd01" to (filmxyCookies.wLog
?: return),
"PHPSESSID" to (filmxyCookies.phpsessid ?: return)
"wp-secure-id" to "${filmxyCookies.wpSec}",
"wp-guest-token" to "${filmxyCookies.wpGuest}",
"PHPSESSID" to "${filmxyCookies.phpsessid}"
)
val doc = session.get(url, cookies = cookiesDoc).document
val doc = session.get(url, cookies = cookies).document
val script = doc.selectFirst("script:containsData(var isSingle)")?.data() ?: return
val sourcesData =
@ -644,16 +644,9 @@ object SoraExtractor : SoraStream() {
"&linkIDs%5B%5D=$it"
}?.replace("\"", "")
val body = "action=get_vid_links$linkIDs&user_id=$userId&nonce=$userNonce".toRequestBody()
val cookiesJson = mapOf(
"G_ENABLED_IDPS" to "google",
"PHPSESSID" to "${filmxyCookies.phpsessid}",
"wordpress_logged_in_8bf9d5433ac88cc9a3a396d6b154cd01" to "${filmxyCookies.wLog}",
"wordpress_sec_8bf9d5433ac88cc9a3a396d6b154cd01" to "${filmxyCookies.wSec}"
)
val json = app.post(
"$filmxyAPI/wp-admin/admin-ajax.php",
requestBody = body,
requestBody = "action=get_vid_links$linkIDs&user_id=$userId&nonce=$userNonce".toRequestBody(),
referer = url,
headers = mapOf(
"Accept" to "*/*",
@ -662,7 +655,7 @@ object SoraExtractor : SoraStream() {
"Origin" to filmxyAPI,
"X-Requested-With" to "XMLHttpRequest",
),
cookies = cookiesJson
cookies = cookies
).text.let { tryParseJson<HashMap<String, String>>(it) }
sources?.map { source ->

View file

@ -107,8 +107,8 @@ val mimeType = arrayOf(
data class FilmxyCookies(
val phpsessid: String? = null,
val wLog: String? = null,
val wSec: String? = null,
val wpSec: String? = null,
val wpGuest: String? = null,
)
fun String.filterIframe(
@ -901,7 +901,7 @@ suspend fun getTvMoviesServer(url: String, season: Int?, episode: Int?): Pair<St
}
}
suspend fun getFilmxyCookies(imdbId: String? = null, season: Int? = null): FilmxyCookies {
suspend fun getFilmxyCookies(imdbId: String? = null, season: Int? = null): FilmxyCookies? {
val url = if (season == null) {
"${filmxyAPI}/movie/$imdbId"
@ -941,11 +941,10 @@ suspend fun getFilmxyCookies(imdbId: String? = null, season: Int? = null): Filmx
val cookieJar = session.baseClient.cookieJar.loadForRequest(cookieUrl.toHttpUrl())
phpsessid = cookieJar.first { it.name == "PHPSESSID" }.value
val wLog =
cookieJar.first { it.name == "wordpress_logged_in_8bf9d5433ac88cc9a3a396d6b154cd01" }.value
val wSec = cookieJar.first { it.name == "wordpress_sec_8bf9d5433ac88cc9a3a396d6b154cd01" }.value
val wpSec = cookieJar.first { it.name == "wp-secure-id" }.value
val wpGuest = cookieJar.first { it.name == "wp-guest-token" }.value
return FilmxyCookies(phpsessid, wLog, wSec)
return FilmxyCookies(phpsessid, wpSec, wpGuest)
}
fun Document.findTvMoviesIframe(): String? {