From 2ee74da63e8e10d9edbb637f89749bc9487d5d80 Mon Sep 17 00:00:00 2001 From: Claudemirovsky <63046606+Claudemirovsky@users.noreply.github.com> Date: Thu, 26 Oct 2023 08:03:54 -0300 Subject: [PATCH] feat(id/otakudesu): Add FileLions extractor + fix video sorting (#2420) --- src/id/otakudesu/build.gradle | 3 ++- .../animeextension/id/otakudesu/OtakuDesu.kt | 25 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/id/otakudesu/build.gradle b/src/id/otakudesu/build.gradle index ffed72a15f..d1182f6e90 100644 --- a/src/id/otakudesu/build.gradle +++ b/src/id/otakudesu/build.gradle @@ -7,12 +7,13 @@ ext { extName = 'OtakuDesu' pkgNameSuffix = 'id.otakudesu' extClass = '.OtakuDesu' - extVersionCode = 20 + extVersionCode = 21 libVersion = '13' } dependencies { implementation(project(":lib-yourupload-extractor")) + implementation(project(":lib-streamwish-extractor")) } apply from: "$rootDir/common.gradle" diff --git a/src/id/otakudesu/src/eu/kanade/tachiyomi/animeextension/id/otakudesu/OtakuDesu.kt b/src/id/otakudesu/src/eu/kanade/tachiyomi/animeextension/id/otakudesu/OtakuDesu.kt index 45f6fcad4a..81cbe91c3c 100644 --- a/src/id/otakudesu/src/eu/kanade/tachiyomi/animeextension/id/otakudesu/OtakuDesu.kt +++ b/src/id/otakudesu/src/eu/kanade/tachiyomi/animeextension/id/otakudesu/OtakuDesu.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.animeextension.id.otakudesu import android.app.Application -import android.content.SharedPreferences import android.util.Base64 import androidx.preference.ListPreference import androidx.preference.PreferenceScreen @@ -13,6 +12,7 @@ import eu.kanade.tachiyomi.animesource.model.SAnime import eu.kanade.tachiyomi.animesource.model.SEpisode import eu.kanade.tachiyomi.animesource.model.Video import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource +import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor import eu.kanade.tachiyomi.lib.youruploadextractor.YourUploadExtractor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST @@ -22,7 +22,6 @@ import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.runBlocking import okhttp3.FormBody -import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response import org.jsoup.Jsoup @@ -44,9 +43,9 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() { override val supportsLatest = true - override val client: OkHttpClient = network.cloudflareClient + override val client = network.cloudflareClient - private val preferences: SharedPreferences by lazy { + private val preferences by lazy { Injekt.get().getSharedPreferences("source_$id", 0x0000) } @@ -61,9 +60,9 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() { author = info.getInfo("Produser") description = buildString { - info.getInfo("Japanese", false)?.let { append("$it\n") } - info.getInfo("Skor", false)?.let { append("$it\n") } - info.getInfo("Total Episode", false)?.let { append("$it\n") } + info.getInfo("Japanese", false)?.also { append("$it\n") } + info.getInfo("Skor", false)?.also { append("$it\n") } + info.getInfo("Total Episode", false)?.also { append("$it\n") } append("\n\nSynopsis:\n") document.select("div.sinopc > p").eachText().forEach { append("$it\n\n") } } @@ -217,7 +216,7 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() { val doc = client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", body = form)) .execute() - .body.string() + .use { it.body.string() } .substringAfter(":\"") .substringBefore('"') .b64Decode() @@ -228,12 +227,18 @@ class OtakuDesu : ConfigurableAnimeSource, ParsedAnimeHttpSource() { return Pair(quality, url) } + private val filelionsExtractor by lazy { StreamWishExtractor(client, headers) } + private val yourUploadExtractor by lazy { YourUploadExtractor(client) } + private fun getVideosFromEmbed(quality: String, link: String): List