Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(en/animetake): Fix episodes and filters + migrate to GogoStreamExtractor #2412

Merged
merged 5 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/en/animetake/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ ext {
extName = 'AnimeTake'
pkgNameSuffix = 'en.animetake'
extClass = '.AnimeTake'
extVersionCode = 1
extVersionCode = 2
containsNsfw = false
}

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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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<SEpisode> {
val document = response.asJsoup()
val episodesLink = document.select(episodeListSelector())
return episodesLink.map(::episodeFromElement).reversed()
val episodes = mutableListOf<SEpisode>()

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<Video> {
Expand Down Expand Up @@ -169,7 +181,7 @@ class AnimeTake : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
}

private fun extractVideo(url: String): List<Video> {
val videos = vidstreamingExtractor.videosFromUrl(url, "Vidstreaming - ")
val videos = gogoStreamExtractor.videosFromUrl(url)

val request = GET(url)
val response = client.newCall(request).execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ object AnimeTakeFilters {
Pair("Sci-Fi", "Sci-Fi"),
Pair("Seinen", "Seinen"),
Pair("Shoujo", "Shoujo"),
Pair("Shoujo+Ai", "Shoujo+Ai"),
Pair("Shoujo Ai", "Shoujo+Ai"),
Pair("Shounen", "Shounen"),
Pair("Shounen+Ai", "Shounen+Ai"),
Pair("Shounen Ai", "Shounen+Ai"),
Pair("Slice of Life", "Slice+of+Life"),
Pair("Space", "Space"),
Pair("Sports", "Sports"),
Pair("Strategy+Game", "Strategy+Game"),
Pair("Super+Power", "Super+Power"),
Pair("Strategy Game", "Strategy+Game"),
Pair("Super Power", "Super+Power"),
Pair("Supernatural", "Supernatural"),
Pair("Survival", "Survival"),
Pair("Suspense", "Suspense"),
Expand Down

This file was deleted.