sora: fixed HDMovieBox

This commit is contained in:
hexated 2023-03-28 10:45:16 +07:00
parent c7da0fd1ab
commit 672c540608
4 changed files with 76 additions and 58 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 107 version = 108
cloudstream { cloudstream {

View file

@ -255,9 +255,8 @@ object SoraExtractor : SoraStream() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val fixTitle = title.createSlug() val fixTitle = title.createSlug()
val request = app.get("$hdMovieBoxAPI/watch/$fixTitle") val url = "$hdMovieBoxAPI/watch/$fixTitle"
if (!request.isSuccessful) return val doc = app.get(url).document
val doc = request.document
val id = if (season == null) { val id = if (season == null) {
doc.selectFirst("div.player div#not-loaded")?.attr("data-whatwehave") doc.selectFirst("div.player div#not-loaded")?.attr("data-whatwehave")
} else { } else {
@ -274,44 +273,64 @@ object SoraExtractor : SoraStream() {
), headers = mapOf("X-Requested-With" to "XMLHttpRequest") ), headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).parsedSafe<HdMovieBoxIframe>()?.apiIframe ?: return ).parsedSafe<HdMovieBoxIframe>()?.apiIframe ?: return
val iframe = app.get(iframeUrl, referer = "$hdMovieBoxAPI/").document.selectFirst("iframe") delay(1000)
?.attr("src") val iframe = app.get(iframeUrl, referer = url).document.selectFirst("iframe")
val base = getBaseUrl(iframe ?: return) ?.attr("src").let { httpsify(it ?: return) }
val script = app.get( if(iframe.startsWith("https://vidmoly.to")) {
iframe, referer = "$hdMovieBoxAPI/" loadExtractor(iframe, "$hdMovieBoxAPI/", subtitleCallback) { video ->
).document.selectFirst("script:containsData(var vhash =)")?.data() callback.invoke(
?.substringAfter("vhash, {")?.substringBefore("}, false") ExtractorLink(
video.name,
tryParseJson<HdMovieBoxSource>("{$script}").let { source -> video.name,
val disk = if (source?.videoDisk == null) { video.url,
"" video.referer,
} else { Qualities.P1080.value,
base64Encode(source.videoDisk.toString().toByteArray()) video.isM3u8,
} video.headers,
val link = getBaseUrl(iframe) + source?.videoUrl?.replace( video.extractorData
"\\", ""
) + "?s=${source?.videoServer}&d=$disk"
callback.invoke(
ExtractorLink(
"HDMovieBox",
"HDMovieBox",
link,
iframe,
Qualities.P1080.value,
isM3u8 = true,
)
)
source?.tracks?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
sub.label ?: "",
fixUrl(sub.file ?: return@map null, base),
) )
) )
} }
} else {
val base = getBaseUrl(iframe)
val script = app.get(
httpsify(iframe), referer = "$hdMovieBoxAPI/"
).document.selectFirst("script:containsData(var vhash =)")?.data()
?.substringAfter("vhash, {")?.substringBefore("}, false")
tryParseJson<HdMovieBoxSource>("{$script}").let { source ->
val disk = if (source?.videoDisk == null) {
""
} else {
base64Encode(source.videoDisk.toString().toByteArray())
}
val link = getBaseUrl(iframe) + source?.videoUrl?.replace(
"\\", ""
) + "?s=${source?.videoServer}&d=$disk"
callback.invoke(
ExtractorLink(
"HDMovieBox",
"HDMovieBox",
link,
iframe,
Qualities.P1080.value,
isM3u8 = true,
)
)
source?.tracks?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
sub.label ?: "",
fixUrl(sub.file ?: return@map null, base),
)
)
}
}
} }
} }
suspend fun invokeSeries9( suspend fun invokeSeries9(
@ -639,7 +658,6 @@ object SoraExtractor : SoraStream() {
if (iframe.isNotEmpty()) { if (iframe.isNotEmpty()) {
loadExtractor(iframe, "$kimcartoonAPI/", subtitleCallback, callback) loadExtractor(iframe, "$kimcartoonAPI/", subtitleCallback, callback)
} }
//There are other servers, but they require some work to do
} }
} }
} }

View file

@ -450,16 +450,16 @@ open class SoraStream : TmdbProvider() {
{ {
invokeNoverse(res.title, res.season, res.episode, callback) invokeNoverse(res.title, res.season, res.episode, callback)
}, },
{ // {
invokeUniqueStream( // invokeUniqueStream(
res.title, // res.title,
res.year, // res.year,
res.season, // res.season,
res.episode, // res.episode,
subtitleCallback, // subtitleCallback,
callback // callback
) // )
}, // },
{ {
if (!res.isAnime) invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback) if (!res.isAnime) invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback)
}, },

View file

@ -138,16 +138,16 @@ class SoraStreamLite : SoraStream() {
callback callback
) )
}, },
{ // {
invokeUniqueStream( // invokeUniqueStream(
res.title, // res.title,
res.year, // res.year,
res.season, // res.season,
res.episode, // res.episode,
subtitleCallback, // subtitleCallback,
callback // callback
) // )
}, // },
{ {
if (!res.isAnime) invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback) if (!res.isAnime) invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback)
}, },