From 1fdbda806d56bb862e86c5ceb13659fa46b966f4 Mon Sep 17 00:00:00 2001 From: hexated Date: Tue, 18 Oct 2022 07:20:30 +0700 Subject: [PATCH] added source to SoraExtractor --- SoraStream/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/SoraExtractor.kt | 35 +++++++++++++++++-- .../src/main/kotlin/com/hexated/SoraStream.kt | 7 +++- .../kotlin/com/hexated/SoraStreamPlugin.kt | 1 + 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/SoraStream/build.gradle.kts b/SoraStream/build.gradle.kts index 2c720109..e76d6c74 100644 --- a/SoraStream/build.gradle.kts +++ b/SoraStream/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 5 +version = 6 cloudstream { diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 23554c79..0d1698fe 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -1,13 +1,18 @@ package com.hexated -import android.util.Log import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.extractors.XStreamCdn import com.lagradost.cloudstream3.network.WebViewResolver import com.lagradost.cloudstream3.utils.* import com.lagradost.nicehttp.requestCreator import java.net.URI import java.util.ArrayList +class EmbedSito : XStreamCdn() { + override val name: String = "EmbedSito" + override val mainUrl: String = "https://embedsito.com" +} + object SoraExtractor : SoraStream() { suspend fun invokeLocalSources( @@ -71,7 +76,6 @@ object SoraExtractor : SoraStream() { "$twoEmbedAPI/ajax/embed/play?id=$serverID&_token=$token", referer = url ).parsedSafe()?.let { source -> - Log.i("hexated", "${source.link}") loadExtractor( source.link ?: return@let null, twoEmbedAPI, @@ -195,6 +199,33 @@ object SoraExtractor : SoraStream() { } + suspend fun invoke123Movie( + id: String? = null, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val url = "$movie123API/imdb.php?imdb=$id&server=vcu" + val iframe = app.get(url).document.selectFirst("iframe")?.attr("src") + + val doc = app.get( + "$iframe", + referer = url, + headers = mapOf("Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8") + ).document + + doc.select("ul.list-server-items li.linkserver").mapNotNull { server -> + server.attr("data-video").let { + Regex("(.*?)((\\?cap)|(\\?sub)|(#cap)|(#sub))").find(it)?.groupValues?.get(1) + } + }.apmap { link -> + loadExtractor( + link, + "https://123moviesjr.cc/", + subtitleCallback, + callback + ) + } + } } private fun getQuality(str: String): Int { diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 9dd383a0..88d72cfa 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -2,6 +2,7 @@ package com.hexated import com.fasterxml.jackson.annotation.JsonProperty import com.hexated.RandomUserAgent.getRandomUserAgent +import com.hexated.SoraExtractor.invoke123Movie import com.hexated.SoraExtractor.invokeDbgo import com.hexated.SoraExtractor.invokeLocalSources import com.hexated.SoraExtractor.invokeOlgply @@ -36,7 +37,8 @@ open class SoraStream : TmdbProvider() { base64DecodeAPI("cA==YXA=bC4=Y2U=ZXI=LnY=aWU=b3Y=LW0=cmE=c28=Ly8=czo=dHA=aHQ=") const val twoEmbedAPI = "https://www.2embed.to" const val vidSrcAPI = "https://v2.vidsrc.me" - const val dbgoAPI = " https://dbgo.fun" + const val dbgoAPI = "https://dbgo.fun" + const val movie123API = "https://api.123movie.cc" fun getType(t: String?): TvType { return when (t) { @@ -259,6 +261,9 @@ open class SoraStream : TmdbProvider() { }, { invokeDbgo(res.imdbId, res.season, res.episode, subtitleCallback, callback) + }, + { + if (res.type == "movie") invoke123Movie(res.imdbId, subtitleCallback, callback) }) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt index bdf4216e..77c5a4ae 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStreamPlugin.kt @@ -10,5 +10,6 @@ class SoraStreamPlugin: Plugin() { override fun load(context: Context) { // All providers should be added in this manner. Please don't edit the providers list directly. registerMainAPI(SoraStream()) + registerExtractorAPI(EmbedSito()) } } \ No newline at end of file