From 285eb25bc8e4c92f90ff22e121bcc9db1edab8df Mon Sep 17 00:00:00 2001 From: hexated Date: Tue, 17 Jan 2023 10:55:16 +0700 Subject: [PATCH] [Sora] added 123Movies --- SoraStream/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/SoraExtractor.kt | 95 ++++++++++++++++++- .../src/main/kotlin/com/hexated/SoraStream.kt | 5 + .../kotlin/com/hexated/SoraStreamPlugin.kt | 1 + 4 files changed, 101 insertions(+), 2 deletions(-) diff --git a/SoraStream/build.gradle.kts b/SoraStream/build.gradle.kts index 3f6a9aa3..fff4c418 100644 --- a/SoraStream/build.gradle.kts +++ b/SoraStream/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 73 +version = 74 cloudstream { diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 289891f1..78515e68 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -7,6 +7,7 @@ import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.nicehttp.Requests import com.lagradost.nicehttp.Session import com.google.gson.JsonParser +import com.lagradost.cloudstream3.extractors.StreamSB import com.lagradost.cloudstream3.extractors.XStreamCdn import com.lagradost.cloudstream3.network.CloudflareKiller import com.lagradost.nicehttp.RequestBodyTypes @@ -983,7 +984,6 @@ object SoraExtractor : SoraStream() { ).apmap { server -> val sources = app.get( "$consumetFlixhqAPI/watch?episodeId=$episodeId&mediaId=$id&server=$server", - timeout = 120L ).parsedSafe() val name = fixTitle(server) sources?.sources?.map { @@ -1925,6 +1925,81 @@ object SoraExtractor : SoraStream() { } + suspend fun invokeMovie123( + title: String? = null, + season: Int? = null, + episode: Int? = null, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit, + ) { + val server = "https://vidcloud9.org" + val fixTitle = title.fixTitle() + val m = app.get("$movie123NetAPI/searching?q=$title&limit=40") + .parsedSafe()?.data?.find { + if (season == null) { + (it.t.equals(title, true) || it.t.fixTitle() + .equals(fixTitle)) && it.t?.contains("season", true) == false + } else { + it.t?.equals( + "$title - Season $season", + true + ) == true || it.s?.contains("$fixTitle-season-$season", true) == true + } + }?.s?.substringAfterLast("-") ?: return + + listOf( + "1", + "2" + ).apmap { serverNum -> + val media = app.post( + "$movie123NetAPI/datas", + requestBody = """{"m":$m,"e":${episode ?: 1},"s":$serverNum}""".toRequestBody( + RequestBodyTypes.JSON.toMediaTypeOrNull() + ) + ).parsedSafe()?.url ?: return@apmap null + + val serverUrl = "$server/watch?v=$media" + val token = + app.get(serverUrl).document.selectFirst("script:containsData(setRequestHeader)") + ?.data()?.let { + Regex("\\('0x1f2'\\),'(\\S+?)'\\)").find(it)?.groupValues?.getOrNull(1) + } ?: return@apmap null + + val videoUrl = app.post( + "$server/data", + requestBody = """{"doc":"$media"}""".toRequestBody( + RequestBodyTypes.JSON.toMediaTypeOrNull() + ), + headers = mapOf( + "x-csrf-token" to token + ), + ).parsedSafe()?.url ?: return@apmap null + + if (videoUrl.startsWith("https")) { + loadExtractor(videoUrl, movie123NetAPI, subtitleCallback, callback) + } else { + callback.invoke( + ExtractorLink( + "123Movies", + "123Movies", + fixUrl(base64Decode(videoUrl), server), + serverUrl, + Qualities.P720.value, + true + ) + ) + + subtitleCallback.invoke( + SubtitleFile( + "English", + "https://sub.vxdn.net/sub/$m-${episode ?: 1}.vtt" + ) + ) + } + } + + } + } class StreamM4u : XStreamCdn() { @@ -1932,6 +2007,11 @@ class StreamM4u : XStreamCdn() { override val mainUrl: String = "https://streamm4u.club" } +class Sblongvu : StreamSB() { + override var name = "Sblongvu" + override var mainUrl = "https://sblongvu.com" +} + data class FDMovieIFrame( val link: String, val quality: String, @@ -1939,6 +2019,19 @@ data class FDMovieIFrame( val type: String, ) +data class Movie123Media( + @JsonProperty("url") val url: String? = null, +) + +data class Movie123Data( + @JsonProperty("t") val t: String? = null, + @JsonProperty("s") val s: String? = null, +) + +data class Movie123Search( + @JsonProperty("data") val data: ArrayList? = arrayListOf(), +) + data class UHDBackupUrl( @JsonProperty("url") val url: String? = null, ) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index e01a50dd..679aeccb 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -28,6 +28,7 @@ import com.hexated.SoraExtractor.invokeGMovies import com.hexated.SoraExtractor.invokeKisskh import com.hexated.SoraExtractor.invokeLing import com.hexated.SoraExtractor.invokeM4uhd +import com.hexated.SoraExtractor.invokeMovie123 import com.hexated.SoraExtractor.invokeMoviesbay import com.hexated.SoraExtractor.invokeMoviezAdd import com.hexated.SoraExtractor.invokeRStream @@ -100,6 +101,7 @@ open class SoraStream : TmdbProvider() { const val rStreamAPI = "https://fsa.remotestre.am" const val flixonAPI = "https://flixon.ru" const val animeKaizokuAPI = "https://animekaizoku.com" + const val movie123NetAPI = "https://ww7.0123movie.net" fun getType(t: String?): TvType { return when (t) { @@ -519,6 +521,9 @@ open class SoraStream : TmdbProvider() { { invokeFlixon(res.id, res.imdbId, res.season, res.episode, callback) }, + { + invokeMovie123(res.title, res.season, res.episode, subtitleCallback, callback) + }, ) return true diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt index 131c2895..6b05629d 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt @@ -11,5 +11,6 @@ class SoraStreamPlugin: Plugin() { // All providers should be added in this manner. Please don't edit the providers list directly. registerMainAPI(SoraStream()) registerExtractorAPI(StreamM4u()) + registerExtractorAPI(Sblongvu()) } } \ No newline at end of file