added source to SoraExtractor

This commit is contained in:
hexated 2022-10-17 12:01:44 +07:00
parent 7c057c39ab
commit d7cc3c15f2
2 changed files with 43 additions and 3 deletions

View file

@ -5,10 +5,12 @@ import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.SubtitleFile import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.apmap import com.lagradost.cloudstream3.apmap
import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.network.WebViewResolver
import com.lagradost.cloudstream3.utils.AppUtils import com.lagradost.cloudstream3.utils.AppUtils
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
import com.lagradost.nicehttp.requestCreator
object SoraExtractor : SoraStream() { object SoraExtractor : SoraStream() {
@ -84,7 +86,7 @@ object SoraExtractor : SoraStream() {
} }
} }
suspend fun invokeVidSrcSources( suspend fun invokeVidSrc(
id: Int? = null, id: Int? = null,
season: Int? = null, season: Int? = null,
episode: Int? = null, episode: Int? = null,
@ -100,4 +102,38 @@ object SoraExtractor : SoraStream() {
loadExtractor(url, null, subtitleCallback, callback) loadExtractor(url, null, subtitleCallback, callback)
} }
private suspend fun loadLinksWithWebView(
url: String,
callback: (ExtractorLink) -> Unit
) {
val foundVideo = WebViewResolver(
Regex("""\.m3u8|i7njdjvszykaieynzsogaysdgb0hm8u1mzubmush4maopa4wde\.com""")
).resolveUsingWebView(
requestCreator(
"GET", url, referer = "https://olgply.com/"
)
).first ?: return
callback.invoke(
ExtractorLink(
"Olgply",
"Olgply",
foundVideo.url.toString(),
"",
Qualities.Unknown.value,
true
)
)
}
suspend fun invokeOlgply(
id: Int? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit
) {
val url = "https://olgply.xyz/${id}${season?.let { "/$it" } ?: ""}${episode?.let { "/$it" } ?: ""}"
loadLinksWithWebView(url, callback)
}
} }

View file

@ -3,8 +3,9 @@ package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.hexated.RandomUserAgent.getRandomUserAgent import com.hexated.RandomUserAgent.getRandomUserAgent
import com.hexated.SoraExtractor.invokeLocalSources import com.hexated.SoraExtractor.invokeLocalSources
import com.hexated.SoraExtractor.invokeOlgply
import com.hexated.SoraExtractor.invokeTwoEmbed import com.hexated.SoraExtractor.invokeTwoEmbed
import com.hexated.SoraExtractor.invokeVidSrcSources import com.hexated.SoraExtractor.invokeVidSrc
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.metaproviders.TmdbProvider import com.lagradost.cloudstream3.metaproviders.TmdbProvider
import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.parseJson
@ -244,7 +245,10 @@ open class SoraStream : TmdbProvider() {
} }
}, },
{ {
invokeVidSrcSources(res.id, res.season, res.episode, subtitleCallback, callback) invokeVidSrc(res.id, res.season, res.episode, subtitleCallback, callback)
},
{
invokeOlgply(res.id, res.season, res.episode, callback)
}) })