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(es/AnimeOnlineNinja): Update AnimeOnlineNinja #100

Merged
merged 1 commit into from
Oct 7, 2024
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
6 changes: 4 additions & 2 deletions src/es/animeonlineninja/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ext {
extClass = '.AnimeOnlineNinja'
themePkg = 'dooplay'
baseUrl = 'https://ww3.animeonline.ninja'
overrideVersionCode = 46
overrideVersionCode = 47
}

apply from: "$rootDir/common.gradle"
Expand All @@ -14,5 +14,7 @@ dependencies {
implementation(project(':lib:filemoon-extractor'))
implementation(project(':lib:mixdrop-extractor'))
implementation(project(':lib:uqload-extractor'))
implementation(project(':lib:universal-extractor'))
implementation(project(':lib:vidhide-extractor'))
implementation(project(':lib:streamwish-extractor'))
implementation(project(':lib:mp4upload-extractor'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ import androidx.preference.CheckBoxPreference
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
import eu.kanade.tachiyomi.lib.mixdropextractor.MixDropExtractor
import eu.kanade.tachiyomi.lib.mp4uploadextractor.Mp4uploadExtractor
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
import eu.kanade.tachiyomi.lib.universalextractor.UniversalExtractor
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
import eu.kanade.tachiyomi.lib.uqloadextractor.UqloadExtractor
import eu.kanade.tachiyomi.lib.vidhideextractor.VidHideExtractor
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
Expand Down Expand Up @@ -91,7 +95,7 @@ class AnimeOnlineNinja : DooPlay(
} else if (path.startsWith("/letra") || path.startsWith("/tendencias")) {
val before = path.substringBeforeLast("/")
val after = path.substringAfterLast("/")
GET(baseUrl + before + "/page/$page/" + after)
GET("$baseUrl$before/page/$page/$after")
} else {
GET("$baseUrl$path/page/$page")
}
Expand All @@ -100,11 +104,29 @@ class AnimeOnlineNinja : DooPlay(
// ============================== Episodes ==============================
override val episodeMovieText = "Película"

override fun episodeListParse(response: Response): List<SEpisode> {
val doc = getRealAnimeDoc(response.asJsoup())
val seasonList = doc.select(seasonListSelector)
return if (seasonList.isEmpty()) {
listOf(
SEpisode.create().apply {
setUrlWithoutDomain(doc.location())
episode_number = 1F
name = episodeMovieText
},
)
} else {
seasonList.reversed().flatMap { seasonElement ->
getSeasonEpisodes(seasonElement).reversed()
}
}
}

// ============================ Video Links =============================
override fun videoListParse(response: Response): List<Video> {
val document = response.asJsoup()
val players = document.select("ul#playeroptionsul li")
return players.flatMap { player ->
return players.parallelCatchingFlatMapBlocking { player ->
val name = player.selectFirst("span.title")!!.text()
val url = getPlayerUrl(player)
extractVideos(url, name)
Expand All @@ -116,38 +138,41 @@ class AnimeOnlineNinja : DooPlay(
private val streamTapeExtractor by lazy { StreamTapeExtractor(client) }
private val mixDropExtractor by lazy { MixDropExtractor(client) }
private val uqloadExtractor by lazy { UqloadExtractor(client) }
private val universalExtractor by lazy { UniversalExtractor(client) }
private val vidHideExtractor by lazy { VidHideExtractor(client, headers) }
private val streamWishExtractor by lazy { StreamWishExtractor(client, headers) }
private val mp4uploadExtractor by lazy { Mp4uploadExtractor(client) }

private fun extractVideos(url: String, lang: String): List<Video> {
return when {
"saidochesto.top" in url || "MULTISERVER" in lang.uppercase() ->
extractFromMulti(url)
"filemoon" in url ->
filemoonExtractor.videosFromUrl(url, "$lang Filemoon - ", headers)
"dood" in url ->
doodExtractor.videoFromUrl(url, lang)
?.let(::listOf)
"streamtape" in url ->
streamTapeExtractor.videoFromUrl(url, "$lang StreamTape")
?.let(::listOf)
"mixdrop" in url ->
mixDropExtractor.videoFromUrl(url, lang)
"uqload" in url ->
uqloadExtractor.videosFromUrl(url)
"wolfstream" in url -> {
client.newCall(GET(url, headers)).execute()
.asJsoup()
.selectFirst("script:containsData(sources)")
?.data()
?.let { jsData ->
val videoUrl = jsData.substringAfter("{file:\"").substringBefore("\"")
listOf(Video(videoUrl, "$lang WolfStream", videoUrl, headers = headers))
}
}
else -> universalExtractor.videosFromUrl(url, headers, prefix = lang)
} ?: emptyList()
try {
return when {
arrayOf("saidochesto.top").any(url) || "MULTISERVER" in lang.uppercase() -> extractFromMulti(url)
arrayOf("filemoon", "filemooon", "moon").any(url) -> filemoonExtractor.videosFromUrl(url, "$lang Filemoon:", headers)
arrayOf("doodstream", "dood.", "ds2play", "doods.").any(url) -> doodExtractor.videosFromUrl(url, "$lang DoodStream", false)
arrayOf("streamtape", "stp", "stape").any(url) -> streamTapeExtractor.videosFromUrl(url, "$lang StreamTape")
arrayOf("mixdrop").any(url) -> mixDropExtractor.videoFromUrl(url, prefix = "$lang ")
arrayOf("uqload").any(url) -> uqloadExtractor.videosFromUrl(url, prefix = lang)
"wolfstream" in url -> {
client.newCall(GET(url, headers)).execute()
.asJsoup()
.selectFirst("script:containsData(sources)")
?.data()
?.let { jsData ->
val videoUrl = jsData.substringAfter("{file:\"").substringBefore("\"")
listOf(Video(videoUrl, "$lang WolfStream", videoUrl, headers = headers))
}
}
arrayOf("mp4upload").any(url) -> mp4uploadExtractor.videosFromUrl(url, headers, prefix = "$lang ")
arrayOf("vidhide", "filelions.top", "vid.").any(url) -> vidHideExtractor.videosFromUrl(url) { "$lang VidHide:$it" }
arrayOf("wishembed", "streamwish", "strwish", "wish").any(url) -> streamWishExtractor.videosFromUrl(url, videoNameGen = { "$lang StreamWish:$it" })
else -> null
} ?: emptyList()
} catch (e: Exception) {
return emptyList()
}
}

private fun Array<String>.any(url: String): Boolean = this.any { url.contains(it, ignoreCase = true) }

private fun extractFromMulti(url: String): List<Video> {
val document = client.newCall(GET(url)).execute().asJsoup()
val prefLang = preferences.getString(PREF_LANG_KEY, PREF_LANG_DEFAULT)!!
Expand Down Expand Up @@ -265,6 +290,7 @@ class AnimeOnlineNinja : DooPlay(

override val prefQualityValues = arrayOf("480p", "720p", "1080p")
override val prefQualityEntries = prefQualityValues
override val episodeNumberRegex by lazy { Regex("""(\d+(?:\.\d+)?)$""") }

companion object {
private const val PREF_LANG_KEY = "preferred_lang"
Expand All @@ -274,7 +300,7 @@ class AnimeOnlineNinja : DooPlay(
private const val PREF_SERVER_DEFAULT = "Uqload"
private val PREF_LANG_ENTRIES = arrayOf("SUB", "All", "ES", "LAT")
private val PREF_LANG_VALUES = arrayOf("SUB", "", "ES", "LAT")
private val SERVER_LIST = arrayOf("Filemoon", "DoodStream", "StreamTape", "MixDrop", "Uqload", "WolfStream", "saidochesto.top")
private val SERVER_LIST = arrayOf("Filemoon", "DoodStream", "StreamTape", "MixDrop", "Uqload", "WolfStream", "saidochesto.top", "VidHide", "StreamWish", "Mp4Upload")

private const val PREF_VRF_INTERCEPT_KEY = "vrf_intercept"
private const val PREF_VRF_INTERCEPT_TITLE = "Intercept VRF links (Requiere Reiniciar)"
Expand Down