mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
added new sources into SoraExtractor
This commit is contained in:
parent
7eeaad4164
commit
aa6ed888c0
5 changed files with 140 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 12
|
||||
version = 13
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
72
SoraStream/src/main/kotlin/com/hexated/Jeniusplay.kt
Normal file
72
SoraStream/src/main/kotlin/com/hexated/Jeniusplay.kt
Normal file
|
@ -0,0 +1,72 @@
|
|||
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?,
|
||||
)
|
||||
}
|
|
@ -230,16 +230,16 @@ object SoraExtractor : SoraStream() {
|
|||
}
|
||||
|
||||
suspend fun invokeMovieHab(
|
||||
id: Int? = null,
|
||||
imdbId: String? = null,
|
||||
season: Int? = null,
|
||||
episode: Int? = null,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val url = if (season == null) {
|
||||
"$movieHabAPI/embed/movie?tmdb=$id"
|
||||
"$movieHabAPI/embed/movie?imdb=$imdbId"
|
||||
} else {
|
||||
"$movieHabAPI/embed/series?tmdb=$id&sea=$season&epi=$episode"
|
||||
"$movieHabAPI/embed/series?imdb=$imdbId&sea=$season&epi=$episode"
|
||||
}
|
||||
|
||||
val doc = app.get(url, referer = "$movieHabAPI/").document
|
||||
|
@ -334,7 +334,7 @@ object SoraExtractor : SoraStream() {
|
|||
json?.subtitles?.map { sub ->
|
||||
subtitleCallback.invoke(
|
||||
SubtitleFile(
|
||||
sub.lang.toString(),
|
||||
getLanguage(sub.lang.toString()),
|
||||
sub.url ?: return@map null
|
||||
)
|
||||
)
|
||||
|
@ -372,7 +372,7 @@ object SoraExtractor : SoraStream() {
|
|||
episode: Int? = null,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val fixTitle = title?.replace(":", "")?.replace(" ", "-")?.lowercase()
|
||||
val fixTitle = title.fixTitle()
|
||||
val url = "$hdMovieBoxAPI/watch/$fixTitle"
|
||||
val ref = if (season == null) {
|
||||
"$hdMovieBoxAPI/watch/$fixTitle"
|
||||
|
@ -436,7 +436,7 @@ object SoraExtractor : SoraStream() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val fixTitle = title?.replace(":", "")?.replace(" ", "-")?.lowercase()
|
||||
val fixTitle = title.fixTitle()
|
||||
val url = if (season == null) {
|
||||
"$series9API/film/$fixTitle/watching.html"
|
||||
} else {
|
||||
|
@ -465,9 +465,57 @@ object SoraExtractor : SoraStream() {
|
|||
sources.apmap { link ->
|
||||
loadExtractor(link ?: return@apmap null, url, subtitleCallback, callback)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
suspend fun invokeIdlix(
|
||||
title: String? = null,
|
||||
season: Int? = null,
|
||||
episode: Int? = null,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
val fixTitle = title.fixTitle()
|
||||
val url = if(season == null) {
|
||||
"$idlixAPI/movie/$fixTitle"
|
||||
} else {
|
||||
"$idlixAPI/episode/$fixTitle-season-$season-episode-$episode"
|
||||
}
|
||||
|
||||
val document = app.get(url).document
|
||||
val id = document.select("meta#dooplay-ajax-counter").attr("data-postid")
|
||||
val type = if (url.contains("/movie/")) "movie" else "tv"
|
||||
|
||||
document.select("ul#playeroptionsul > li").map {
|
||||
it.attr("data-nume")
|
||||
}.apmap { nume ->
|
||||
val source = app.post(
|
||||
url = "$idlixAPI/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
|
||||
|
||||
loadExtractor(source, "$idlixAPI/", subtitleCallback, callback)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//private fun fixTitle(title: String? = null) : String? {
|
||||
// return title?.replace(":", "")?.replace(" ", "-")?.lowercase()?.replace("-–-", "-")
|
||||
//}
|
||||
|
||||
private fun String?.fixTitle() : String? {
|
||||
return this?.replace(":", "")?.replace(" ", "-")?.lowercase()?.replace("-–-", "-")
|
||||
}
|
||||
|
||||
fun getLanguage(str: String): String {
|
||||
return if(str.contains("(in_ID)")) "Indonesian" else str
|
||||
}
|
||||
|
||||
private fun getQuality(str: String): Int {
|
||||
|
@ -552,3 +600,8 @@ data class HdMovieBoxIframe(
|
|||
@JsonProperty("api_iframe") val apiIframe: String? = null,
|
||||
)
|
||||
|
||||
data class ResponseHash(
|
||||
@JsonProperty("embed_url") val embed_url: String,
|
||||
@JsonProperty("type") val type: String?,
|
||||
)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.hexated.SoraExtractor.invokeDatabaseGdrive
|
|||
import com.hexated.SoraExtractor.invokeDbgo
|
||||
import com.hexated.SoraExtractor.invokeGogo
|
||||
import com.hexated.SoraExtractor.invokeHDMovieBox
|
||||
import com.hexated.SoraExtractor.invokeIdlix
|
||||
import com.hexated.SoraExtractor.invokeLocalSources
|
||||
import com.hexated.SoraExtractor.invokeMovieHab
|
||||
import com.hexated.SoraExtractor.invokeOlgply
|
||||
|
@ -52,6 +53,7 @@ open class SoraStream : TmdbProvider() {
|
|||
const val databaseGdriveAPI = "https://databasegdriveplayer.co"
|
||||
const val hdMovieBoxAPI = "https://hdmoviebox.net"
|
||||
const val series9API = "https://series9.la"
|
||||
const val idlixAPI = "https://109.234.36.69"
|
||||
|
||||
fun getType(t: String?): TvType {
|
||||
return when (t) {
|
||||
|
@ -352,7 +354,7 @@ open class SoraStream : TmdbProvider() {
|
|||
)
|
||||
},
|
||||
{
|
||||
invokeMovieHab(res.id, res.season, res.episode, subtitleCallback, callback)
|
||||
invokeMovieHab(res.imdbId, res.season, res.episode, subtitleCallback, callback)
|
||||
},
|
||||
// {
|
||||
// invokeDatabaseGdrive(
|
||||
|
@ -371,6 +373,9 @@ open class SoraStream : TmdbProvider() {
|
|||
},
|
||||
{
|
||||
invokeSeries9(res.title, res.season, res.episode, subtitleCallback, callback)
|
||||
},
|
||||
{
|
||||
invokeIdlix(res.title, res.season, res.episode, subtitleCallback, callback)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -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(Jeniusplay())
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue