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 org.jsoup.nodes.Element
import java.net.URI
import java.util.ArrayList
class IdlixProvider : MainAPI() {
override var mainUrl = "https://94.103.82.88"
@ -37,7 +36,7 @@ class IdlixProvider : MainAPI() {
): HomePageResponse {
val url = request.data.split("?")
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()
}
return newHomePageResponse(request.name, home)

View file

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