From a6cc814294ad3562f0d62615b63d6120e081bb3d Mon Sep 17 00:00:00 2001 From: hexated Date: Sun, 2 Oct 2022 13:38:07 +0700 Subject: [PATCH] fixed image in search Loklok --- Loklok/build.gradle.kts | 2 +- Loklok/src/main/kotlin/com/hexated/Loklok.kt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Loklok/build.gradle.kts b/Loklok/build.gradle.kts index 8f4f1a63..73838069 100644 --- a/Loklok/build.gradle.kts +++ b/Loklok/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 6 +version = 7 cloudstream { diff --git a/Loklok/src/main/kotlin/com/hexated/Loklok.kt b/Loklok/src/main/kotlin/com/hexated/Loklok.kt index 95932f10..a57d9d61 100644 --- a/Loklok/src/main/kotlin/com/hexated/Loklok.kt +++ b/Loklok/src/main/kotlin/com/hexated/Loklok.kt @@ -33,6 +33,7 @@ class Loklok : MainAPI() { companion object { private val api = base64Decode("aHR0cHM6Ly9nYS1tb2JpbGUtYXBpLmxva2xvay50dg==") private val apiUrl = "$api/${base64Decode("Y21zL2FwcA==")}" + private val searchApi = base64Decode("aHR0cHM6Ly9sb2tsb2suY29t") private const val mainImageUrl = "https://images.weserv.nl" } @@ -72,7 +73,7 @@ class Loklok : MainAPI() { override suspend fun search(query: String): List { val res = app.get( - "https://loklok.com/search?keyword=$query", + "$searchApi/search?keyword=$query", ).document val script = res.select("script").find { it.data().contains("function(a,b,c,d,e") }?.data() @@ -83,7 +84,7 @@ class Loklok : MainAPI() { val data = block.selectFirst("a")?.attr("href")?.split("/") val id = data?.last() val type = data?.get(2)?.toInt() - val image = Regex("coverVerticalUrl:\"(\\S+?)\",").findAll(script.toString()) + val image = Regex("coverVerticalUrl:\"(.*?)\",").findAll(script.toString()) .map { it.groupValues[1] }.toList().getOrNull(num)?.replace("\\u002F", "/")