added new source into SoraExtractor

This commit is contained in:
hexated 2022-10-30 02:32:17 +07:00
parent b3eade1326
commit 2c6788d425
3 changed files with 105 additions and 23 deletions

View file

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

View file

@ -71,8 +71,23 @@ object SoraExtractor : SoraStream() {
"$twoEmbedAPI/ajax/embed/play?id=$serverID&_token=$token", "$twoEmbedAPI/ajax/embed/play?id=$serverID&_token=$token",
referer = url referer = url
).parsedSafe<EmbedJson>()?.let { source -> ).parsedSafe<EmbedJson>()?.let { source ->
val link = source.link ?: return@let
if (link.contains("rabbitstream")) {
val rabbitId = link.substringAfterLast("/").substringBefore("?")
app.get(
"https://rabbitstream.net/ajax/embed-5/getSources?id=$rabbitId",
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).parsedSafe<RabbitSources>()?.tracks?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
sub.label.toString(),
sub.file ?: return@map null
)
)
}
} else {
loadExtractor( loadExtractor(
source.link ?: return@let null, link,
twoEmbedAPI, twoEmbedAPI,
subtitleCallback, subtitleCallback,
callback callback
@ -80,6 +95,7 @@ object SoraExtractor : SoraStream() {
} }
} }
} }
}
suspend fun invokeVidSrc( suspend fun invokeVidSrc(
id: Int? = null, id: Int? = null,
@ -117,7 +133,7 @@ object SoraExtractor : SoraStream() {
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val url = val url =
"https://olgply.xyz/${id}${season?.let { "/$it" } ?: ""}${episode?.let { "/$it" } ?: ""}" "$olgplyAPI/${id}${season?.let { "/$it" } ?: ""}${episode?.let { "/$it" } ?: ""}"
loadLinksWithWebView(url, callback) loadLinksWithWebView(url, callback)
} }
@ -303,13 +319,12 @@ object SoraExtractor : SoraStream() {
}&season=$season&_data=routes/api/provider" }&season=$season&_data=routes/api/provider"
) )
.parsedSafe<ProvidersResult>()?.provider?.first { it.provider == "Loklok" }?.id .parsedSafe<ProvidersResult>()?.provider?.first { it.provider == "Loklok" }?.id
} }
val query = if (season == null) { val query = if (season == null) {
"$mainServerAPI/movies/$id/watch?provider=Loklok&id=$providerId&_data=routes/movies/\$movieId.watch" "$mainServerAPI/movies/$id/watch?provider=Loklok&id=$providerId&_data=routes/movies/\$movieId.watch"
} else { } else {
"$mainServerAPI/tv-shows/$id/season/$season/episode/${episode?.minus(1)}?provider=Loklok&id=$providerId&_data=routes/tv-shows/\$tvId.season.\$seasonId.episode.\$episodeId" "$mainServerAPI/tv-shows/$id/season/$season/episode/$episode?provider=Loklok&id=$providerId&_data=routes/tv-shows/\$tvId.season.\$seasonId.episode.\$episodeId"
} }
val json = app.get( val json = app.get(
@ -447,18 +462,22 @@ object SoraExtractor : SoraStream() {
val sources: ArrayList<String?> = arrayListOf() val sources: ArrayList<String?> = arrayListOf()
if (season == null) { if (season == null) {
val xstreamcdn = res.selectFirst("div#list-eps div#server-29 a")?.attr("player-data")?.let { val xstreamcdn =
res.selectFirst("div#list-eps div#server-29 a")?.attr("player-data")?.let {
Regex("(.*?)((\\?cap)|(\\?sub)|(#cap)|(#sub))").find(it)?.groupValues?.get(1) Regex("(.*?)((\\?cap)|(\\?sub)|(#cap)|(#sub))").find(it)?.groupValues?.get(1)
} }
val streamsb = res.selectFirst("div#list-eps div#server-13 a")?.attr("player-data") val streamsb = res.selectFirst("div#list-eps div#server-13 a")?.attr("player-data")
val doodstream = res.selectFirst("div#list-eps div#server-14 a")?.attr("player-data") val doodstream = res.selectFirst("div#list-eps div#server-14 a")?.attr("player-data")
sources.addAll(listOf(xstreamcdn, streamsb, doodstream)) sources.addAll(listOf(xstreamcdn, streamsb, doodstream))
} else { } else {
val xstreamcdn = res.selectFirst("div#list-eps div#server-29 a[episode-data=$episode]")?.attr("player-data")?.let { val xstreamcdn = res.selectFirst("div#list-eps div#server-29 a[episode-data=$episode]")
?.attr("player-data")?.let {
Regex("(.*?)((\\?cap)|(\\?sub)|(#cap)|(#sub))").find(it)?.groupValues?.get(1) Regex("(.*?)((\\?cap)|(\\?sub)|(#cap)|(#sub))").find(it)?.groupValues?.get(1)
} }
val streamsb = res.selectFirst("div#list-eps div#server-13 a[episode-data=$episode]")?.attr("player-data") val streamsb = res.selectFirst("div#list-eps div#server-13 a[episode-data=$episode]")
val doodstream = res.selectFirst("div#list-eps div#server-14 a[episode-data=$episode]")?.attr("player-data") ?.attr("player-data")
val doodstream = res.selectFirst("div#list-eps div#server-14 a[episode-data=$episode]")
?.attr("player-data")
sources.addAll(listOf(xstreamcdn, streamsb, doodstream)) sources.addAll(listOf(xstreamcdn, streamsb, doodstream))
} }
@ -504,6 +523,53 @@ object SoraExtractor : SoraStream() {
} }
} }
suspend fun invokeNoverse(
title: String? = null,
season: Int? = null,
episode: Int? = null,
callback: (ExtractorLink) -> Unit
) {
val fixTitle = title.fixTitle()
val url = if (season == null) {
"$noverseAPI/movie/$fixTitle/download/"
} else {
"$noverseAPI/serie/$fixTitle/season-$season"
}
val doc = app.get(url).document
val links = if (season == null) {
doc.select("table.table-striped tbody tr").map {
it.select("a").attr("href") to it.selectFirst("td")?.text()
}
} else {
doc.select("table.table-striped tbody tr")
.find { it.text().contains("Episode $episode") }
?.select("td")?.map {
it.select("a").attr("href") to it.select("a").text()
}
}
links?.map { (link, quality) ->
val name =
quality?.replace(Regex("[0-9]{3,4}p"), "Noverse")?.replace(".", " ") ?: "Noverse"
callback.invoke(
ExtractorLink(
name,
name,
link,
"$noverseAPI/",
getQualityFromName("${quality?.substringBefore("p")?.trim()}p"),
// headers = mapOf(
// "Origin" to noverseAPI,
// "Range" to "bytes=0-"
// )
)
)
}
}
} }
//private fun fixTitle(title: String? = null) : String? { //private fun fixTitle(title: String? = null) : String? {
@ -605,3 +671,13 @@ data class ResponseHash(
@JsonProperty("type") val type: String?, @JsonProperty("type") val type: String?,
) )
data class Track(
@JsonProperty("file") val file: String? = null,
@JsonProperty("label") val label: String? = null,
)
data class RabbitSources(
@JsonProperty("sources") val sources: String? = null,
@JsonProperty("tracks") val tracks: ArrayList<Track>? = arrayListOf(),
)

