mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed LayarKaca
This commit is contained in:
parent
b31f705c3e
commit
89230ce991
2 changed files with 17 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -8,9 +8,9 @@ import com.lagradost.cloudstream3.utils.loadExtractor
|
|||
import org.jsoup.nodes.Element
|
||||
|
||||
class LayarKacaProvider : MainAPI() {
|
||||
override var mainUrl = "https://lk21official.art"
|
||||
override var mainUrl = "https://lk21official.info"
|
||||
// private val redirectUrl = "https://nd21x1.github.io"
|
||||
private val seriesUrl = "https://nontondrama.icu"
|
||||
private val seriesUrl = "https://drama.nontondrama.lol"
|
||||
override var name = "LayarKaca"
|
||||
override val hasMainPage = true
|
||||
override var lang = "id"
|
||||
|
@ -49,21 +49,21 @@ class LayarKacaProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun changesUrl(url: String): String {
|
||||
val startsWithNoHttp = url.startsWith("//")
|
||||
if (startsWithNoHttp) {
|
||||
return "https:$url"
|
||||
} else {
|
||||
if (url.startsWith('/')) {
|
||||
return seriesUrl + url
|
||||
}
|
||||
return "$seriesUrl/$url"
|
||||
}
|
||||
}
|
||||
// private fun changesUrl(url: String): String {
|
||||
// val startsWithNoHttp = url.startsWith("//")
|
||||
// if (startsWithNoHttp) {
|
||||
// return "https:$url"
|
||||
// } else {
|
||||
// if (url.startsWith('/')) {
|
||||
// return seriesUrl + url
|
||||
// }
|
||||
// return "$seriesUrl/$url"
|
||||
// }
|
||||
// }
|
||||
|
||||
private fun Element.toSearchResult(): SearchResponse? {
|
||||
val title = this.selectFirst("h1.grid-title > a")?.ownText()?.trim() ?: return null
|
||||
val href = fixUrl(this.selectFirst("a")!!.attr("href"))
|
||||
val href = getProperLink(this.selectFirst("a")!!.attr("href"), title)
|
||||
val posterUrl = fixUrlNull(this.selectFirst(".grid-poster > a > img")?.attr("src"))
|
||||
val type =
|
||||
if (this.selectFirst("div.last-episode") == null) TvType.Movie else TvType.TvSeries
|
||||
|
@ -130,7 +130,7 @@ class LayarKacaProvider : MainAPI() {
|
|||
|
||||
return if (tvType == TvType.TvSeries) {
|
||||
val episodes = document.select("div.episode-list > a:matches(\\d+)").map {
|
||||
val href = changesUrl(it.attr("href"))
|
||||
val href = fixUrl(it.attr("href"))
|
||||
val episode = it.text().toIntOrNull()
|
||||
val season =
|
||||
it.attr("href").substringAfter("season-").substringBefore("-").toIntOrNull()
|
||||
|
|
Loading…
Reference in a new issue