diff --git a/src/pt/animesdigital/build.gradle b/src/pt/animesdigital/build.gradle index e2697c4867..c3e84d841e 100644 --- a/src/pt/animesdigital/build.gradle +++ b/src/pt/animesdigital/build.gradle @@ -8,4 +8,4 @@ apply from: "$rootDir/common.gradle" dependencies { implementation(project(":lib:unpacker")) -} \ No newline at end of file +} diff --git a/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt b/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt index 420caa4a23..9b3f7fd0b7 100644 --- a/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt +++ b/src/pt/animesdigital/src/eu/kanade/tachiyomi/animeextension/pt/animesdigital/AnimesDigital.kt @@ -3,6 +3,8 @@ package eu.kanade.tachiyomi.animeextension.pt.animesdigital import android.app.Application import androidx.preference.ListPreference import androidx.preference.PreferenceScreen +import eu.kanade.tachiyomi.animeextension.pt.animesdigital.extractors.ProtectorExtractor +import eu.kanade.tachiyomi.animeextension.pt.animesdigital.extractors.ScriptExtractor import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource import eu.kanade.tachiyomi.animesource.model.AnimeFilterList import eu.kanade.tachiyomi.animesource.model.AnimesPage @@ -10,14 +12,12 @@ 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.unpacker.Unpacker import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.awaitSuccess import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.parseAs import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json import okhttp3.FormBody import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Request @@ -27,7 +27,6 @@ import org.jsoup.nodes.Document import org.jsoup.nodes.Element import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import uy.kohesive.injekt.injectLazy class AnimesDigital : ConfigurableAnimeSource, ParsedAnimeHttpSource() { @@ -41,8 +40,6 @@ class AnimesDigital : ConfigurableAnimeSource, ParsedAnimeHttpSource() { override fun headersBuilder() = super.headersBuilder().add("Referer", baseUrl) - private val json: Json by injectLazy() - private val preferences by lazy { Injekt.get().getSharedPreferences("source_$id", 0x0000) } @@ -126,7 +123,7 @@ class AnimesDigital : ConfigurableAnimeSource, ParsedAnimeHttpSource() { override fun searchAnimeParse(response: Response): AnimesPage { return runCatching { val data = response.parseAs() - val animes = data.results.map(Jsoup::parse) + val animes = data.results.map(Jsoup::parseBodyFragment) .mapNotNull { it.selectFirst(searchAnimeSelector()) } .map(::searchAnimeFromElement) val hasNext = data.total_page > data.page @@ -156,15 +153,15 @@ class AnimesDigital : ConfigurableAnimeSource, ParsedAnimeHttpSource() { else -> SAnime.UNKNOWN } - val infos = doc.selectFirst("div.crw > div.dados")!! - - artist = infos.getInfo("Estúdio") - author = infos.getInfo("Autor") ?: infos.getInfo("Diretor") + with(doc.selectFirst("div.crw > div.dados")!!) { + artist = getInfo("Estúdio") + author = getInfo("Autor") ?: getInfo("Diretor") - title = infos.selectFirst("h1")!!.text() - genre = infos.select("div.genre a").eachText().joinToString() + title = selectFirst("h1")!!.text() + genre = select("div.genre a").eachText().joinToString() - description = infos.selectFirst("div.sinopse")?.text() + description = selectFirst("div.sinopse")?.text() + } } // ============================== Episodes ============================== @@ -195,9 +192,9 @@ class AnimesDigital : ConfigurableAnimeSource, ParsedAnimeHttpSource() { episode_number = epname.substringAfterLast(" ").toFloatOrNull() ?: 1F name = buildString { append(epname) - element.selectFirst("div.sub_title")?.text()?.let { + element.selectFirst("div.sub_title")?.text()?.also { if (!it.contains("Ainda não tem um titulo oficial")) { - append(" - $it") + append(" - ", it) } } } @@ -207,7 +204,9 @@ class AnimesDigital : ConfigurableAnimeSource, ParsedAnimeHttpSource() { override fun videoListParse(response: Response): List