fixed subtitle in Kickassanime

This commit is contained in:
hexated 2023-01-22 05:30:13 +07:00
parent e1ad8d7bf6
commit ef7314139a

View file

@ -285,7 +285,7 @@ class Kickassanime : MainAPI() {
res?.subtitles?.map { sub -> res?.subtitles?.map { sub ->
subtitleCallback.invoke( subtitleCallback.invoke(
SubtitleFile( SubtitleFile(
sub.language ?: "", getLanguage(sub.language ?: return@map null) ?: sub.language,
sub.url ?: return@map null sub.url ?: return@map null
) )
) )
@ -371,6 +371,11 @@ class Kickassanime : MainAPI() {
} }
} }
private fun getLanguage(language: String?): String? {
return SubtitleHelper.fromTwoLettersToLanguage(language ?: return null)
?: SubtitleHelper.fromTwoLettersToLanguage(language.substringBefore("-"))
}
private fun fixUrl(url: String, domain: String): String { private fun fixUrl(url: String, domain: String): String {
if (url.startsWith("http")) { if (url.startsWith("http")) {
return url return url