Merge branch 'Kohi-den:main' into newgrounds

This commit is contained in:
wasu 2025-04-02 17:10:43 +02:00 committed by GitHub
commit 7619d222be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 59 additions and 59 deletions

View file

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

View file

@ -129,20 +129,20 @@ class AnimeOwl : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
val document = response.asJsoup() val document = response.asJsoup()
val sub = document.select("#anime-cover-sub-content .episode-node").mapIndexed { idx, it -> val sub = document.select("#anime-cover-sub-content .episode-node").mapIndexed { idx, it ->
EpisodeResponse.Episode( EpisodeResponse.Episode(
id = it.text().toDouble(), id = it.attr("title").toDoubleOrNull(),
episodeIndex = idx.toString(), episodeIndex = idx.toString(),
name = it.text(), name = it.attr("title"),
lang = "Sub", lang = "Sub",
href = it.attr("abs:href"), href = it.absUrl("href"),
) )
} }
val dub = document.select("#anime-cover-dub-content .episode-node").mapIndexed { idx, it -> val dub = document.select("#anime-cover-dub-content .episode-node").mapIndexed { idx, it ->
EpisodeResponse.Episode( EpisodeResponse.Episode(
id = it.text().toDouble(), id = it.attr("title").toDoubleOrNull(),
episodeIndex = idx.toString(), episodeIndex = idx.toString(),
name = it.text(), name = it.attr("title"),
lang = "Dub", lang = "Dub",
href = it.attr("abs:href"), href = it.absUrl("href"),
) )
} }

View file

