Skip to content

Commit

Permalink
fix(en/animetake): Fix episodes and filters + migrate to GogoStreamEx…
Browse files Browse the repository at this point in the history
…tractor (#2412)
  • Loading branch information
immortal-forest authored Oct 25, 2023
1 parent ea19287 commit e08c6db
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 148 deletions.
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.

0 comments on commit e08c6db

Please sign in to comment.