mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
Layarkaca: domain changed
This commit is contained in:
parent
1d3c3c2ea5
commit
aab4bfdf33
2 changed files with 20 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 8
|
version = 9
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -6,12 +6,12 @@ import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import java.net.URI
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
|
|
||||||
class LayarKacaProvider : MainAPI() {
|
class LayarKacaProvider : MainAPI() {
|
||||||
override var mainUrl = "https://lk21official.vip"
|
override var mainUrl = "https://a.lk21official.lol"
|
||||||
// private val redirectUrl = "https://nd21x1.github.io"
|
private var seriesUrl = "https://drama2.nontondrama.lol"
|
||||||
private val seriesUrl = "https://drama1.nontondrama.lol"
|
|
||||||
override var name = "LayarKaca"
|
override var name = "LayarKaca"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override var lang = "id"
|
override var lang = "id"
|
||||||
|
@ -35,7 +35,17 @@ class LayarKacaProvider : MainAPI() {
|
||||||
page: Int,
|
page: Int,
|
||||||
request: MainPageRequest
|
request: MainPageRequest
|
||||||
): HomePageResponse {
|
): HomePageResponse {
|
||||||
val document = app.get(request.data + page).document
|
val res = app.get(request.data + page)
|
||||||
|
val baseUrl = getBaseUrl(res.url)
|
||||||
|
when {
|
||||||
|
request.data.startsWith(mainUrl) -> {
|
||||||
|
mainUrl = baseUrl
|
||||||
|
}
|
||||||
|
request.data.startsWith(seriesUrl) -> {
|
||||||
|
seriesUrl = baseUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val document = res.document
|
||||||
val home = document.select("article.mega-item").mapNotNull {
|
val home = document.select("article.mega-item").mapNotNull {
|
||||||
it.toSearchResult()
|
it.toSearchResult()
|
||||||
}
|
}
|
||||||
|
@ -87,7 +97,6 @@ class LayarKacaProvider : MainAPI() {
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse> {
|
override suspend fun search(query: String): List<SearchResponse> {
|
||||||
val document = app.get("$mainUrl/?s=$query").document
|
val document = app.get("$mainUrl/?s=$query").document
|
||||||
|
|
||||||
return document.select("div.search-item").map {
|
return document.select("div.search-item").map {
|
||||||
val title = it.selectFirst("h2 > a")!!.text().trim()
|
val title = it.selectFirst("h2 > a")!!.text().trim()
|
||||||
val type = it.selectFirst("p.cat-links a")?.attr("href").toString()
|
val type = it.selectFirst("p.cat-links a")?.attr("href").toString()
|
||||||
|
@ -212,6 +221,11 @@ class LayarKacaProvider : MainAPI() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getBaseUrl(url: String): String {
|
||||||
|
return URI(url).let {
|
||||||
|
"${it.scheme}://${it.host}"
|
||||||
|
}
|
||||||
|
}
|
||||||
private fun decode(input: String): String = URLDecoder.decode(input, "utf-8").replace(" ", "%20")
|
private fun decode(input: String): String = URLDecoder.decode(input, "utf-8").replace(" ", "%20")
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue