[Sora] Updated Home

This commit is contained in:
hexated 2022-12-03 16:27:19 +07:00
parent 5b55117250
commit a43e1f68d5
3 changed files with 17 additions and 31 deletions

View file

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

View file

@ -359,25 +359,20 @@ object SoraExtractor : SoraStream() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val fixTitle = title.fixTitle() val fixTitle = title.fixTitle()
val url = "$hdMovieBoxAPI/watch/$fixTitle" val request = app.get("$hdMovieBoxAPI/watch/$fixTitle")
// val ref = if (season == null) { if (!request.isSuccessful) return
// "$hdMovieBoxAPI/watch/$fixTitle" val doc = request.document
// } else {
// "$hdMovieBoxAPI/watch/$fixTitle/season-$season/episode-$episode"
// }
val doc = app.get(url).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 {
doc.select("div.season-list-column div[data-season=$season] div.list div.item")[episode?.minus( doc.select("div.season-list-column div[data-season=$season] div.list div.item")[episode?.minus(
1 1
) ?: 0].selectFirst("div.ui.checkbox")?.attr("data-episode") ) ?: 0].selectFirst("div.ui.checkbox")?.attr("data-episode")
} } ?: return
val iframeUrl = app.post( val iframeUrl = app.post(
"$hdMovieBoxAPI/ajax/service", data = mapOf( "$hdMovieBoxAPI/ajax/service", data = mapOf(
"e_id" to "$id", "e_id" to id,
"v_lang" to "en", "v_lang" to "en",
"type" to "get_whatwehave", "type" to "get_whatwehave",
), headers = mapOf("X-Requested-With" to "XMLHttpRequest") ), headers = mapOf("X-Requested-With" to "XMLHttpRequest")
@ -1231,25 +1226,15 @@ object SoraExtractor : SoraStream() {
.filter { it.text().filterIframe(season, year) } .filter { it.text().filterIframe(season, year) }
.mapNotNull { .mapNotNull {
if (season == null) { if (season == null) {
Triple( it.text() to it.nextElementSibling()?.select("a")?.attr("href")
it.text(),
it.selectFirst("span")?.text() ?: it.select("strong").last()?.text()
?: "",
it.nextElementSibling()?.select("a")?.attr("href")
)
} else { } else {
Triple( it.text() to it.nextElementSibling()?.select("a:contains(Episode $episode)")
it.text(), ?.attr("href")
it.selectFirst("span")?.text() ?: it.select("strong").last()?.text()
?: "",
it.nextElementSibling()?.select("a:contains(Episode $episode)")
?.attr("href")
)
} }
}.filter { it.third?.contains(Regex("(https:)|(http:)")) == true } }.filter { it.second?.contains(Regex("(https:)|(http:)")) == true }
val base = getBaseUrl(iframe.first().third ?: return) val base = getBaseUrl(iframe.first().second ?: return)
iframe.apmap { (quality, size, link) -> iframe.apmap { (quality, link) ->
delay(2000) delay(2000)
val res = app.get(link ?: return@apmap null).document val res = app.get(link ?: return@apmap null).document
val resDoc = res.selectFirst("script")?.data()?.substringAfter("replace(\"") val resDoc = res.selectFirst("script")?.data()?.substringAfter("replace(\"")
@ -1279,12 +1264,12 @@ object SoraExtractor : SoraStream() {
val videoQuality = val videoQuality =
Regex("(\\d{3,4})p").find(quality)?.groupValues?.getOrNull(1)?.toIntOrNull() Regex("(\\d{3,4})p").find(quality)?.groupValues?.getOrNull(1)?.toIntOrNull()
?: Qualities.Unknown.value ?: Qualities.Unknown.value
val videoSize = val size = Regex("(?i)\\[(\\S+\\s?gb|mb)[]/]").find(quality)?.groupValues?.getOrNull(1)
size.substringBeforeLast("/").let { if (it.contains("[")) it else "[$it]" } ?.let { "[$it]" } ?: quality
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
"UHDMovies $videoSize", "UHDMovies $size",
"UHDMovies $videoSize", "UHDMovies $size",
downloadLink ?: return@apmap null, downloadLink ?: return@apmap null,
"", "",
videoQuality videoQuality

View file

@ -109,6 +109,7 @@ open class SoraStream : TmdbProvider() {
"$tmdbAPI/movie/top_rated?api_key=$apiKey&region=&page=" to "Top Rated Movies", "$tmdbAPI/movie/top_rated?api_key=$apiKey&region=&page=" to "Top Rated Movies",
"$tmdbAPI/tv/top_rated?api_key=$apiKey&region=&page=" to "Top Rated TV Shows", "$tmdbAPI/tv/top_rated?api_key=$apiKey&region=&page=" to "Top Rated TV Shows",
"$tmdbAPI/movie/upcoming?api_key=$apiKey&region=&page=" to "Upcoming Movies", "$tmdbAPI/movie/upcoming?api_key=$apiKey&region=&page=" to "Upcoming Movies",
"$tmdbAPI/discover/tv?api_key=$apiKey&with_original_language=ko&page=" to "Korean Shows",
"$tmdbAPI/discover/tv?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime", "$tmdbAPI/discover/tv?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime",
"$tmdbAPI/discover/movie?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime Movies", "$tmdbAPI/discover/movie?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime Movies",
) )