From 0d86e80953693876c6b47f7811a766c453604dac Mon Sep 17 00:00:00 2001 From: Hexated <37908684+hexated@users.noreply.github.com> Date: Wed, 3 Aug 2022 03:34:12 +0700 Subject: [PATCH] fix missing subtitle in Kisskh (#1387) --- .../movieproviders/IdlixProvider.kt | 2 +- .../movieproviders/KisskhProvider.kt | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/IdlixProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/IdlixProvider.kt index fe9aaa10..4b185ad5 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/IdlixProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/IdlixProvider.kt @@ -37,7 +37,7 @@ class IdlixProvider : MainAPI() { ): HomePageResponse { val url = request.data.split("?") val document = app.get("${url.first()}$page/?${url.lastOrNull()}").document - val home = document.select("article").mapNotNull { + val home = document.select("div.items.full article").mapNotNull { it.toSearchResult() } return newHomePageResponse(request.name, home) diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/KisskhProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/KisskhProvider.kt index b914dee8..c8172fb6 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/KisskhProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/KisskhProvider.kt @@ -55,7 +55,8 @@ class KisskhProvider : MainAPI() { } override suspend fun search(query: String): List { - val searchResponse = app.get("$mainUrl/api/DramaList/Search?q=$query&type=0", referer = "$mainUrl/").text + val searchResponse = + app.get("$mainUrl/api/DramaList/Search?q=$query&type=0", referer = "$mainUrl/").text return tryParseJson>(searchResponse)?.mapNotNull { media -> media.toSearchResponse() } ?: throw ErrorLoadingException("Invalid Json reponse") @@ -142,13 +143,16 @@ class KisskhProvider : MainAPI() { } } - app.get("$mainUrl/api/Sub/${loadData.epsId}").parsedSafe>()?.map { sub -> - subtitleCallback.invoke( - SubtitleFile( - getLanguage(sub.label ?: return@map), - sub.src ?: return@map + // parsedSafe doesn't work in > + app.get("$mainUrl/api/Sub/${loadData.epsId}").text.let { res -> + tryParseJson>(res)?.map { sub -> + subtitleCallback.invoke( + SubtitleFile( + getLanguage(sub.label ?: return@map), + sub.src ?: return@map + ) ) - ) + } } return true