View file

@ -10,6 +10,7 @@ import com.hexated.SoraExtractor.invokeHDMovieBox
import com.hexated.SoraExtractor.invokeIdlix import com.hexated.SoraExtractor.invokeIdlix
import com.hexated.SoraExtractor.invokeLocalSources import com.hexated.SoraExtractor.invokeLocalSources
import com.hexated.SoraExtractor.invokeMovieHab import com.hexated.SoraExtractor.invokeMovieHab
import com.hexated.SoraExtractor.invokeNoverse
import com.hexated.SoraExtractor.invokeOlgply import com.hexated.SoraExtractor.invokeOlgply
import com.hexated.SoraExtractor.invokeSeries9 import com.hexated.SoraExtractor.invokeSeries9
import com.hexated.SoraExtractor.invokeSoraVIP import com.hexated.SoraExtractor.invokeSoraVIP
@ -54,6 +55,8 @@ open class SoraStream : TmdbProvider() {
const val hdMovieBoxAPI = "https://hdmoviebox.net" const val hdMovieBoxAPI = "https://hdmoviebox.net"
const val series9API = "https://series9.la" const val series9API = "https://series9.la"
const val idlixAPI = "https://109.234.36.69" const val idlixAPI = "https://109.234.36.69"
const val noverseAPI = "https://www.nollyverse.com"
const val olgplyAPI = "https://olgply.xyz"
fun getType(t: String?): TvType { fun getType(t: String?): TvType {
return when (t) { return when (t) {
@ -376,6 +379,9 @@ open class SoraStream : TmdbProvider() {
}, },
{ {
invokeIdlix(res.title, res.season, res.episode, subtitleCallback, callback) invokeIdlix(res.title, res.season, res.episode, subtitleCallback, callback)
},
{
invokeNoverse(res.title, res.season, res.episode, callback)
} }
) )