mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
Aniworld: fix langKey
This commit is contained in:
parent
4e962508b7
commit
1ebde0308d
1 changed files with 5 additions and 10 deletions
|
@ -7,6 +7,7 @@ import com.lagradost.cloudstream3.extractors.Voe
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
class Aniworld : MainAPI() {
|
class Aniworld : MainAPI() {
|
||||||
|
@ -135,7 +136,7 @@ class Aniworld : MainAPI() {
|
||||||
}.apmap {
|
}.apmap {
|
||||||
val redirectUrl = app.get(fixUrl(it.second)).url
|
val redirectUrl = app.get(fixUrl(it.second)).url
|
||||||
loadExtractor(redirectUrl, data, subtitleCallback) { link ->
|
loadExtractor(redirectUrl, data, subtitleCallback) { link ->
|
||||||
val name = "${link.name} [${it.first.getLanguage()}]"
|
val name = "${link.name} [${it.first.getLanguage(document)}]"
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
name,
|
name,
|
||||||
|
@ -163,15 +164,9 @@ class Aniworld : MainAPI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String.getLanguage() : String {
|
private fun String.getLanguage(document: Document): String? {
|
||||||
return when(this) {
|
return document.selectFirst("div.changeLanguageBox img[data-lang-key=$this]")?.attr("title")
|
||||||
"1" -> "Deutsch"
|
?.removePrefix("mit")?.trim()
|
||||||
"2" -> "Untertitel Deutsch"
|
|
||||||
"3" -> "Untertitel Englisch"
|
|
||||||
else -> {
|
|
||||||
""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class AnimeSearch(
|
private data class AnimeSearch(
|
||||||
|
|
Loading…
Reference in a new issue