9Anime: episode-list right order (#1143)
* 9Anime: episode-list right order * Update build.gradle * Update NineAnime.kt
This commit is contained in:
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = '9anime'
|
extName = '9anime'
|
||||||
pkgNameSuffix = 'en.nineanime'
|
pkgNameSuffix = 'en.nineanime'
|
||||||
extClass = '.NineAnime'
|
extClass = '.NineAnime'
|
||||||
extVersionCode = 23
|
extVersionCode = 24
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class JsInterceptor(private val lang: String) : Interceptor {
|
|||||||
|
|
||||||
val jsinterface = JsObject(latch)
|
val jsinterface = JsObject(latch)
|
||||||
|
|
||||||
//JavaSrcipt gets the Dub or Sub link of vidstream
|
// JavaSrcipt gets the Dub or Sub link of vidstream
|
||||||
val jsScript = """
|
val jsScript = """
|
||||||
(function(){
|
(function(){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
@ -49,7 +49,7 @@ class JsVizInterceptor(private val embedLink: String) : Interceptor {
|
|||||||
|
|
||||||
val jsinterface = JsObject(latch)
|
val jsinterface = JsObject(latch)
|
||||||
|
|
||||||
//JavaSrcipt creates Iframe on vidstream page to bypass iframe-cors and gets the sourceUrl
|
// JavaSrcipt creates Iframe on vidstream page to bypass iframe-cors and gets the sourceUrl
|
||||||
val jsScript = """
|
val jsScript = """
|
||||||
(function(){
|
(function(){
|
||||||
const html = '<iframe src="$embedLink" allow="autoplay; fullscreen" allowfullscreen="yes" scrolling="no" style="width: 100%; height: 100%; overflow: hidden;" frameborder="no"></iframe>';
|
const html = '<iframe src="$embedLink" allow="autoplay; fullscreen" allowfullscreen="yes" scrolling="no" style="width: 100%; height: 100%; overflow: hidden;" frameborder="no"></iframe>';
|
||||||
|
@ -23,7 +23,6 @@ import kotlinx.serialization.json.jsonArray
|
|||||||
import kotlinx.serialization.json.jsonObject
|
import kotlinx.serialization.json.jsonObject
|
||||||
import kotlinx.serialization.json.jsonPrimitive
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
@ -74,8 +73,8 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
val vrf = jsVrfInterceptor.newCall(GET("$baseUrl/filter")).execute().request.header("url").toString()
|
val vrf = jsVrfInterceptor.newCall(GET("$baseUrl/filter")).execute().request.header("url").toString()
|
||||||
return GET("$baseUrl/ajax/episode/list/$id?vrf=$vrf", headers = Headers.headersOf("url", anime.url))
|
return GET("$baseUrl/ajax/episode/list/$id?vrf=$vrf", headers = Headers.headersOf("url", anime.url))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <A, B> Iterable<A>.parallelMap(f: suspend (A) -> B): List<B> =
|
private fun <A, B> Iterable<A>.parallelMap(f: suspend (A) -> B): List<B> =
|
||||||
runBlocking {
|
runBlocking {
|
||||||
map { async(Dispatchers.Default) { f(it) } }.awaitAll()
|
map { async(Dispatchers.Default) { f(it) } }.awaitAll()
|
||||||
}
|
}
|
||||||
@ -85,7 +84,7 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
val responseObject = json.decodeFromString<JsonObject>(response.body!!.string())
|
val responseObject = json.decodeFromString<JsonObject>(response.body!!.string())
|
||||||
val document = Jsoup.parse(JSONUtil.unescape(responseObject["result"]!!.jsonPrimitive.content))
|
val document = Jsoup.parse(JSONUtil.unescape(responseObject["result"]!!.jsonPrimitive.content))
|
||||||
val episodeElements = document.select(episodeListSelector())
|
val episodeElements = document.select(episodeListSelector())
|
||||||
return episodeElements.parallelMap { episodeFromElements(it, animeUrl) }
|
return episodeElements.parallelMap { episodeFromElements(it, animeUrl) }.reversed()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun episodeListSelector() = "div.episodes ul > li > a"
|
override fun episodeListSelector() = "div.episodes ul > li > a"
|
||||||
@ -231,7 +230,7 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
anime.title = document.select("h1.title").text()
|
anime.title = document.select("h1.title").text()
|
||||||
anime.genre = document.select("div:contains(Genre) > span > a").joinToString { it.text() }
|
anime.genre = document.select("div:contains(Genre) > span > a").joinToString { it.text() }
|
||||||
anime.description = document.select("div.synopsis > div.shorting > div.content").text()
|
anime.description = document.select("div.synopsis > div.shorting > div.content").text()
|
||||||
anime.author = document.select("div:contains(Studios) > span > a").text()
|
anime.author = document.select("div:contains(Studio) > span > a").text()
|
||||||
anime.status = parseStatus(document.select("div:contains(Status) > span").text())
|
anime.status = parseStatus(document.select("div:contains(Status) > span").text())
|
||||||
|
|
||||||
// add alternative name to anime description
|
// add alternative name to anime description
|
||||||
|
Reference in New Issue
Block a user