From 88f240b1c4ddd2ee4119509d75d46eece5d93a86 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Sat, 16 Mar 2024 09:18:40 +0100 Subject: [PATCH] fix videos --- src/en/animeflixlive/build.gradle | 2 +- .../en/animeflixlive/AnimeflixLive.kt | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/en/animeflixlive/build.gradle b/src/en/animeflixlive/build.gradle index 4a274323a8..21dd6a19cd 100644 --- a/src/en/animeflixlive/build.gradle +++ b/src/en/animeflixlive/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Animeflix.live' extClass = '.AnimeflixLive' - extVersionCode = 2 + extVersionCode = 3 } apply from: "$rootDir/common.gradle" diff --git a/src/en/animeflixlive/src/eu/kanade/tachiyomi/animeextension/en/animeflixlive/AnimeflixLive.kt b/src/en/animeflixlive/src/eu/kanade/tachiyomi/animeextension/en/animeflixlive/AnimeflixLive.kt index 9dd3407d90..f80d7e18d9 100644 --- a/src/en/animeflixlive/src/eu/kanade/tachiyomi/animeextension/en/animeflixlive/AnimeflixLive.kt +++ b/src/en/animeflixlive/src/eu/kanade/tachiyomi/animeextension/en/animeflixlive/AnimeflixLive.kt @@ -36,6 +36,7 @@ import org.jsoup.nodes.Document import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy +import java.net.URLDecoder import java.util.Calendar import java.util.Locale import java.util.TimeZone @@ -226,7 +227,7 @@ class AnimeflixLive : ConfigurableAnimeSource, AnimeHttpSource() { val initialPlayerDocument = client.newCall( GET(initialPlayerUrl, docHeaders), - ).execute().asJsoup() + ).execute().asJsoup().unescape() videoList.addAll( videosFromPlayer( @@ -266,7 +267,7 @@ class AnimeflixLive : ConfigurableAnimeSource, AnimeHttpSource() { val playerDocument = client.newCall( GET(playerUrl, docHeaders), - ).execute().asJsoup() + ).execute().asJsoup().unescape() videosFromPlayer( playerDocument, @@ -300,16 +301,26 @@ class AnimeflixLive : ConfigurableAnimeSource, AnimeHttpSource() { }.build() } + private fun Document.unescape(): Document { + val unescapeScript = this.selectFirst("script:containsData(unescape)") + return if (unescapeScript == null) { + this + } else { + val data = URLDecoder.decode(unescapeScript.data(), "UTF-8") + Jsoup.parse(data, this.location()) + } + } + private fun videosFromPlayer(document: Document, name: String): List