feat(en/animeowl): Add 2K Quality

This commit is contained in:
Khaled 2025-04-21 11:13:51 +06:00
parent 4030234683
commit ea40e3672f
3 changed files with 14 additions and 6 deletions

View file

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

View file

@ -129,7 +129,7 @@ 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.attr("title").toDoubleOrNull(),
id = idx.toDouble(),
episodeIndex = idx.toString(),
name = it.attr("title"),
lang = "Sub",
@ -138,7 +138,7 @@ class AnimeOwl : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
}
val dub = document.select("#anime-cover-dub-content .episode-node").mapIndexed { idx, it ->
EpisodeResponse.Episode(
id = it.attr("title").toDoubleOrNull(),
id = idx.toDouble(),
episodeIndex = idx.toString(),
name = it.attr("title"),
lang = "Dub",
@ -301,6 +301,6 @@ class AnimeOwl : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private const val PREF_QUALITY_KEY = "preferred_quality"
private const val PREF_QUALITY_TITLE = "Preferred quality"
private const val PREF_QUALITY_DEFAULT = "1080p"
private val PREF_QUALITY_LIST = arrayOf("1080p", "720p", "480p", "360p")
private val PREF_QUALITY_LIST = arrayOf("2K", "1080p", "720p", "480p", "360p")
}
}

View file

@ -48,8 +48,13 @@ class OwlExtractor(private val client: OkHttpClient, private val baseUrl: String
luffy.forEach { stream ->
noRedirectClient.newCall(GET("${stream.url}$jwt")).execute()
.use { it.headers["Location"] }?.let {
val resolution = when {
stream.resolution?.endsWith("0") == true -> "${stream.resolution}p"
else -> stream.resolution
}
videoList.add(
Video(it, "${link.lang} Luffy:${stream.resolution}p", it),
Video(it, "${link.lang} Luffy:${resolution ?: "Unknown"}", it),
)
}
}
@ -83,7 +88,10 @@ class OwlExtractor(private val client: OkHttpClient, private val baseUrl: String
return client.newCall(GET(url)).execute().let { it ->
if (it.isSuccessful) {
it.parseAs<Stream>().url.let {
playlistUtils.extractFromHls(it, videoNameGen = { qty -> "$lang $server:${qty}p" })
playlistUtils.extractFromHls(
it,
videoNameGen = { qty -> "$lang $server:$qty" },
)
}
} else {
emptyList()