fix(es/legionanime): Error handling (#2319)
This commit is contained in:
committed by
GitHub
parent
8f4b5d99ce
commit
a96ff5b61c
@ -5,7 +5,7 @@ ext {
|
||||
extName = 'LegionAnime'
|
||||
pkgNameSuffix = 'es.legionanime'
|
||||
extClass = '.LegionAnime'
|
||||
extVersionCode = 27
|
||||
extVersionCode = 28
|
||||
libVersion = '13'
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,11 @@ class LegionAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
}
|
||||
}
|
||||
url.contains("jkanime") -> {
|
||||
listOf(JkanimeExtractor(client).getDesuFromUrl(url))
|
||||
try {
|
||||
listOf(JkanimeExtractor(client).getDesuFromUrl(url))
|
||||
} catch (_: Exception) {
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
url.contains("/stream/amz.php?") -> {
|
||||
try {
|
||||
|
@ -33,7 +33,8 @@ class JkanimeExtractor(
|
||||
}
|
||||
|
||||
fun getDesuFromUrl(url: String): Video {
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
val headers = Headers.Builder().add("Referer", "https://jkanime.net/").build()
|
||||
val document = client.newCall(GET(url, headers)).execute().asJsoup()
|
||||
val script = document.selectFirst("script:containsData(var parts = {)")!!.data()
|
||||
val streamUrl = script.substringAfter("url: '").substringBefore("'")
|
||||
return Video(streamUrl, "Desu", streamUrl)
|
||||
|
Reference in New Issue
Block a user