mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed Idlix
This commit is contained in:
parent
8c7e94ce20
commit
002340c1d6
2 changed files with 18 additions and 128 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 7
|
version = 8
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -6,11 +6,12 @@ import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
import com.lagradost.cloudstream3.mvvm.safeApiCall
|
import com.lagradost.cloudstream3.mvvm.safeApiCall
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
class IdlixProvider : MainAPI() {
|
class IdlixProvider : MainAPI() {
|
||||||
override var mainUrl = "https://88.210.3.94"
|
override var mainUrl = "https://88.210.12.206"
|
||||||
|
private var directUrl = mainUrl
|
||||||
override var name = "Idlix"
|
override var name = "Idlix"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override var lang = "id"
|
override var lang = "id"
|
||||||
|
@ -33,6 +34,12 @@ class IdlixProvider : MainAPI() {
|
||||||
"$mainUrl/genre/drama-korea/page/" to "Drama Korea",
|
"$mainUrl/genre/drama-korea/page/" to "Drama Korea",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private fun getBaseUrl(url: String): String {
|
||||||
|
return URI(url).let {
|
||||||
|
"${it.scheme}://${it.host}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override suspend fun getMainPage(
|
override suspend fun getMainPage(
|
||||||
page: Int,
|
page: Int,
|
||||||
request: MainPageRequest
|
request: MainPageRequest
|
||||||
|
@ -100,8 +107,9 @@ class IdlixProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
override suspend fun load(url: String): LoadResponse {
|
||||||
val document = app.get(url).document
|
val request = app.get(url)
|
||||||
|
directUrl = getBaseUrl(request.url)
|
||||||
|
val document = request.document
|
||||||
val title =
|
val title =
|
||||||
document.selectFirst("div.data > h1")?.text()?.replace(Regex("\\(\\d{4}\\)"), "")
|
document.selectFirst("div.data > h1")?.text()?.replace(Regex("\\(\\d{4}\\)"), "")
|
||||||
?.trim().toString()
|
?.trim().toString()
|
||||||
|
@ -172,94 +180,6 @@ class IdlixProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getLanguage(str: String): String {
|
|
||||||
return when {
|
|
||||||
str.lowercase().contains("indonesia") || str.lowercase()
|
|
||||||
.contains("bahasa") -> "Indonesian"
|
|
||||||
else -> str
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun invokeLokalSource(
|
|
||||||
url: String,
|
|
||||||
subCallback: (SubtitleFile) -> Unit,
|
|
||||||
sourceCallback: (ExtractorLink) -> Unit
|
|
||||||
) {
|
|
||||||
val document = app.get(url, referer = "$mainUrl/").document
|
|
||||||
val hash = url.split("/").last().substringAfter("data=")
|
|
||||||
|
|
||||||
val m3uLink = app.post(
|
|
||||||
url = "https://jeniusplay.com/player/index.php?data=$hash&do=getVideo",
|
|
||||||
data = mapOf("hash" to hash, "r" to "$mainUrl/"),
|
|
||||||
referer = url,
|
|
||||||
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
|
||||||
).parsed<ResponseSource>().videoSource
|
|
||||||
|
|
||||||
M3u8Helper.generateM3u8(
|
|
||||||
this.name,
|
|
||||||
m3uLink,
|
|
||||||
url,
|
|
||||||
).forEach(sourceCallback)
|
|
||||||
|
|
||||||
|
|
||||||
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 ->
|
|
||||||
subCallback.invoke(
|
|
||||||
SubtitleFile(
|
|
||||||
getLanguage(subtitle.label!!),
|
|
||||||
subtitle.file
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun invokeLaviolaSource(
|
|
||||||
url: String,
|
|
||||||
subCallback: (SubtitleFile) -> Unit,
|
|
||||||
sourceCallback: (ExtractorLink) -> Unit
|
|
||||||
) {
|
|
||||||
val document = app.get(url, referer = "$mainUrl/").document
|
|
||||||
val baseName = "Laviola"
|
|
||||||
val baseUrl = "https://laviola.live/"
|
|
||||||
document.select("script").map { script ->
|
|
||||||
if (script.data().contains("var config = {")) {
|
|
||||||
val data = script.data().substringAfter("sources: [").substringBefore("],")
|
|
||||||
tryParseJson<List<ResponseLaviolaSource>>("[$data]")?.map { m3u ->
|
|
||||||
val m3uData = app.get(m3u.file, referer = baseUrl).text
|
|
||||||
val quality =
|
|
||||||
Regex("\\d{3,4}\\.m3u8").findAll(m3uData).map { it.value }.toList()
|
|
||||||
quality.forEach {
|
|
||||||
sourceCallback.invoke(
|
|
||||||
ExtractorLink(
|
|
||||||
source = baseName,
|
|
||||||
name = baseName,
|
|
||||||
url = m3u.file.replace("video.m3u8", it),
|
|
||||||
referer = baseUrl,
|
|
||||||
quality = getQualityFromName("${it.replace(".m3u8", "")}p"),
|
|
||||||
isM3u8 = true
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val subData = script.data().substringAfter("tracks: [").substringBefore("],")
|
|
||||||
tryParseJson<List<Tracks>>("[$subData]")?.map { subtitle ->
|
|
||||||
subCallback.invoke(
|
|
||||||
SubtitleFile(
|
|
||||||
getLanguage(subtitle.label!!),
|
|
||||||
(if (subtitle.kind!!.contains("captions")) subtitle.file else null)!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun loadLinks(
|
override suspend fun loadLinks(
|
||||||
data: String,
|
data: String,
|
||||||
isCasting: Boolean,
|
isCasting: Boolean,
|
||||||
|
@ -276,7 +196,7 @@ class IdlixProvider : MainAPI() {
|
||||||
}.apmap { nume ->
|
}.apmap { nume ->
|
||||||
safeApiCall {
|
safeApiCall {
|
||||||
var source = app.post(
|
var source = app.post(
|
||||||
url = "$mainUrl/wp-admin/admin-ajax.php",
|
url = "$directUrl/wp-admin/admin-ajax.php",
|
||||||
data = mapOf(
|
data = mapOf(
|
||||||
"action" to "doo_player_ajax",
|
"action" to "doo_player_ajax",
|
||||||
"post" to id,
|
"post" to id,
|
||||||
|
@ -287,24 +207,11 @@ class IdlixProvider : MainAPI() {
|
||||||
referer = data
|
referer = data
|
||||||
).parsed<ResponseHash>().embed_url
|
).parsed<ResponseHash>().embed_url
|
||||||
|
|
||||||
when {
|
|
||||||
source.startsWith("https://jeniusplay.com") -> invokeLokalSource(
|
|
||||||
source,
|
|
||||||
subtitleCallback,
|
|
||||||
callback
|
|
||||||
)
|
|
||||||
source.startsWith("https://laviola.live") -> invokeLaviolaSource(
|
|
||||||
source,
|
|
||||||
subtitleCallback,
|
|
||||||
callback
|
|
||||||
)
|
|
||||||
else -> {
|
|
||||||
if (source.startsWith("https://uservideo.xyz")) {
|
if (source.startsWith("https://uservideo.xyz")) {
|
||||||
source = app.get(source).document.select("iframe").attr("src")
|
source = app.get(source).document.select("iframe").attr("src")
|
||||||
}
|
}
|
||||||
loadExtractor(source, data, subtitleCallback, callback)
|
loadExtractor(source, directUrl, subtitleCallback, callback)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,21 +223,4 @@ class IdlixProvider : MainAPI() {
|
||||||
@JsonProperty("type") val type: String?,
|
@JsonProperty("type") val type: String?,
|
||||||
)
|
)
|
||||||
|
|
||||||
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?,
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ResponseLaviolaSource(
|
|
||||||
@JsonProperty("file") val file: String,
|
|
||||||
@JsonProperty("label") val label: String?,
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue