fix(en/aniplay): implemented proxy mechanic

This commit is contained in:
Josef František Straka 2025-02-06 19:13:37 +01:00
parent 98f41c6362
commit b8929bbae7
2 changed files with 13 additions and 0 deletions

View file

@ -282,6 +282,17 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
} }
try { try {
if (episodeData.response.proxy == true) {
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(
playlistUrl = proxyUrl,
videoNameGen = { quality -> "$serverName - $quality - $typeName" },
subtitleList = subtitles,
)
}
if (episodeData.response.headers != null && episodeData.response.headers.Referer?.startsWith("https://") == true) { if (episodeData.response.headers != null && episodeData.response.headers.Referer?.startsWith("https://") == true) {
return playlistUtils.extractFromHls( return playlistUtils.extractFromHls(
playlistUrl = defaultSource.url, playlistUrl = defaultSource.url,
@ -525,6 +536,7 @@ class AniPlay : AniListAnimeHttpSource(), ConfigurableAnimeSource {
"NEXT_ACTION_SOURCES_LIST" to "8a76af451978c817dde2364326a5e4e45eb43db1", "NEXT_ACTION_SOURCES_LIST" to "8a76af451978c817dde2364326a5e4e45eb43db1",
), ),
) )
private const val PROXY_URL = "https://aniplay-cors.yqizw7.easypanel.host"
private val DATE_FORMATTER = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) private val DATE_FORMATTER = SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
} }

View file

@ -37,6 +37,7 @@ data class VideoSourceResponse(
val outro: Timestamp?, val outro: Timestamp?,
val subtitles: List<Subtitle>?, val subtitles: List<Subtitle>?,
val headers: Headers?, val headers: Headers?,
val proxy: Boolean?,
) { ) {
@Serializable @Serializable
data class Source( data class Source(