forked from recloudstream/cloudstream
fix LayarKacaProvider (#1388)
This commit is contained in:
parent
0d86e80953
commit
02b8da0c45
2 changed files with 22 additions and 20 deletions
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue