fix missing subtitle in Kisskh (#1387)

This commit is contained in:
Hexated 2022-08-03 03:34:12 +07:00 committed by GitHub
parent 9678b068ee
commit 0d86e80953
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View file

@ -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)

View file

@ -55,7 +55,8 @@ class KisskhProvider : MainAPI() {
}
override suspend fun search(query: String): List<SearchResponse> {
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<ArrayList<Media>>(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<List<Subtitle>>()?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
getLanguage(sub.label ?: return@map),
sub.src ?: return@map
// parsedSafe doesn't work in <List<Object>>
app.get("$mainUrl/api/Sub/${loadData.epsId}").text.let { res ->
tryParseJson<List<Subtitle>>(res)?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
getLanguage(sub.label ?: return@map),
sub.src ?: return@map
)
)
)
}
}
return true