added source to SoraExtractor

This commit is contained in:
hexated 2022-10-18 07:20:30 +07:00
parent dfe775f668
commit 1fdbda806d
4 changed files with 41 additions and 4 deletions

View file

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

View file

@ -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<EmbedJson>()?.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 {

View file

@ -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
@ -37,6 +38,7 @@ open class SoraStream : TmdbProvider() {
const val twoEmbedAPI = "https://www.2embed.to"
const val vidSrcAPI = "https://v2.vidsrc.me"
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)
})

View file

@ -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())
}
}