rebahin: update domain

This commit is contained in:
black 2023-09-20 20:03:43 +07:00
parent 01899b2b8c
commit f3f8c8e59a
5 changed files with 337 additions and 496 deletions

View file

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

View file

@ -3,7 +3,7 @@ package com.hexated
import com.lagradost.cloudstream3.TvType import com.lagradost.cloudstream3.TvType
class Cgvindo : RebahinProvider() { class Cgvindo : RebahinProvider() {
override var mainUrl = "http://cgvindo.click" override var mainUrl = "http://cgvindo.ink"
override var name = "Cgvindo" override var name = "Cgvindo"
} }

View file

@ -6,14 +6,14 @@ 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.logError import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.safeApiCall import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.network.WebViewResolver
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import java.net.URI import java.net.URI
open class RebahinProvider : MainAPI() { open class RebahinProvider : MainAPI() {
override var mainUrl = "http://179.43.163.50" override var mainUrl = "http://179.43.163.51"
private var directUrl: String? = null
override var name = "Rebahin" override var name = "Rebahin"
override val hasMainPage = true override val hasMainPage = true
override var lang = "id" override var lang = "id"
@ -97,8 +97,9 @@ open class RebahinProvider : MainAPI() {
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val document = app.get(url).document val req = app.get(url)
directUrl = getBaseUrl(req.url)
val document = req.document
val title = document.selectFirst("h3[itemprop=name]")!!.ownText().trim() val title = document.selectFirst("h3[itemprop=name]")!!.ownText().trim()
val poster = document.select(".mvic-desc > div.thumb.mvic-thumb").attr("style") val poster = document.select(".mvic-desc > div.thumb.mvic-thumb").attr("style")
.substringAfter("url(").substringBeforeLast(")") .substringAfter("url(").substringBeforeLast(")")
@ -157,11 +158,29 @@ open class RebahinProvider : MainAPI() {
} }
} }
private fun getLanguage(str: String): String { override suspend fun loadLinks(
return when { data: String,
str.contains("indonesia", true) || str.contains("bahasa", true) -> "Indonesian" isCasting: Boolean,
else -> str subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
data.removeSurrounding("[", "]").split(",").map { it.trim() }.apmap { link ->
safeApiCall {
when {
link.startsWith(mainServer) -> invokeLokalSource(
link,
subtitleCallback,
callback
)
else -> {
loadExtractor(link, "$directUrl/", subtitleCallback, callback)
}
}
}
} }
return true
} }
private suspend fun invokeLokalSource( private suspend fun invokeLokalSource(
@ -172,7 +191,7 @@ open class RebahinProvider : MainAPI() {
val document = app.get( val document = app.get(
url, url,
allowRedirects = false, allowRedirects = false,
referer = mainUrl, referer = directUrl,
headers = mapOf("Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8") headers = mapOf("Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
).document ).document
@ -204,82 +223,17 @@ open class RebahinProvider : MainAPI() {
} }
} }
private suspend fun invokeKotakAjairSource( private fun getLanguage(str: String): String {
url: String, return when {
subCallback: (SubtitleFile) -> Unit, str.contains("indonesia", true) || str.contains("bahasa", true) -> "Indonesian"
sourceCallback: (ExtractorLink) -> Unit else -> str
) {
val domainUrl = "https://kotakajair.xyz"
val id = url.trimEnd('/').split("/").last()
val sources = app.post(
url = "$domainUrl/api/source/$id",
data = mapOf("r" to mainUrl, "d" to URI(url).host)
).parsed<ResponseKotakAjair>()
sources.data?.map {
sourceCallback.invoke(
ExtractorLink(
name,
"KotakAjair",
fixUrl(it.file),
referer = url,
quality = getQualityFromName(it.label)
)
)
} }
val userData = sources.player.poster_file.split("/")[2]
sources.captions?.map {
subCallback.invoke(
SubtitleFile(
getLanguage(it.language),
"$domainUrl/asset/userdata/$userData/caption/${it.hash}/${it.id}.srt"
)
)
}
} }
override suspend fun loadLinks( private fun getBaseUrl(url: String): String {
data: String, return URI(url).let {
isCasting: Boolean, "${it.scheme}://${it.host}"
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
data.removeSurrounding("[", "]").split(",").map { it.trim() }.apmap { link ->
safeApiCall {
when {
link.startsWith(mainServer) -> invokeLokalSource(
link,
subtitleCallback,
callback
)
link.startsWith("https://kotakajair.xyz") -> invokeKotakAjairSource(
link,
subtitleCallback,
callback
)
else -> {
loadExtractor(link, "$mainUrl/", subtitleCallback, callback)
if (link.startsWith("https://sbfull.com")) {
val response = app.get(
link, interceptor = WebViewResolver(
Regex("""\.srt""")
)
)
subtitleCallback.invoke(
SubtitleFile(
"Indonesian",
response.url
)
)
}
}
}
}
} }
return true
} }
private data class Tracks( private data class Tracks(
@ -288,27 +242,5 @@ open class RebahinProvider : MainAPI() {
@JsonProperty("kind") val kind: String? = null @JsonProperty("kind") val kind: String? = null
) )
private data class Captions(
@JsonProperty("id") val id: String,
@JsonProperty("hash") val hash: String,
@JsonProperty("language") val language: String,
)
private data class Data(
@JsonProperty("file") val file: String,
@JsonProperty("label") val label: String,
)
private data class Player(
@JsonProperty("poster_file") val poster_file: String,
)
private data class ResponseKotakAjair(
@JsonProperty("success") val success: Boolean,
@JsonProperty("player") val player: Player,
@JsonProperty("data") val data: List<Data>?,
@JsonProperty("captions") val captions: List<Captions>?
)
} }

File diff suppressed because it is too large Load diff

View file

@ -477,7 +477,7 @@ suspend fun invokeSmashyFm(
M3u8Helper.generateM3u8( M3u8Helper.generateM3u8(
"Smashy [$name]", "Smashy [$name]",
source.removeProxy(), source.removeProxy(),
"https://vidstream.pro/" "https://vidplay.site/"
).forEach(callback) ).forEach(callback)
} }
@ -1038,6 +1038,33 @@ fun generateWpKey(r: String, m: String): String {
return n return n
} }
suspend fun loadCustomTagExtractor(
tag: String? = null,
url: String,
referer: String? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
quality: Int? = null,
) {
loadExtractor(url, referer, subtitleCallback) { link ->
callback.invoke(
ExtractorLink(
link.source,
"${link.name} $tag",
link.url,
link.referer,
when (link.type) {
ExtractorLinkType.M3U8 -> link.quality
else -> quality ?: link.quality
},
link.type,
link.headers,
link.extractorData
)
)
}
}
suspend fun loadCustomExtractor( suspend fun loadCustomExtractor(
name: String? = null, name: String? = null,
url: String, url: String,