sora: added moment

This commit is contained in:
hexated 2023-07-29 04:41:04 +07:00
parent b9bcf80c2a
commit 36c6022afa
5 changed files with 46 additions and 35 deletions

View File

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

View File

@ -596,16 +596,8 @@ object SoraExtractor : SoraStream() {
} else {
"${filmxyAPI}/tv/$imdbId"
}
val filmxyCookies = getFilmxyCookies(imdbId, season) ?: return
val cookies = mapOf(
"G_ENABLED_IDPS" to "google",
"wp-secure-id" to "${filmxyCookies.wpSec}",
"wp-guest-token" to "${filmxyCookies.wpGuest}",
"PHPSESSID" to "${filmxyCookies.phpsessid}"
)
val doc = session.get(url, cookies = cookies).document
val filmxyCookies = getFilmxyCookies(imdbId, season)
val doc = session.get(url, cookies = filmxyCookies).document
val script = doc.selectFirst("script:containsData(var isSingle)")?.data() ?: return
val sourcesData =
@ -655,7 +647,7 @@ object SoraExtractor : SoraStream() {
"Origin" to filmxyAPI,
"X-Requested-With" to "XMLHttpRequest",
),
cookies = cookies
cookies = filmxyCookies
).text.let { tryParseJson<HashMap<String, String>>(it) }
sources?.map { source ->
@ -3109,18 +3101,39 @@ object SoraExtractor : SoraStream() {
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
) {
invokeHindi(navyAPI, navyAPI, imdbId, season, episode, callback)
}
suspend fun invokeMoment(
imdbId: String? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
) {
invokeHindi(momentAPI, "https://hdmovies4u.green", imdbId, season, episode, callback)
}
private suspend fun invokeHindi(
host: String? = null,
referer: String? = null,
imdbId: String? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit,
) {
val res = app.get(
"$navyAPI/play/$imdbId",
referer = "$navyAPI/"
"$host/play/$imdbId",
referer = "$referer/"
).document.selectFirst("script:containsData(player =)")?.data()?.substringAfter("{")
?.substringBefore(";")?.substringBefore(")")
val json = tryParseJson<NavyPlaylist>("{${res ?: return}")
val headers = mapOf(
"X-CSRF-TOKEN" to "${json?.key}"
)
val serverRes = app.get(
fixUrl(json?.file ?: return, navyAPI), headers = headers, referer = "$navyAPI/"
fixUrl(json?.file ?: return, navyAPI), headers = headers, referer = "$referer/"
).text.replace(Regex(""",\s*\[]"""), "")
val server = tryParseJson<ArrayList<NavyServer>>(serverRes).let { server ->
if (season == null) {
@ -3135,15 +3148,15 @@ object SoraExtractor : SoraStream() {
}
val path = app.post(
"${navyAPI}/playlist/${server ?: return}.txt",
"${host}/playlist/${server ?: return}.txt",
headers = headers,
referer = "$navyAPI/"
referer = "$referer/"
).text
M3u8Helper.generateM3u8(
"Navy",
if(host == navyAPI) "Navy" else "Moment",
path,
"${navyAPI}/"
"${referer}/"
).forEach(callback)
}

View File

@ -50,6 +50,7 @@ import com.hexated.SoraExtractor.invokeSmashyStream
import com.hexated.SoraExtractor.invokeDumpStream
import com.hexated.SoraExtractor.invokeEmovies
import com.hexated.SoraExtractor.invokeFourCartoon
import com.hexated.SoraExtractor.invokeMoment
import com.hexated.SoraExtractor.invokeMultimovies
import com.hexated.SoraExtractor.invokeNetmovies
import com.hexated.SoraExtractor.invokePobmovies
@ -135,6 +136,7 @@ open class SoraStream : TmdbProvider() {
const val fourCartoonAPI = "https://4cartoon.net"
const val multimoviesAPI = "https://multimovies.xyz"
const val netmoviesAPI = "https://netmovies.to"
const val momentAPI = "https://moment-explanation-i-244.site"
// INDEX SITE
const val blackMoviesAPI = "https://dl.blacklistedbois.workers.dev/0:"
@ -835,6 +837,9 @@ open class SoraStream : TmdbProvider() {
{
invokeNavy(res.imdbId, res.season, res.episode, callback)
},
{
invokeMoment(res.imdbId, res.season, res.episode, callback)
},
{
if (!res.isAnime) invokeEmovies(
res.title,

View File

@ -29,6 +29,7 @@ import com.hexated.SoraExtractor.invokeSmashyStream
import com.hexated.SoraExtractor.invokeDumpStream
import com.hexated.SoraExtractor.invokeEmovies
import com.hexated.SoraExtractor.invokeFourCartoon
import com.hexated.SoraExtractor.invokeMoment
import com.hexated.SoraExtractor.invokeMultimovies
import com.hexated.SoraExtractor.invokeNetmovies
import com.hexated.SoraExtractor.invokeVidSrc
@ -345,7 +346,10 @@ class SoraStreamLite : SoraStream() {
subtitleCallback,
callback
)
}
},
{
invokeMoment(res.imdbId, res.season, res.episode, callback)
},
)
return true

View File

@ -105,12 +105,6 @@ val mimeType = arrayOf(
"video/x-msvideo"
)
data class FilmxyCookies(
val phpsessid: String? = null,
val wpSec: String? = null,
val wpGuest: String? = null,
)
fun String.filterIframe(
seasonNum: Int? = null,
lastSeason: Int? = null,
@ -901,7 +895,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): Map<String,String> {
val url = if (season == null) {
"${filmxyAPI}/movie/$imdbId"
@ -917,7 +911,7 @@ suspend fun getFilmxyCookies(imdbId: String? = null, season: Int? = null): Filmx
),
)
if (!res.isSuccessful) return FilmxyCookies()
if (!res.isSuccessful) return emptyMap()
val userNonce =
res.document.select("script").find { it.data().contains("var userNonce") }?.data()?.let {
@ -938,13 +932,8 @@ suspend fun getFilmxyCookies(imdbId: String? = null, season: Int? = null): Filmx
"X-Requested-With" to "XMLHttpRequest",
)
)
val cookieJar = session.baseClient.cookieJar.loadForRequest(cookieUrl.toHttpUrl())
phpsessid = cookieJar.first { it.name == "PHPSESSID" }.value
val wpSec = cookieJar.first { it.name == "wp-secure-id" }.value
val wpGuest = cookieJar.first { it.name == "wp-guest-token" }.value
return FilmxyCookies(phpsessid, wpSec, wpGuest)
val cookieJar = session.baseClient.cookieJar.loadForRequest(cookieUrl.toHttpUrl()).associate { it.name to it.value }.toMutableMap()
return cookieJar.plus(mapOf("G_ENABLED_IDPS" to "google"))
}
fun Document.findTvMoviesIframe(): String? {