forked from recloudstream/cloudstream
fix missing subtitle in Kisskh (#1387)
This commit is contained in:
parent
9678b068ee
commit
0d86e80953
2 changed files with 12 additions and 8 deletions
|
@ -37,7 +37,7 @@ class IdlixProvider : MainAPI() {
|
||||||
): HomePageResponse {
|
): HomePageResponse {
|
||||||
val url = request.data.split("?")
|
val url = request.data.split("?")
|
||||||
val document = app.get("${url.first()}$page/?${url.lastOrNull()}").document
|
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()
|
it.toSearchResult()
|
||||||
}
|
}
|
||||||
return newHomePageResponse(request.name, home)
|
return newHomePageResponse(request.name, home)
|
||||||
|
|
|
@ -55,7 +55,8 @@ class KisskhProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(query: String): List<SearchResponse> {
|
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 ->
|
return tryParseJson<ArrayList<Media>>(searchResponse)?.mapNotNull { media ->
|
||||||
media.toSearchResponse()
|
media.toSearchResponse()
|
||||||
} ?: throw ErrorLoadingException("Invalid Json reponse")
|
} ?: throw ErrorLoadingException("Invalid Json reponse")
|
||||||
|
@ -142,7 +143,9 @@ class KisskhProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get("$mainUrl/api/Sub/${loadData.epsId}").parsedSafe<List<Subtitle>>()?.map { sub ->
|
// 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(
|
subtitleCallback.invoke(
|
||||||
SubtitleFile(
|
SubtitleFile(
|
||||||
getLanguage(sub.label ?: return@map),
|
getLanguage(sub.label ?: return@map),
|
||||||
|
@ -150,6 +153,7 @@ class KisskhProvider : MainAPI() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue