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 {
|
||||
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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue