[AnimeOwl] fix: Video list + Episode list (#856)

This commit is contained in:
Khaled 2025-03-31 14:54:05 +06:00 committed by GitHub
parent a64dae4b23
commit 955fbed018
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 22 deletions

View file

@ -1,7 +1,7 @@
ext {
extName = 'AnimeOwl'
extClass = '.AnimeOwl'
extVersionCode = 22
extVersionCode = 23
}
apply from: "$rootDir/common.gradle"

View file

@ -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"),
)
}

View file

@ -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?,
)

View file

@ -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" })