fixed Idlix

This commit is contained in:
hexated 2023-03-28 11:50:08 +07:00
parent 672c540608
commit a83cb83bf1
2 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 9 version = 10
cloudstream { cloudstream {

View File

@ -10,7 +10,7 @@ import org.jsoup.nodes.Element
import java.net.URI import java.net.URI
class IdlixProvider : MainAPI() { class IdlixProvider : MainAPI() {
override var mainUrl = "https://91.201.113.103" override var mainUrl = "https://idlixian.com"
private var directUrl = mainUrl private var directUrl = mainUrl
override var name = "Idlix" override var name = "Idlix"
override val hasMainPage = true override val hasMainPage = true
@ -46,11 +46,13 @@ class IdlixProvider : MainAPI() {
): HomePageResponse { ): HomePageResponse {
val url = request.data.split("?") val url = request.data.split("?")
val nonPaged = request.name == "Featured" && page <= 1 val nonPaged = request.name == "Featured" && page <= 1
val document = if (nonPaged) { val req = if (nonPaged) {
app.get(request.data).document app.get(request.data)
} else { } else {
app.get("${url.first()}$page/?${url.lastOrNull()}").document app.get("${url.first()}$page/?${url.lastOrNull()}")
} }
mainUrl = getBaseUrl(req.url)
val document = req.document
val home = (if (nonPaged) { val home = (if (nonPaged) {
document.select("div.items.featured article") document.select("div.items.featured article")
} else { } else {
@ -92,9 +94,9 @@ class IdlixProvider : MainAPI() {
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val link = "$mainUrl/search/$query" val req = app.get("$mainUrl/search/$query")
val document = app.get(link).document mainUrl = getBaseUrl(req.url)
val document = req.document
return document.select("div.result-item").map { return document.select("div.result-item").map {
val title = val title =
it.selectFirst("div.title > a")!!.text().replace(Regex("\\(\\d{4}\\)"), "").trim() it.selectFirst("div.title > a")!!.text().replace(Regex("\\(\\d{4}\\)"), "").trim()