small fix for Filmxy

This commit is contained in:
hexated 2022-11-10 12:06:59 +07:00
parent e6e67935d4
commit 16aeed36b7

View file

@ -643,12 +643,12 @@ object SoraExtractor : SoraStream() {
} else { } else {
"${filmxyAPI}/tv/$imdbId" "${filmxyAPI}/tv/$imdbId"
} }
val filmxyCookies = getFilmxyCookies(imdbId, season) val filmxyCookies = getFilmxyCookies(imdbId, season) ?: throw ErrorLoadingException("No Cookies Found")
val cookiesDoc = mapOf( val cookiesDoc = mapOf(
"G_ENABLED_IDPS" to "google", "G_ENABLED_IDPS" to "google",
"wordpress_logged_in_8bf9d5433ac88cc9a3a396d6b154cd01" to filmxyCookies.wLog, "wordpress_logged_in_8bf9d5433ac88cc9a3a396d6b154cd01" to "${filmxyCookies.wLog}",
"PHPSESSID" to filmxyCookies.phpsessid "PHPSESSID" to "${filmxyCookies.phpsessid}"
) )
val request = session.get(url, cookies = cookiesDoc) val request = session.get(url, cookies = cookiesDoc)
@ -681,9 +681,9 @@ object SoraExtractor : SoraStream() {
val body = "action=get_vid_links$linkIDs&user_id=$userId&nonce=$userNonce".toRequestBody() val body = "action=get_vid_links$linkIDs&user_id=$userId&nonce=$userNonce".toRequestBody()
val cookiesJson = mapOf( val cookiesJson = mapOf(
"G_ENABLED_IDPS" to "google", "G_ENABLED_IDPS" to "google",
"PHPSESSID" to filmxyCookies.phpsessid, "PHPSESSID" to "${filmxyCookies.phpsessid}",
"wordpress_logged_in_8bf9d5433ac88cc9a3a396d6b154cd01" to filmxyCookies.wLog, "wordpress_logged_in_8bf9d5433ac88cc9a3a396d6b154cd01" to "${filmxyCookies.wLog}",
"wordpress_sec_8bf9d5433ac88cc9a3a396d6b154cd01" to filmxyCookies.wSec "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",
@ -852,12 +852,12 @@ object SoraExtractor : SoraStream() {
} }
data class FilmxyCookies( data class FilmxyCookies(
val phpsessid: String, val phpsessid: String? = null,
val wLog: String, val wLog: String? = null,
val wSec: String, val wSec: String? = null,
) )
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"
@ -873,6 +873,8 @@ suspend fun getFilmxyCookies(imdbId: String? = null, season: Int? = null): Filmx
), ),
) )
if(!res.isSuccessful) return FilmxyCookies()
val userNonce = val userNonce =
res.document.select("script").find { it.data().contains("var userNonce") }?.data()?.let { res.document.select("script").find { it.data().contains("var userNonce") }?.data()?.let {
Regex("var\\suserNonce.*?\"(\\S+?)\";").find(it)?.groupValues?.get(1) Regex("var\\suserNonce.*?\"(\\S+?)\";").find(it)?.groupValues?.get(1)