sora: fix WatchOnline

This commit is contained in:
hexated 2023-09-10 13:12:57 +07:00
parent dd612e12bc
commit 972277a109
2 changed files with 38 additions and 44 deletions

View file

@ -31,10 +31,10 @@ open class Playm4u : ExtractorApi() {
val pass = passScript.substringAfter("CryptoJS.MD5('").substringBefore("')") val pass = passScript.substringAfter("CryptoJS.MD5('").substringBefore("')")
val amount = passScript.substringAfter(".toString()), ").substringBefore("));").toInt() val amount = passScript.substringAfter(".toString()), ").substringBefore("));").toInt()
val idFile = "idfile\\s*=\\s*[\"'](\\S+)[\"'];".findIn(script) val idFile = "idfile".findIn(script)
val idUser = "idUser\\s*=\\s*[\"'](\\S+)[\"'];".findIn(script) val idUser = "idUser".findIn(script)
val domainApi = "DOMAIN_API\\s*=\\s*[\"'](\\S+)[\"'];".findIn(script) val domainApi = "DOMAIN_API".findIn(script)
val nameKeyV3 = "NameKeyV3\\s*=\\s*[\"'](\\S+)[\"'];".findIn(script) val nameKeyV3 = "NameKeyV3".findIn(script)
val dataEnc = caesarShift( val dataEnc = caesarShift(
mahoa( mahoa(
"Win32|$idUser|$idFile|$referer", "Win32|$idUser|$idFile|$referer",
@ -117,7 +117,7 @@ open class Playm4u : ExtractorApi() {
} }
private fun String.findIn(data: String): String { private fun String.findIn(data: String): String {
return this.toRegex().find(data)?.groupValues?.get(1) ?: "" return "$this\\s*=\\s*[\"'](\\S+)[\"'];".toRegex().find(data)?.groupValues?.get(1) ?: ""
} }
private fun String.toLanguage() : String { private fun String.toLanguage() : String {

View file

@ -2443,7 +2443,6 @@ object SoraExtractor : SoraStream() {
var res = app.get(url) var res = app.get(url)
if (res.code == 403) return if (res.code == 403) return
if (!res.isSuccessful) res = searchWatchOnline(title, season, imdbId, tmdbId) ?: return if (!res.isSuccessful) res = searchWatchOnline(title, season, imdbId, tmdbId) ?: return
val doc = res.document val doc = res.document
val episodeId = if (season == null) { val episodeId = if (season == null) {
doc.selectFirst("div.movie__buttons-items a")?.attr("data-watch-list-media-id") doc.selectFirst("div.movie__buttons-items a")?.attr("data-watch-list-media-id")
@ -2452,7 +2451,11 @@ object SoraExtractor : SoraStream() {
it.select("div.episodes__number").text().equals("Episode $episode", true) it.select("div.episodes__number").text().equals("Episode $episode", true)
}?.attr("data-id-episode") }?.attr("data-id-episode")
} ?: return } ?: return
argamap(
{
invokeMonster(res.url.substringAfterLast("/"), episodeId, season, callback)
},
{
val videoUrl = if (season == null) { val videoUrl = if (season == null) {
"$watchOnlineAPI/api/v1/security/movie-access?id_movie=$episodeId" "$watchOnlineAPI/api/v1/security/movie-access?id_movie=$episodeId"
} else { } else {
@ -2473,14 +2476,6 @@ object SoraExtractor : SoraStream() {
) )
) )
} }
argamap(
{
invokeMonster(
res.url.substringAfterLast("/"), episodeId, season, callback
)
},
{
val subtitles = json?.subtitles as ArrayList<HashMap<String, String>> val subtitles = json?.subtitles as ArrayList<HashMap<String, String>>
subtitles.map { sub -> subtitles.map { sub ->
subtitleCallback.invoke( subtitleCallback.invoke(
@ -2490,7 +2485,8 @@ object SoraExtractor : SoraStream() {
) )
) )
} }
}) }
)
} }
@ -2500,19 +2496,17 @@ object SoraExtractor : SoraStream() {
season: Int? = null, season: Int? = null,
callback: (ExtractorLink) -> Unit, callback: (ExtractorLink) -> Unit,
) { ) {
val monsterMainUrl = "https://mobirs.monster" val monsterMainUrl = "https://lookmovie.foundation"
val playSlug = if (season == null) { val viewSlug = if (season == null) {
"movies/play/$urlSlug" "movies/view/$urlSlug"
} else { } else {
"shows/play/$urlSlug" "shows/view/$urlSlug"
} }
val sid = "9k9iupt5sebbnfajrc6ti3ht7l" val streamUrl = app.get("$monsterMainUrl/$viewSlug").document.select("a.round-button:first-child").attr("href")
val sec = "1974bc4a902c4d69fcbab261dcec69094a9b8164" val res = app.get(streamUrl).document
val url = val script = res.selectFirst("script:containsData(hash:)")?.data()
"$monsterMainUrl/$playSlug?mid=1&sid=$sid&sec=$sec&t=${System.currentTimeMillis()}" val hash =
val res = app.get(url).document Regex("hash:\\s*['\"](\\S+)['\"],").find(script ?: return)?.groupValues?.get(1)
val script = res.selectFirst("script:containsData(window['show_storage'])")?.data()
val hash = Regex("hash:\\s*['\"](\\S+)['\"],").find(script ?: return)?.groupValues?.get(1)
val expires = Regex("expires:\\s*(\\d+),").find(script)?.groupValues?.get(1) val expires = Regex("expires:\\s*(\\d+),").find(script)?.groupValues?.get(1)
val videoUrl = if (season == null) { val videoUrl = if (season == null) {
@ -2521,7 +2515,7 @@ object SoraExtractor : SoraStream() {
"$monsterMainUrl/api/v1/security/episode-access?id_episode=$episodeId&hash=$hash&expires=$expires" "$monsterMainUrl/api/v1/security/episode-access?id_episode=$episodeId&hash=$hash&expires=$expires"
} }
app.get(videoUrl, referer = url) app.get(videoUrl, referer = streamUrl)
.parsedSafe<WatchOnlineResponse>()?.streams?.mapKeys { source -> .parsedSafe<WatchOnlineResponse>()?.streams?.mapKeys { source ->
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(