From e08c6db3001ec1aca0f8f076d6474d6d8d315915 Mon Sep 17 00:00:00 2001 From: Salman Ali Date: Wed, 25 Oct 2023 23:41:24 +0545 Subject: [PATCH] fix(en/animetake): Fix episodes and filters + migrate to GogoStreamExtractor (#2412) --- src/en/animetake/build.gradle | 3 +- .../animeextension/en/animetake/AnimeTake.kt | 28 ++-- .../en/animetake/AnimeTakeFilters.kt | 8 +- .../extractors/VidstreamingExtractor.kt | 135 ------------------ 4 files changed, 26 insertions(+), 148 deletions(-) delete mode 100644 src/en/animetake/src/eu/kanade/tachiyomi/animeextension/en/animetake/extractors/VidstreamingExtractor.kt diff --git a/src/en/animetake/build.gradle b/src/en/animetake/build.gradle index b7ce729314..cb43df015c 100644 --- a/src/en/animetake/build.gradle +++ b/src/en/animetake/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'AnimeTake' pkgNameSuffix = 'en.animetake' extClass = '.AnimeTake' - extVersionCode = 1 + extVersionCode = 2 containsNsfw = false } @@ -13,6 +13,7 @@ dependencies { implementation(project(":lib-dood-extractor")) implementation(project(":lib-mp4upload-extractor")) implementation(project(":lib-filemoon-extractor")) + implementation(project(":lib-gogostream-extractor")) } apply from: "$rootDir/common.gradle" \ No newline at end of file diff --git a/src/en/animetake/src/eu/kanade/tachiyomi/animeextension/en/animetake/AnimeTake.kt b/src/en/animetake/src/eu/kanade/tachiyomi/animeextension/en/animetake/AnimeTake.kt index b01f81fea1..a70d9e1a81 100644 --- a/src/en/animetake/src/eu/kanade/tachiyomi/animeextension/en/animetake/AnimeTake.kt +++ b/src/en/animetake/src/eu/kanade/tachiyomi/animeextension/en/animetake/AnimeTake.kt @@ -4,7 +4,6 @@ import android.app.Application import android.content.SharedPreferences import androidx.preference.ListPreference import androidx.preference.PreferenceScreen -import eu.kanade.tachiyomi.animeextension.en.animetake.extractors.VidstreamingExtractor import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource import eu.kanade.tachiyomi.animesource.model.AnimeFilterList import eu.kanade.tachiyomi.animesource.model.SAnime @@ -13,6 +12,7 @@ import eu.kanade.tachiyomi.animesource.model.Video import eu.kanade.tachiyomi.animesource.online.ParsedAnimeHttpSource import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor +import eu.kanade.tachiyomi.lib.gogostreamextractor.GogoStreamExtractor import eu.kanade.tachiyomi.lib.mp4uploadextractor.Mp4uploadExtractor import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.util.asJsoup @@ -119,29 +119,41 @@ class AnimeTake : ConfigurableAnimeSource, ParsedAnimeHttpSource() { } // ============================== Episodes ============================== - override fun episodeListSelector() = "div#eps > div > a[href]" + override fun episodeListSelector() = "div.tab-content" override fun episodeListParse(response: Response): List { val document = response.asJsoup() val episodesLink = document.select(episodeListSelector()) - return episodesLink.map(::episodeFromElement).reversed() + val episodes = mutableListOf() + + val specialsDiv = episodesLink.select("div#specials") + if (specialsDiv.isNotEmpty()) { + episodes.addAll(specialsDiv.select("a[href]").map(::episodeFromElement).reversed()) + } + episodes.addAll( + episodesLink.select("div#eps").select("a[href]") + .map(::episodeFromElement).reversed(), + ) + + return episodes.toList() } override fun episodeFromElement(element: Element): SEpisode { return SEpisode.create().apply { setUrlWithoutDomain(element.attr("href")) - val upDate = element.select("div.col-xs-12 > span.label").text() + val upDate = element.select("div.col-xs-12 > span.front_time").text().trim() date_upload = parseDate(upDate) - val epName = element.select("div.col-xs-12 > div.anime-title > b").text() + val epName = element.select("div.col-xs-12 > div.anime-title > b").text().trim() + val epNum = epName.split(" ").last() name = epName - episode_number = 0F + episode_number = epNum.toFloatOrNull() ?: 0F } } // ============================ Video Links ============================= private val doodExtractor by lazy { DoodExtractor(client) } private val mp4uploadExtractor by lazy { Mp4uploadExtractor(client) } - private val vidstreamingExtractor by lazy { VidstreamingExtractor(client) } + private val gogoStreamExtractor by lazy { GogoStreamExtractor(client) } private val filemoonExtractor by lazy { FilemoonExtractor(client) } override fun videoListParse(response: Response): List