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 { ): 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)

View file

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