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 import org.jetbrains.kotlin.konan.properties.Properties
// use an integer for version numbers // use an integer for version numbers
version = 149 version = 150
android { android {
defaultConfig { defaultConfig {

View file

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

View file

@ -107,8 +107,8 @@ val mimeType = arrayOf(
data class FilmxyCookies( data class FilmxyCookies(
val phpsessid: String? = null, val phpsessid: String? = null,
val wLog: String? = null, val wpSec: String? = null,
val wSec: String? = null, val wpGuest: String? = null,
) )
fun String.filterIframe( 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) { val url = if (season == null) {
"${filmxyAPI}/movie/$imdbId" "${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()) val cookieJar = session.baseClient.cookieJar.loadForRequest(cookieUrl.toHttpUrl())
phpsessid = cookieJar.first { it.name == "PHPSESSID" }.value phpsessid = cookieJar.first { it.name == "PHPSESSID" }.value
val wLog = val wpSec = cookieJar.first { it.name == "wp-secure-id" }.value
cookieJar.first { it.name == "wordpress_logged_in_8bf9d5433ac88cc9a3a396d6b154cd01" }.value val wpGuest = cookieJar.first { it.name == "wp-guest-token" }.value
val wSec = cookieJar.first { it.name == "wordpress_sec_8bf9d5433ac88cc9a3a396d6b154cd01" }.value
return FilmxyCookies(phpsessid, wLog, wSec) return FilmxyCookies(phpsessid, wpSec, wpGuest)
} }
fun Document.findTvMoviesIframe(): String? { fun Document.findTvMoviesIframe(): String? {