From addec9521900e51ea9212ceecff3ad153cbfd84b Mon Sep 17 00:00:00 2001 From: imper1aldev <23511335+imper1aldev@users.noreply.github.com> Date: Sat, 14 Sep 2024 00:06:34 -0600 Subject: [PATCH] TioAnime improvements and VidGuardExtractor added --- lib/vidguard-extractor/build.gradle.kts | 8 + .../vidguardextractor/VidGuardExtractor.kt | 104 +++++++++ src/es/tioanimeh/build.gradle | 4 +- .../tioanimeh/res/mipmap-hdpi/ic_launcher.jpg | Bin 43584 -> 0 bytes .../tioanimeh/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3144 bytes .../tioanimeh/res/mipmap-mdpi/ic_launcher.jpg | Bin 43584 -> 0 bytes .../tioanimeh/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 1663 bytes .../res/mipmap-xhdpi/ic_launcher.jpg | Bin 43584 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4417 bytes .../res/mipmap-xxhdpi/ic_launcher.jpg | Bin 43584 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 9282 bytes .../res/mipmap-xxxhdpi/ic_launcher.jpg | Bin 43584 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 13098 bytes .../es/tioanimeh/TioAnimeHFilters.kt | 208 ++++++++++++++++++ .../animeextension/es/tioanimeh/TioanimeH.kt | 129 +++++------ .../es/tioanimeh/TioanimeHFactory.kt | 59 +---- .../tioanimeh/extractors/VidGuardExtractor.kt | 124 ----------- 17 files changed, 377 insertions(+), 259 deletions(-) create mode 100644 lib/vidguard-extractor/build.gradle.kts create mode 100644 lib/vidguard-extractor/src/main/java/eu/kanade/tachiyomi/lib/vidguardextractor/VidGuardExtractor.kt delete mode 100644 src/es/tioanimeh/res/mipmap-hdpi/ic_launcher.jpg create mode 100644 src/es/tioanimeh/res/mipmap-hdpi/ic_launcher.png delete mode 100644 src/es/tioanimeh/res/mipmap-mdpi/ic_launcher.jpg create mode 100644 src/es/tioanimeh/res/mipmap-mdpi/ic_launcher.png delete mode 100644 src/es/tioanimeh/res/mipmap-xhdpi/ic_launcher.jpg create mode 100644 src/es/tioanimeh/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 src/es/tioanimeh/res/mipmap-xxhdpi/ic_launcher.jpg create mode 100644 src/es/tioanimeh/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 src/es/tioanimeh/res/mipmap-xxxhdpi/ic_launcher.jpg create mode 100644 src/es/tioanimeh/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 src/es/tioanimeh/src/eu/kanade/tachiyomi/animeextension/es/tioanimeh/TioAnimeHFilters.kt delete mode 100644 src/es/tioanimeh/src/eu/kanade/tachiyomi/animeextension/es/tioanimeh/extractors/VidGuardExtractor.kt diff --git a/lib/vidguard-extractor/build.gradle.kts b/lib/vidguard-extractor/build.gradle.kts new file mode 100644 index 00000000..80d6613b --- /dev/null +++ b/lib/vidguard-extractor/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("lib-android") +} + +dependencies { + implementation(project(":lib:playlist-utils")) + implementation("org.mozilla:rhino:1.7.14") +} diff --git a/lib/vidguard-extractor/src/main/java/eu/kanade/tachiyomi/lib/vidguardextractor/VidGuardExtractor.kt b/lib/vidguard-extractor/src/main/java/eu/kanade/tachiyomi/lib/vidguardextractor/VidGuardExtractor.kt new file mode 100644 index 00000000..4e52c46b --- /dev/null +++ b/lib/vidguard-extractor/src/main/java/eu/kanade/tachiyomi/lib/vidguardextractor/VidGuardExtractor.kt @@ -0,0 +1,104 @@ +package eu.kanade.tachiyomi.lib.vidguardextractor + +import android.util.Base64 +import android.util.Log +import eu.kanade.tachiyomi.animesource.model.Video +import eu.kanade.tachiyomi.lib.playlistutils.PlaylistUtils +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.util.asJsoup +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.Json +import okhttp3.OkHttpClient +import org.mozilla.javascript.Context +import org.mozilla.javascript.NativeJSON +import org.mozilla.javascript.NativeObject +import org.mozilla.javascript.Scriptable +import uy.kohesive.injekt.injectLazy + +class VidGuardExtractor(private val client: OkHttpClient) { + + private val playlistUtils by lazy { PlaylistUtils(client) } + + private val json: Json by injectLazy() + + fun videosFromUrl(url: String, prefix: String) = videosFromUrl(url) { "$prefix $it" } + + fun videosFromUrl(url: String, videoNameGen: (String) -> String = { quality -> "VidGuard:$quality" }): List