This commit is contained in:
Olivia 2024-02-01 15:26:41 +07:00
parent 15d9b5955b
commit f455ec8905
3 changed files with 77 additions and 32 deletions

View File

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

View File

@ -6,13 +6,14 @@ import com.lagradost.cloudstream3.extractors.Filesim
import com.lagradost.cloudstream3.utils.AppUtils import com.lagradost.cloudstream3.utils.AppUtils
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.INFER_TYPE import com.lagradost.cloudstream3.utils.INFER_TYPE
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.getQualityFromName import com.lagradost.cloudstream3.utils.getQualityFromName
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import java.net.URI
class DramaSerial : MainAPI() { class DramaSerial : MainAPI() {
override var mainUrl = "https://tv3.dramaserial.id" override var mainUrl = "https://tv3.dramaserial.id"
private var serverUrl = "http://31.220.73.179/" private var serverUrl = "https://juraganfilm.info"
override var name = "DramaSerial" override var name = "DramaSerial"
override val hasMainPage = true override val hasMainPage = true
override var lang = "id" override var lang = "id"
@ -72,8 +73,12 @@ class DramaSerial : MainAPI() {
val duration = val duration =
document.selectFirst("div.gmr-movie-innermeta span:contains(Duration:)")?.text() document.selectFirst("div.gmr-movie-innermeta span:contains(Duration:)")?.text()
?.filter { it.isDigit() }?.toIntOrNull() ?.filter { it.isDigit() }?.toIntOrNull()
val description = document.select("div.entry-content.entry-content-single div.entry-content.entry-content-single").text().trim() val description =
val type = if(document.select("div.page-links").isNullOrEmpty()) TvType.Movie else TvType.AsianDrama document.select("div.entry-content.entry-content-single div.entry-content.entry-content-single")
.text().trim()
val type = if (document.select("div.page-links")
.isNullOrEmpty()
) TvType.Movie else TvType.AsianDrama
if (type == TvType.Movie) { if (type == TvType.Movie) {
return newMovieLoadResponse(title, url, TvType.Movie, url) { return newMovieLoadResponse(title, url, TvType.Movie, url) {
@ -84,9 +89,10 @@ class DramaSerial : MainAPI() {
this.duration = duration this.duration = duration
} }
} else { } else {
val episodes = document.select("div.page-links span.page-link-number").mapNotNull { eps -> val episodes =
document.select("div.page-links span.page-link-number").mapNotNull { eps ->
val episode = eps.text().filter { it.isDigit() }.toIntOrNull() val episode = eps.text().filter { it.isDigit() }.toIntOrNull()
val link = if(episode == 1) { val link = if (episode == 1) {
url url
} else { } else {
eps.parent()?.attr("href") eps.parent()?.attr("href")
@ -107,6 +113,7 @@ class DramaSerial : MainAPI() {
} }
private suspend fun invokeGetbk( private suspend fun invokeGetbk(
name: String,
url: String, url: String,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
@ -115,12 +122,12 @@ class DramaSerial : MainAPI() {
referer = "$serverUrl/" referer = "$serverUrl/"
).document.selectFirst("script:containsData(sources)")?.data() ?: return ).document.selectFirst("script:containsData(sources)")?.data() ?: return
val json = "\"sources\":\\s*\\[(.*)]".toRegex().find(script)?.groupValues?.get(1) val json = "sources:\\s*\\[(.*)]".toRegex().find(script)?.groupValues?.get(1)
AppUtils.tryParseJson<ArrayList<Sources>>("[$json]")?.map { AppUtils.tryParseJson<ArrayList<Sources>>("[$json]")?.map {
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
"Getbk", name,
"Getbk", name,
it.file ?: return@map, it.file ?: return@map,
"$serverUrl/", "$serverUrl/",
getQualityFromName(it.label), getQualityFromName(it.label),
@ -131,6 +138,34 @@ class DramaSerial : MainAPI() {
} }
private suspend fun invokeGdrive(
name: String,
url: String,
callback: (ExtractorLink) -> Unit
) {
val embedUrl = app.get(
url,
referer = "$serverUrl/"
).document.selectFirst("iframe")?.attr("src")?.let { fixUrl(it) } ?: return
val req = app.get(embedUrl)
val host = getBaseUrl(embedUrl)
val token = req.document.selectFirst("div#token")?.text() ?: return
callback.invoke(
ExtractorLink(
name,
name,
"$host/hlsplaylist.php?idhls=${token.trim()}.m3u8",
"$host/",
Qualities.Unknown.value,
true
)
)
}
override suspend fun loadLinks( override suspend fun loadLinks(
data: String, data: String,
isCasting: Boolean, isCasting: Boolean,
@ -142,19 +177,23 @@ class DramaSerial : MainAPI() {
val iframe = document.select("iframe[name=juraganfilm]").attr("src") val iframe = document.select("iframe[name=juraganfilm]").attr("src")
app.get(iframe, referer = "$mainUrl/").document.select("div#header-slider ul li") app.get(iframe, referer = "$mainUrl/").document.select("div#header-slider ul li")
.apmap { mLink -> .apmap { mLink ->
mLink.attr("onclick").substringAfter("frame('").substringBefore("')").let { iLink -> val iLink = mLink.attr("onclick").substringAfter("frame('").substringBefore("')")
serverUrl = getBaseUrl(iLink)
val iMovie = iLink.substringAfter("movie=").substringBefore("&") val iMovie = iLink.substringAfter("movie=").substringBefore("&")
val mIframe = iLink.substringAfter("iframe=") val mIframe = iLink.substringAfter("iframe=")
val iUrl = "$serverUrl/stream/$mIframe.php?movie=$iMovie" val serverName = fixTitle(mIframe)
if(mIframe == "getbk") { when (mIframe) {
invokeGetbk(iUrl, callback) "getbk" -> {
} else { invokeGetbk(
val link = app.get( serverName,
iUrl, "$serverUrl/stream/$mIframe.php?movie=$iMovie",
referer = "$serverUrl/" callback
).document.selectFirst("iframe")?.attr("src") ?: return@apmap null )
loadExtractor(fixUrl(link), "$serverUrl/", subtitleCallback, callback)
} }
"gdrivehls", "gdriveplayer" -> {
invokeGdrive(serverName, iLink, callback)
}
else -> {}
} }
} }
@ -162,6 +201,12 @@ class DramaSerial : MainAPI() {
} }
private fun getBaseUrl(url: String): String {
return URI(url).let {
"${it.scheme}://${it.host}"
}
}
private data class Sources( private data class Sources(
@JsonProperty("file") val file: String? = null, @JsonProperty("file") val file: String? = null,
@JsonProperty("label") val label: String? = null, @JsonProperty("label") val label: String? = null,

View File

@ -23,5 +23,5 @@ cloudstream {
"Movie", "Movie",
) )
iconUrl = "https://www.google.com/s2/favicons?domain=raveeflix.my.id&sz=%size%" iconUrl = "https://raveeflix.my.id/favicon.ico"
} }