forked from AlmightyHak/extensions-source
[AnimeOwl] fix: Video list + Episode list (#856)
This commit is contained in:
parent
a64dae4b23
commit
955fbed018
4 changed files with 32 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
|||
ext {
|
||||
extName = 'AnimeOwl'
|
||||
extClass = '.AnimeOwl'
|
||||
extVersionCode = 22
|
||||
extVersionCode = 23
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -129,20 +129,20 @@ class AnimeOwl : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||
val document = response.asJsoup()
|
||||
val sub = document.select("#anime-cover-sub-content .episode-node").mapIndexed { idx, it ->
|
||||
EpisodeResponse.Episode(
|
||||
id = it.text().toDouble(),
|
||||
id = it.attr("title").toDoubleOrNull(),
|
||||
episodeIndex = idx.toString(),
|
||||
name = it.text(),
|
||||
name = it.attr("title"),
|
||||
lang = "Sub",
|
||||
href = it.attr("abs:href"),
|
||||
href = it.absUrl("href"),
|
||||
)
|
||||
}
|
||||
val dub = document.select("#anime-cover-dub-content .episode-node").mapIndexed { idx, it ->
|
||||
EpisodeResponse.Episode(
|
||||
id = it.text().toDouble(),
|
||||
id = it.attr("title").toDoubleOrNull(),
|
||||
episodeIndex = idx.toString(),
|
||||
name = it.text(),
|
||||
name = it.attr("title"),
|
||||
lang = "Dub",
|
||||
href = it.attr("abs:href"),
|
||||
href = it.absUrl("href"),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -53,12 +53,13 @@ data class Link(
|
|||
|
||||
@Serializable
|
||||
data class OwlServers(
|
||||
val kaido: String? = null,
|
||||
val luffy: String? = null,
|
||||
val zoro: String? = null,
|
||||
val kaido: List<Stream>? = null,
|
||||
val luffy: List<Stream>? = null,
|
||||
val zoro: List<Stream>? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Stream(
|
||||
val url: String,
|
||||
val resolution: String?,
|
||||
)
|
||||
|
|
|
@ -45,25 +45,34 @@ class OwlExtractor(private val client: OkHttpClient, private val baseUrl: String
|
|||
coroutineScope {
|
||||
val lufDeferred = async {
|
||||
servers.luffy?.let { luffy ->
|
||||
noRedirectClient.newCall(GET("${luffy}$jwt")).execute()
|
||||
.use { it.headers["Location"] }
|
||||
?.let { videoList.add(Video(it, "${link.lang} Luffy:1080p", it)) }
|
||||
luffy.forEach { stream ->
|
||||
noRedirectClient.newCall(GET("${stream.url}$jwt")).execute()
|
||||
.use { it.headers["Location"] }?.let {
|
||||
videoList.add(
|
||||
Video(it, "${link.lang} Luffy:${stream.resolution}", it),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val kaiDeferred = async {
|
||||
servers.kaido?.let {
|
||||
servers.kaido?.let { kaido ->
|
||||
kaido.forEach { stream ->
|
||||
videoList.addAll(
|
||||
getHLS("${it}$jwt", "Kaido", link.lang),
|
||||
getHLS("${stream.url}$jwt", "Kaido", link.lang),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
val zorDeferred = async {
|
||||
servers.zoro?.let {
|
||||
servers.zoro?.let { zoro ->
|
||||
zoro.forEach { stream ->
|
||||
videoList.addAll(
|
||||
getHLS("${it}$jwt", "Boa", link.lang),
|
||||
getHLS("${stream.url}$jwt", "Boa", link.lang),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
awaitAll(lufDeferred, kaiDeferred, zorDeferred)
|
||||
}
|
||||
|
@ -71,7 +80,7 @@ class OwlExtractor(private val client: OkHttpClient, private val baseUrl: String
|
|||
}
|
||||
|
||||
private fun getHLS(url: String, server: String, lang: String): List<Video> {
|
||||
return client.newCall(GET(url)).execute().let {
|
||||
return client.newCall(GET(url)).execute().let { it ->
|
||||
if (it.isSuccessful) {
|
||||
it.parseAs<Stream>().url.let {
|
||||
playlistUtils.extractFromHls(it, videoNameGen = { qty -> "$lang $server:$qty" })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue