fix LayarKacaProvider (#1388)

This commit is contained in:
Hexated 2022-08-03 07:03:15 +07:00 committed by GitHub
parent 0d86e80953
commit 02b8da0c45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 20 deletions

View file

@ -9,7 +9,6 @@ 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
import java.util.ArrayList
class IdlixProvider : MainAPI() { class IdlixProvider : MainAPI() {
override var mainUrl = "https://94.103.82.88" override var mainUrl = "https://94.103.82.88"
@ -37,7 +36,7 @@ class IdlixProvider : MainAPI() {
): HomePageResponse { ): HomePageResponse {
val url = request.data.split("?") val url = request.data.split("?")
val document = app.get("${url.first()}$page/?${url.lastOrNull()}").document val document = app.get("${url.first()}$page/?${url.lastOrNull()}").document
val home = document.select("div.items.full article").mapNotNull { val home = document.select("div.items.full article, div#archive-content article").mapNotNull {
it.toSearchResult() it.toSearchResult()
} }
return newHomePageResponse(request.name, home) return newHomePageResponse(request.name, home)

View file

@ -139,25 +139,28 @@ class LayarKacaProvider : MainAPI() {
val document = app.get(data).document val document = app.get(data).document
val sources = if (data.contains("-episode-")) { // maybe will need this in future
document.select("script").mapNotNull { script -> // val sources = if (data.contains("-episode-")) {
if (script.data().contains("var data =")) { // document.select("script").mapNotNull { script ->
val scriptData = // if (script.data().contains("var data =")) {
script.toString().substringAfter("var data = '").substringBefore("';") // val scriptData =
Jsoup.parse(scriptData).select("li").map { // script.toString().substringAfter("var data = '").substringBefore("';")
fixUrl(it.select("a").attr("href")) // Jsoup.parse(scriptData).select("li").map {
} // fixUrl(it.select("a").attr("href"))
} else { // }
null // } else {
} // null
}[0] // }
} else { // }[0]
// } else {
// document.select("ul#loadProviders > li").map {
// fixUrl(it.select("a").attr("href"))
// }
// }
document.select("ul#loadProviders > li").map { document.select("ul#loadProviders > li").map {
fixUrl(it.select("a").attr("href")) fixUrl(it.select("a").attr("href"))
} }.apmap {
}
sources.apmap {
val link = if (it.startsWith("https://layarkacaxxi.icu")) { val link = if (it.startsWith("https://layarkacaxxi.icu")) {
it.substringBeforeLast("/") it.substringBeforeLast("/")
} else { } else {