mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fix #568
This commit is contained in:
parent
15d9b5955b
commit
f455ec8905
3 changed files with 77 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 5
|
version = 6
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -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,18 +89,19 @@ 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 =
|
||||||
val episode = eps.text().filter { it.isDigit() }.toIntOrNull()
|
document.select("div.page-links span.page-link-number").mapNotNull { eps ->
|
||||||
val link = if(episode == 1) {
|
val episode = eps.text().filter { it.isDigit() }.toIntOrNull()
|
||||||
url
|
val link = if (episode == 1) {
|
||||||
} else {
|
url
|
||||||
eps.parent()?.attr("href")
|
} else {
|
||||||
|
eps.parent()?.attr("href")
|
||||||
|
}
|
||||||
|
Episode(
|
||||||
|
link ?: return@mapNotNull null,
|
||||||
|
episode = episode,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Episode(
|
|
||||||
link ?: return@mapNotNull null,
|
|
||||||
episode = episode,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return newTvSeriesLoadResponse(title, url, TvType.AsianDrama, episodes = episodes) {
|
return newTvSeriesLoadResponse(title, url, TvType.AsianDrama, episodes = episodes) {
|
||||||
posterUrl = poster
|
posterUrl = poster
|
||||||
this.year = year
|
this.year = year
|
||||||
|
@ -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("')")
|
||||||
val iMovie = iLink.substringAfter("movie=").substringBefore("&")
|
serverUrl = getBaseUrl(iLink)
|
||||||
val mIframe = iLink.substringAfter("iframe=")
|
val iMovie = iLink.substringAfter("movie=").substringBefore("&")
|
||||||
val iUrl = "$serverUrl/stream/$mIframe.php?movie=$iMovie"
|
val mIframe = iLink.substringAfter("iframe=")
|
||||||
if(mIframe == "getbk") {
|
val serverName = fixTitle(mIframe)
|
||||||
invokeGetbk(iUrl, callback)
|
when (mIframe) {
|
||||||
} else {
|
"getbk" -> {
|
||||||
val link = app.get(
|
invokeGetbk(
|
||||||
iUrl,
|
serverName,
|
||||||
referer = "$serverUrl/"
|
"$serverUrl/stream/$mIframe.php?movie=$iMovie",
|
||||||
).document.selectFirst("iframe")?.attr("src") ?: return@apmap null
|
callback
|
||||||
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,
|
||||||
|
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue