From b85bc9a5f71b599cd2476c678f80ae518368e072 Mon Sep 17 00:00:00 2001 From: Claudemirovsky <63046606+Claudemirovsky@users.noreply.github.com> Date: Sun, 10 Mar 2024 18:57:47 -0300 Subject: [PATCH] fix(pt/vizer): Update baseUrl, fix episode list, add WarezCDN extractor (#3036) --- src/pt/vizer/build.gradle | 4 +- .../animeextension/pt/vizer/Vizer.kt | 68 ++++++++++++------- .../animeextension/pt/vizer/dto/VizerDto.kt | 60 ++++++++-------- .../pt/vizer/extractors/WarezExtractor.kt | 52 ++++++++++++++ 4 files changed, 125 insertions(+), 59 deletions(-) create mode 100644 src/pt/vizer/src/eu/kanade/tachiyomi/animeextension/pt/vizer/extractors/WarezExtractor.kt diff --git a/src/pt/vizer/build.gradle b/src/pt/vizer/build.gradle index b23d03367b..b3bfe6d42f 100644 --- a/src/pt/vizer/build.gradle +++ b/src/pt/vizer/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Vizer.tv' extClass = '.Vizer' - extVersionCode = 13 + extVersionCode = 14 isNsfw = true } @@ -10,4 +10,4 @@ apply from: "$rootDir/common.gradle" dependencies { implementation(project(':lib:mixdrop-extractor')) implementation(project(':lib:streamtape-extractor')) -} \ No newline at end of file +} diff --git a/src/pt/vizer/src/eu/kanade/tachiyomi/animeextension/pt/vizer/Vizer.kt b/src/pt/vizer/src/eu/kanade/tachiyomi/animeextension/pt/vizer/Vizer.kt index 568c111e86..13db5010ac 100644 --- a/src/pt/vizer/src/eu/kanade/tachiyomi/animeextension/pt/vizer/Vizer.kt +++ b/src/pt/vizer/src/eu/kanade/tachiyomi/animeextension/pt/vizer/Vizer.kt @@ -5,11 +5,12 @@ import androidx.preference.ListPreference import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.animeextension.pt.vizer.VizerFilters.FilterSearchParams import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.EpisodeListDto -import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.PlayersDto +import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.HostersDto import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.SearchItemDto import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.SearchResultDto import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.VideoDto -import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.VideoLanguagesDto +import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.VideoListDto +import eu.kanade.tachiyomi.animeextension.pt.vizer.extractors.WarezExtractor import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource import eu.kanade.tachiyomi.animesource.model.AnimeFilterList import eu.kanade.tachiyomi.animesource.model.AnimesPage @@ -24,7 +25,6 @@ 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.json.Json import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType.Companion.toMediaType import okhttp3.Request @@ -33,20 +33,19 @@ import okhttp3.Response import org.jsoup.nodes.Element import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import uy.kohesive.injekt.injectLazy class Vizer : ConfigurableAnimeSource, AnimeHttpSource() { override val name = "Vizer.tv" - override val baseUrl = "https://vizer.tv" + override val baseUrl = "https://vizertv.in" private val apiUrl = "$baseUrl/includes/ajax" override val lang = "pt-BR" override val supportsLatest = true - private val json: Json by injectLazy() + override fun headersBuilder() = super.headersBuilder().add("Referer", "$baseUrl/") private val preferences by lazy { Injekt.get().getSharedPreferences("source_$id", 0x0000) @@ -65,7 +64,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() { override fun popularAnimeParse(response: Response): AnimesPage { val result = response.parseAs() - val animes = result.list.map(::animeFromObject) + val animes = result.items.values.map(::animeFromObject) val hasNext = result.quantity == 35 return AnimesPage(animes, hasNext) } @@ -89,7 +88,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() { override fun latestUpdatesParse(response: Response): AnimesPage { val parsedData = response.parseAs() - val animes = parsedData.list.map(::animeFromObject) + val animes = parsedData.items.values.map(::animeFromObject) return AnimesPage(animes, false) } @@ -165,6 +164,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() { val sname = seasonElement.text() val response = client.newCall(apiRequest("getEpisodes=$id")).execute() val episodes = response.parseAs().episodes + .values .filter { it.released } .map { SEpisode.create().apply { @@ -178,7 +178,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() { override fun episodeListParse(response: Response): List { val doc = response.asJsoup() - val seasons = doc.select("div#seasonsList div.item[data-season-id]") + val seasons = doc.select("div.seasons div.list div.item[data-season-id]") return if (seasons.size > 0) { seasons.flatMap(::getSeasonEps).reversed() } else { @@ -201,17 +201,24 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() { } else { // Fake url, its an ID that will be used to get episode languages // (sub/dub) and then return the video link - apiRequest("getEpisodeLanguages=$url") + apiRequest("getEpisodeData=$url") } } override fun videoListParse(response: Response): List