@ -53,12 +53,13 @@ data class Link(
@Serializable @Serializable
data class OwlServers( data class OwlServers(
val kaido: String? = null, val kaido: List<Stream>? = null,
val luffy: String? = null, val luffy: List<Stream>? = null,
val zoro: String? = null, val zoro: List<Stream>? = null,
) )
@Serializable @Serializable
data class Stream( data class Stream(
val url: String, val url: String,
val resolution: String?,
) )

View file

@ -45,25 +45,34 @@ class OwlExtractor(private val client: OkHttpClient, private val baseUrl: String
coroutineScope { coroutineScope {
val lufDeferred = async { val lufDeferred = async {
servers.luffy?.let { luffy -> servers.luffy?.let { luffy ->
noRedirectClient.newCall(GET("${luffy}$jwt")).execute() luffy.forEach { stream ->
.use { it.headers["Location"] } noRedirectClient.newCall(GET("${stream.url}$jwt")).execute()
?.let { videoList.add(Video(it, "${link.lang} Luffy:1080p", it)) } .use { it.headers["Location"] }?.let {
videoList.add(
Video(it, "${link.lang} Luffy:${stream.resolution}", it),
)
}
}
} }
} }
val kaiDeferred = async { val kaiDeferred = async {
servers.kaido?.let { servers.kaido?.let { kaido ->
kaido.forEach { stream ->
videoList.addAll( videoList.addAll(
getHLS("${it}$jwt", "Kaido", link.lang), getHLS("${stream.url}$jwt", "Kaido", link.lang),
) )
} }
} }
}
val zorDeferred = async { val zorDeferred = async {
servers.zoro?.let { servers.zoro?.let { zoro ->
zoro.forEach { stream ->
videoList.addAll( videoList.addAll(
getHLS("${it}$jwt", "Boa", link.lang), getHLS("${stream.url}$jwt", "Boa", link.lang),
) )
} }
} }
}
awaitAll(lufDeferred, kaiDeferred, zorDeferred) 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> { 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) { if (it.isSuccessful) {
it.parseAs<Stream>().url.let { it.parseAs<Stream>().url.let {
playlistUtils.extractFromHls(it, videoNameGen = { qty -> "$lang $server:$qty" }) playlistUtils.extractFromHls(it, videoNameGen = { qty -> "$lang $server:$qty" })

View file

@ -2,7 +2,7 @@ ext {
extName = 'AniPlay' extName = 'AniPlay'
extClass = '.AniPlay' extClass = '.AniPlay'
themePkg = 'anilist' themePkg = 'anilist'
overrideVersionCode = 14 overrideVersionCode = 15
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View file

@ -260,6 +260,14 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
} }
} }
private fun getProxiedUrl(originalUrl: String, serverName: String, referer: String?): String {
return when (serverName) {
"Yuki" -> "$PROXY_URL/yukiprox?url=$originalUrl"
"Pahe" -> "$PROXY_URL/fetch?url=$originalUrl?ref=$referer"
else -> return originalUrl
}
}
private fun processEpisodeData(episodeData: EpisodeData): List<Video> { private fun processEpisodeData(episodeData: EpisodeData): List<Video> {
val defaultSource = episodeData.response.sources?.firstOrNull { val defaultSource = episodeData.response.sources?.firstOrNull {
it.quality in listOf("default", "auto") it.quality in listOf("default", "auto")
@ -282,37 +290,19 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
} }
try { try {
if (episodeData.response.proxy == true) { val url = getProxiedUrl(defaultSource.url, serverName, episodeData.response.headers?.Referer)
var proxyUrl = "$PROXY_URL/fetch?url=${defaultSource.url}"
if (episodeData.response.headers != null && episodeData.response.headers.Referer?.startsWith("https://") == true) {
proxyUrl += "&ref=${episodeData.response.headers.Referer}"
}
return playlistUtils.extractFromHls( return playlistUtils.extractFromHls(
playlistUrl = proxyUrl, playlistUrl = url,
videoNameGen = { quality -> "$serverName - $quality - $typeName" },
subtitleList = subtitles,
)
}
if (episodeData.response.headers != null && episodeData.response.headers.Referer?.startsWith("https://") == true) {
return playlistUtils.extractFromHls(
playlistUrl = defaultSource.url,
videoNameGen = { quality -> "$serverName - $quality - $typeName" }, videoNameGen = { quality -> "$serverName - $quality - $typeName" },
subtitleList = subtitles, subtitleList = subtitles,
masterHeadersGen = { baseHeaders: Headers, _: String -> masterHeadersGen = { baseHeaders: Headers, _: String ->
baseHeaders.newBuilder().apply { baseHeaders.newBuilder().apply {
set("Accept", "*/*") set("Accept", "*/*")
set("Origin", baseUrl) set("Origin", baseUrl)
set("Referer", episodeData.response.headers.Referer) set("Referer", "$baseUrl/")
}.build() }.build()
}, },
) )
} else {
return playlistUtils.extractFromHls(
playlistUrl = defaultSource.url,
videoNameGen = { quality -> "$serverName - $quality - $typeName" },
subtitleList = subtitles,
)
}
} catch (e: Exception) { } catch (e: Exception) {
Log.e("AniPlay", "processEpisodeData extractFromHls Error (\"$serverName - $typeName\"): $e") Log.e("AniPlay", "processEpisodeData extractFromHls Error (\"$serverName - $typeName\"): $e")
} }
@ -536,15 +526,15 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
private val HEADER_NEXT_ACTION = mapOf( private val HEADER_NEXT_ACTION = mapOf(
PREF_DOMAIN_ENTRY_VALUES[0] to mapOf( PREF_DOMAIN_ENTRY_VALUES[0] to mapOf(
"NEXT_ACTION_EPISODE_LIST" to "7f245562e54103f7dc13b3f89743fe31492ae34d6d", "NEXT_ACTION_EPISODE_LIST" to "7f07777b5f74e3edb312e0b718a560f9d3ad21aeba",
"NEXT_ACTION_SOURCES_LIST" to "7fa64b02d2e6dc6a72c31b915844cb42a729b5e575", "NEXT_ACTION_SOURCES_LIST" to "7f11490e43dca1ed90fcb5b90bac1e5714a3e11232",
), ),
PREF_DOMAIN_ENTRY_VALUES[1] to mapOf( PREF_DOMAIN_ENTRY_VALUES[1] to mapOf(
"NEXT_ACTION_EPISODE_LIST" to "7f4b13f495ada236e47ada7923680d8264f2601e45", "NEXT_ACTION_EPISODE_LIST" to "7f57233b7a6486e8211b883c502fa0450775f0ee98",
"NEXT_ACTION_SOURCES_LIST" to "7f41e61d8806a49322bbe4746ff28a39e4dc098b6b", "NEXT_ACTION_SOURCES_LIST" to "7f48c7ffeb25edece852102a65d794a1dffa37aaac",
), ),
) )
private const val PROXY_URL = "https://aniplay-cors.yqizw7.easypanel.host" private const val PROXY_URL = "https://prox.aniplaynow.live"
private val DATE_FORMATTER = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) private val DATE_FORMATTER = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
} }