mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed Sora Search and add new Source
This commit is contained in:
parent
ac707d0d96
commit
c50a34bf7b
5 changed files with 74 additions and 78 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 18
|
version = 19
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
package com.hexated
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
|
||||||
import com.lagradost.cloudstream3.app
|
|
||||||
import com.lagradost.cloudstream3.utils.*
|
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
|
||||||
|
|
||||||
class Jeniusplay : ExtractorApi() {
|
|
||||||
override val name = "Jeniusplay"
|
|
||||||
override val mainUrl = "https://jeniusplay.com"
|
|
||||||
override val requiresReferer = true
|
|
||||||
|
|
||||||
override suspend fun getUrl(
|
|
||||||
url: String,
|
|
||||||
referer: String?,
|
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
|
||||||
callback: (ExtractorLink) -> Unit
|
|
||||||
) {
|
|
||||||
val document = app.get(url, referer = "$mainUrl/").document
|
|
||||||
val hash = url.split("/").last().substringAfter("data=")
|
|
||||||
|
|
||||||
val m3uLink = app.post(
|
|
||||||
url = "$mainUrl/player/index.php?data=$hash&do=getVideo",
|
|
||||||
data = mapOf("hash" to hash, "r" to "$referer"),
|
|
||||||
referer = url,
|
|
||||||
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
|
||||||
).parsed<ResponseSource>().videoSource
|
|
||||||
|
|
||||||
M3u8Helper.generateM3u8(
|
|
||||||
this.name,
|
|
||||||
m3uLink,
|
|
||||||
url,
|
|
||||||
).forEach(callback)
|
|
||||||
|
|
||||||
|
|
||||||
document.select("script").map { script ->
|
|
||||||
if (script.data().contains("eval(function(p,a,c,k,e,d)")) {
|
|
||||||
val subData =
|
|
||||||
getAndUnpack(script.data()).substringAfter("\"tracks\":[").substringBefore("],")
|
|
||||||
tryParseJson<List<Tracks>>("[$subData]")?.map { subtitle ->
|
|
||||||
subtitleCallback.invoke(
|
|
||||||
SubtitleFile(
|
|
||||||
getLanguage(subtitle.label.toString()),
|
|
||||||
subtitle.file
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getLanguage(str: String): String {
|
|
||||||
return when {
|
|
||||||
str.lowercase().contains("indonesia") || str.lowercase()
|
|
||||||
.contains("bahasa") -> "Indonesian"
|
|
||||||
else -> str
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class ResponseSource(
|
|
||||||
@JsonProperty("hls") val hls: Boolean,
|
|
||||||
@JsonProperty("videoSource") val videoSource: String,
|
|
||||||
@JsonProperty("securedLink") val securedLink: String?,
|
|
||||||
)
|
|
||||||
|
|
||||||
data class Tracks(
|
|
||||||
@JsonProperty("kind") val kind: String?,
|
|
||||||
@JsonProperty("file") val file: String,
|
|
||||||
@JsonProperty("label") val label: String?,
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -526,6 +526,71 @@ object SoraExtractor : SoraStream() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun invokeUniqueStream(
|
||||||
|
title: String? = null,
|
||||||
|
year: Int? = null,
|
||||||
|
season: Int? = null,
|
||||||
|
episode: Int? = null,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val fixTitle = title.fixTitle()
|
||||||
|
val url = if (season == null) {
|
||||||
|
"$uniqueStreamAPI/movies/$fixTitle-$year"
|
||||||
|
} else {
|
||||||
|
"$uniqueStreamAPI/episodes/$fixTitle-season-$season-episode-$episode"
|
||||||
|
}
|
||||||
|
|
||||||
|
val document = app.get(url).document
|
||||||
|
val type = if (url.contains("/movie/")) "movie" else "tv"
|
||||||
|
document.select("ul#playeroptionsul > li").apmap { el ->
|
||||||
|
val id = el.attr("data-post")
|
||||||
|
val nume = el.attr("data-nume")
|
||||||
|
val source = app.post(
|
||||||
|
url = "$uniqueStreamAPI/wp-admin/admin-ajax.php",
|
||||||
|
data = mapOf(
|
||||||
|
"action" to "doo_player_ajax",
|
||||||
|
"post" to id,
|
||||||
|
"nume" to nume,
|
||||||
|
"type" to type
|
||||||
|
),
|
||||||
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
|
||||||
|
referer = url
|
||||||
|
).parsed<ResponseHash>().embed_url.let { fixUrl(it) }
|
||||||
|
|
||||||
|
if (source.contains("uniquestream")) {
|
||||||
|
val resDoc = app.get(
|
||||||
|
source, referer = "$uniqueStreamAPI/", headers = mapOf(
|
||||||
|
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"
|
||||||
|
)
|
||||||
|
).document
|
||||||
|
val srcm3u8 = resDoc.selectFirst("script:containsData(let url =)")?.data()?.let {
|
||||||
|
Regex("['|\"](.*?.m3u8)['|\"]").find(it)?.groupValues?.getOrNull(1)
|
||||||
|
} ?: return@apmap null
|
||||||
|
val quality = app.get(srcm3u8, referer = source, headers = mapOf(
|
||||||
|
"Accept" to "*/*",
|
||||||
|
)).text.let { quality ->
|
||||||
|
if(quality.contains("RESOLUTION=1920")) Qualities.P1080.value else Qualities.P720.value
|
||||||
|
}
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
"UniqueStream",
|
||||||
|
"UniqueStream",
|
||||||
|
srcm3u8,
|
||||||
|
source,
|
||||||
|
quality,
|
||||||
|
true,
|
||||||
|
headers = mapOf(
|
||||||
|
"Accept" to "*/*",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
loadExtractor(source, "$uniqueStreamAPI/", subtitleCallback, callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun invokeNoverse(
|
suspend fun invokeNoverse(
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
season: Int? = null,
|
season: Int? = null,
|
||||||
|
|
|
@ -15,6 +15,7 @@ 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
|
||||||
import com.hexated.SoraExtractor.invokeTwoEmbed
|
import com.hexated.SoraExtractor.invokeTwoEmbed
|
||||||
|
import com.hexated.SoraExtractor.invokeUniqueStream
|
||||||
import com.hexated.SoraExtractor.invokeVidSrc
|
import com.hexated.SoraExtractor.invokeVidSrc
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId
|
||||||
|
@ -57,6 +58,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
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 noverseAPI = "https://www.nollyverse.com"
|
||||||
const val olgplyAPI = "https://olgply.xyz"
|
const val olgplyAPI = "https://olgply.xyz"
|
||||||
|
const val uniqueStreamAPI = "https://uniquestream.net"
|
||||||
|
|
||||||
fun getType(t: String?): TvType {
|
fun getType(t: String?): TvType {
|
||||||
return when (t) {
|
return when (t) {
|
||||||
|
@ -144,14 +146,13 @@ open class SoraStream : TmdbProvider() {
|
||||||
referer = "$mainAPI/"
|
referer = "$mainAPI/"
|
||||||
).parsedSafe<Results>()?.results?.mapNotNull { media ->
|
).parsedSafe<Results>()?.results?.mapNotNull { media ->
|
||||||
media.toSearchResponse()
|
media.toSearchResponse()
|
||||||
} ?: throw ErrorLoadingException("Invalid Json reponse")
|
}
|
||||||
searchResponse.addAll(mainResponse)
|
if(mainResponse?.isNotEmpty() == true) searchResponse.addAll(mainResponse)
|
||||||
|
|
||||||
val animeResponse =
|
val animeResponse =
|
||||||
app.get("$mainServerAPI/search/anime/$query?_data=routes/search/anime/\$animeKeyword")
|
app.get("$mainServerAPI/search/anime/$query?_data=routes/search/anime/\$animeKeyword")
|
||||||
.parsedSafe<SearchAnime>()?.searchResults?.results?.mapNotNull { anime -> anime.toSearchResponse() }
|
.parsedSafe<SearchAnime>()?.searchResults?.results?.mapNotNull { anime -> anime.toSearchResponse() }
|
||||||
?: throw ErrorLoadingException("Invalid Json reponse")
|
if(animeResponse?.isNotEmpty() == true) searchResponse.addAll(animeResponse)
|
||||||
searchResponse.addAll(animeResponse)
|
|
||||||
|
|
||||||
return searchResponse
|
return searchResponse
|
||||||
}
|
}
|
||||||
|
@ -388,6 +389,9 @@ open class SoraStream : TmdbProvider() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
invokeNoverse(res.title, res.season, res.episode, callback)
|
invokeNoverse(res.title, res.season, res.episode, callback)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
invokeUniqueStream(res.title, res.year, res.season, res.episode, subtitleCallback, callback)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,5 @@ class SoraStreamPlugin: Plugin() {
|
||||||
override fun load(context: Context) {
|
override fun load(context: Context) {
|
||||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||||
registerMainAPI(SoraStream())
|
registerMainAPI(SoraStream())
|
||||||
registerExtractorAPI(Jeniusplay())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue