From 507068832df9b1fa6c390bf75c3f1ab069bd0f71 Mon Sep 17 00:00:00 2001 From: hexated Date: Tue, 18 Oct 2022 23:16:43 +0700 Subject: [PATCH] added source to SoraExtractor --- SoraStream/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/SoraExtractor.kt | 47 ++++++++++++++++++- .../src/main/kotlin/com/hexated/SoraStream.kt | 14 +++--- YomoviesProvider/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/SpeedoStream.kt | 36 -------------- .../com/hexated/YomoviesProviderPlugin.kt | 1 - 6 files changed, 53 insertions(+), 49 deletions(-) delete mode 100644 YomoviesProvider/src/main/kotlin/com/hexated/SpeedoStream.kt diff --git a/SoraStream/build.gradle.kts b/SoraStream/build.gradle.kts index c7ac5bcd..a6a2c484 100644 --- a/SoraStream/build.gradle.kts +++ b/SoraStream/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 6 +version = 7 cloudstream { diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 5837552c..22cafd3f 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -1,5 +1,6 @@ package com.hexated +import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.extractors.XStreamCdn import com.lagradost.cloudstream3.network.WebViewResolver @@ -202,7 +203,7 @@ object SoraExtractor : SoraStream() { subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ) { - val url = if(season == null) { + val url = if (season == null) { "$movie123API/imdb.php?imdb=$imdbId&server=vcu" } else { "$movie123API/tmdb_api.php?se=$season&ep=$episode&tmdb=$tmdbId&server_name=vcu" @@ -228,6 +229,39 @@ object SoraExtractor : SoraStream() { ) } } + + suspend fun invokeMovieHab( + id: Int? = null, + season: Int? = null, + episode: Int? = null, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val url = if (season == null) { + "$movieHabAPI/embed/movie?tmdb=$id" + } else { + "$movieHabAPI/embed/series?tmdb=$id&sea=$season&epi=$episode" + } + + val doc = app.get(url, referer = "$movieHabAPI/").document + val movieId = doc.select("div#embed-player").attr("data-movie-id") + + doc.select("div.dropdown-menu a").apmap { + val dataId = it.attr("data-id") + app.get( + "$movieHabAPI/ajax/get_stream_link?id=$dataId&movie=$movieId&is_init=true&captcha=&ref=", + referer = url, + headers = mapOf("X-Requested-With" to "XMLHttpRequest") + ).parsedSafe()?.data?.let { res -> + loadExtractor( + res.link ?: return@let null, + movieHabAPI, + subtitleCallback, + callback + ) + } + } + } } private fun getQuality(str: String): Int { @@ -300,4 +334,13 @@ suspend fun loadLinksWithWebView( true ) ) -} \ No newline at end of file +} + +private data class MovieHabData( + @JsonProperty("link") val link: String? = null, + @JsonProperty("token") val token: String? = null, +) + +private data class MovieHabRes( + @JsonProperty("data") val data: MovieHabData? = null, +) \ No newline at end of file diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 130d0083..e3ea4588 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -5,6 +5,7 @@ import com.hexated.RandomUserAgent.getRandomUserAgent import com.hexated.SoraExtractor.invoke123Movie import com.hexated.SoraExtractor.invokeDbgo import com.hexated.SoraExtractor.invokeLocalSources +import com.hexated.SoraExtractor.invokeMovieHab import com.hexated.SoraExtractor.invokeOlgply import com.hexated.SoraExtractor.invokeTwoEmbed import com.hexated.SoraExtractor.invokeVidSrc @@ -39,6 +40,7 @@ open class SoraStream : TmdbProvider() { const val vidSrcAPI = "https://v2.vidsrc.me" const val dbgoAPI = "https://dbgo.fun" const val movie123API = "https://api.123movie.cc" + const val movieHabAPI = "https://moviehab.com" fun getType(t: String?): TvType { return when (t) { @@ -263,14 +265,10 @@ open class SoraStream : TmdbProvider() { invokeDbgo(res.imdbId, res.season, res.episode, subtitleCallback, callback) }, { - invoke123Movie( - res.id, - res.imdbId, - res.season, - res.episode, - subtitleCallback, - callback - ) + invoke123Movie(res.id, res.imdbId, res.season, res.episode, subtitleCallback, callback) + }, + { + invokeMovieHab(res.id, res.season, res.episode, subtitleCallback, callback) }) diff --git a/YomoviesProvider/build.gradle.kts b/YomoviesProvider/build.gradle.kts index efa2f5a9..c61dc0a0 100644 --- a/YomoviesProvider/build.gradle.kts +++ b/YomoviesProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 8 +version = 9 cloudstream { diff --git a/YomoviesProvider/src/main/kotlin/com/hexated/SpeedoStream.kt b/YomoviesProvider/src/main/kotlin/com/hexated/SpeedoStream.kt deleted file mode 100644 index a9fad667..00000000 --- a/YomoviesProvider/src/main/kotlin/com/hexated/SpeedoStream.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.hexated - -import com.fasterxml.jackson.annotation.JsonProperty -import com.lagradost.cloudstream3.app -import com.lagradost.cloudstream3.utils.AppUtils -import com.lagradost.cloudstream3.utils.ExtractorApi -import com.lagradost.cloudstream3.utils.ExtractorLink -import com.lagradost.cloudstream3.utils.M3u8Helper - -class SpeedoStream1 : ExtractorApi() { - override val name = "SpeedoStream" - override val mainUrl = "https://speedostream.nl" - override val requiresReferer = true - - override suspend fun getUrl(url: String, referer: String?): List { - val sources = mutableListOf() - app.get(url, referer = referer).document.select("script").map { script -> - if (script.data().contains("jwplayer(\"vplayer\").setup(")) { - val data = script.data().substringAfter("sources: [") - .substringBefore("],").replace("file", "\"file\"").trim() - AppUtils.tryParseJson(data)?.let { - M3u8Helper.generateM3u8( - name, - it.file, - "$mainUrl/", - ).forEach { m3uData -> sources.add(m3uData) } - } - } - } - return sources - } - - private data class File( - @JsonProperty("file") val file: String, - ) -} \ No newline at end of file diff --git a/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProviderPlugin.kt b/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProviderPlugin.kt index 238f820e..72cbcd16 100644 --- a/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProviderPlugin.kt +++ b/YomoviesProvider/src/main/kotlin/com/hexated/YomoviesProviderPlugin.kt @@ -10,6 +10,5 @@ class YomoviesProviderPlugin: Plugin() { override fun load(context: Context) { // All providers should be added in this manner. Please don't edit the providers list directly. registerMainAPI(YomoviesProvider()) - registerExtractorAPI(SpeedoStream1()) } } \ No newline at end of file