feat(multisrc/dooplay): Convert AnimeOnlineNinja(es) to multisrc (#1614)
@ -124,12 +124,6 @@ class AnimeOnline360 : DooPlay(
|
||||
}
|
||||
|
||||
// ============================= Utilities ==============================
|
||||
|
||||
private fun String.toDate(): Long {
|
||||
return runCatching { DATE_FORMATTER.parse(trim())?.time }
|
||||
.getOrNull() ?: 0L
|
||||
}
|
||||
|
||||
private fun String.addSubPrefix(): String {
|
||||
return if (this.contains(" dubbed", true)) {
|
||||
"[DUB] ${this.substringBefore(" Dubbed")}"
|
||||
|
@ -0,0 +1,6 @@
|
||||
dependencies {
|
||||
implementation(project(':lib-streamtape-extractor'))
|
||||
implementation(project(':lib-streamsb-extractor'))
|
||||
implementation(project(':lib-dood-extractor'))
|
||||
implementation(project(':lib-mixdrop-extractor'))
|
||||
}
|
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 9.7 KiB |
@ -0,0 +1,260 @@
|
||||
package eu.kanade.tachiyomi.animeextension.es.animeonlineninja
|
||||
|
||||
import androidx.preference.CheckBoxPreference
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animeextension.es.animeonlineninja.extractors.UploadExtractor
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.lib.doodextractor.DoodExtractor
|
||||
import eu.kanade.tachiyomi.lib.mixdropextractor.MixDropExtractor
|
||||
import eu.kanade.tachiyomi.lib.streamsbextractor.StreamSBExtractor
|
||||
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
|
||||
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
class AnimeOnlineNinja : DooPlay(
|
||||
"es",
|
||||
"AnimeOnline.Ninja",
|
||||
"https://www1.animeonline.ninja",
|
||||
) {
|
||||
override val client by lazy {
|
||||
if (preferences.getBoolean(PREF_VRF_INTERCEPT_KEY, PREF_VRF_INTERCEPT_DEFAULT)) {
|
||||
network.cloudflareClient
|
||||
.newBuilder().addInterceptor(VrfInterceptor()).build()
|
||||
} else {
|
||||
network.cloudflareClient
|
||||
}
|
||||
}
|
||||
|
||||
// ============================== Popular ===============================
|
||||
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/tendencias/$page")
|
||||
|
||||
override fun popularAnimeSelector() = latestUpdatesSelector()
|
||||
|
||||
override fun popularAnimeNextPageSelector() = latestUpdatesNextPageSelector()
|
||||
|
||||
// =============================== Search ===============================
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
||||
val params = AnimeOnlineNinjaFilters.getSearchParameters(filters)
|
||||
val path = when {
|
||||
params.genre.isNotBlank() -> {
|
||||
if (params.genre in listOf("tendencias", "ratings")) {
|
||||
"/" + params.genre
|
||||
} else {
|
||||
"/genero/${params.genre}"
|
||||
}
|
||||
}
|
||||
params.language.isNotBlank() -> "/genero/${params.language}"
|
||||
params.year.isNotBlank() -> "/release/${params.year}"
|
||||
params.movie.isNotBlank() -> {
|
||||
if (params.movie == "pelicula") {
|
||||
"/pelicula"
|
||||
} else {
|
||||
"/genero/${params.movie}"
|
||||
}
|
||||
}
|
||||
else -> buildString {
|
||||
append(
|
||||
when {
|
||||
query.isNotBlank() -> "/?s=$query"
|
||||
params.letter.isNotBlank() -> "/letra/${params.letter}/?"
|
||||
else -> "/tendencias/?"
|
||||
},
|
||||
)
|
||||
|
||||
append(
|
||||
if (contains("tendencias")) {
|
||||
"&get=${when (params.type){
|
||||
"serie" -> "TV"
|
||||
"pelicula" -> "movies"
|
||||
else -> "todos"
|
||||
}}"
|
||||
} else {
|
||||
"&tipo=${params.type}"
|
||||
},
|
||||
)
|
||||
|
||||
if (params.isInverted) append("&orden=asc")
|
||||
}
|
||||
}
|
||||
|
||||
return if (path.startsWith("/?s=")) {
|
||||
GET("$baseUrl/page/$page$path")
|
||||
} else if (path.startsWith("/letra") || path.startsWith("/tendencias")) {
|
||||
val before = path.substringBeforeLast("/")
|
||||
val after = path.substringAfterLast("/")
|
||||
GET(baseUrl + before + "/page/$page/" + after)
|
||||
} else {
|
||||
GET("$baseUrl$path/page/$page")
|
||||
}
|
||||
}
|
||||
|
||||
// ============================== Episodes ==============================
|
||||
override val episodeMovieText = "Película"
|
||||
|
||||
// ============================ Video Links =============================
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
val document = response.asJsoup()
|
||||
val players = document.select("ul#playeroptionsul li")
|
||||
return players.flatMap { player ->
|
||||
val name = player.selectFirst("span.title")!!.text()
|
||||
val url = getPlayerUrl(player)
|
||||
extractVideos(url, name)
|
||||
}
|
||||
}
|
||||
|
||||
private fun extractVideos(url: String, lang: String): List<Video> {
|
||||
return when {
|
||||
"saidochesto.top" in url || "MULTISERVER" in lang.uppercase() ->
|
||||
extractFromMulti(url)
|
||||
"dood" in url ->
|
||||
DoodExtractor(client).videoFromUrl(url, "$lang DoodStream", false)
|
||||
?.let(::listOf)
|
||||
"sb" in url ->
|
||||
StreamSBExtractor(client).videosFromUrl(url, headers, lang)
|
||||
"streamtape" in url ->
|
||||
StreamTapeExtractor(client).videoFromUrl(url, "$lang StreamTape")
|
||||
?.let(::listOf)
|
||||
"mixdrop" in url ->
|
||||
MixDropExtractor(client).videoFromUrl(url, lang)
|
||||
"uqload" in url ->
|
||||
UploadExtractor(client).videoFromUrl(url, headers, lang)
|
||||
?.let(::listOf)
|
||||
"wolfstream" in url -> {
|
||||
client.newCall(GET(url, headers)).execute()
|
||||
.use { it.asJsoup() }
|
||||
.selectFirst("script:containsData(sources)")
|
||||
?.data()
|
||||
?.let { jsData ->
|
||||
val videoUrl = jsData.substringAfter("{file:\"").substringBefore("\"")
|
||||
listOf(Video(videoUrl, "$lang WolfStream", videoUrl, headers = headers))
|
||||
}
|
||||
}
|
||||
else -> null
|
||||
} ?: emptyList<Video>()
|
||||
}
|
||||
|
||||
private fun extractFromMulti(url: String): List<Video> {
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
val pref_lang = preferences.getString(PREF_LANG_KEY, PREF_LANG_DEFAULT)!!
|
||||
val langSelector = when {
|
||||
pref_lang.isBlank() -> "div"
|
||||
else -> "div.OD_$pref_lang"
|
||||
}
|
||||
return document.select("div.ODDIV $langSelector > li").flatMap {
|
||||
val hosterUrl = it.attr("onclick").toString()
|
||||
.substringAfter("('")
|
||||
.substringBefore("')")
|
||||
val lang = when (langSelector) {
|
||||
"div" -> {
|
||||
it.parent()?.attr("class").toString()
|
||||
.substringAfter("OD_", "")
|
||||
.substringBefore(" ")
|
||||
}
|
||||
else -> pref_lang
|
||||
}
|
||||
extractVideos(hosterUrl, lang)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPlayerUrl(player: Element): String {
|
||||
val type = player.attr("data-type")
|
||||
val id = player.attr("data-post")
|
||||
val num = player.attr("data-nume")
|
||||
return client.newCall(GET("$baseUrl/wp-json/dooplayer/v1/post/$id?type=$type&source=$num"))
|
||||
.execute()
|
||||
.use { response ->
|
||||
response.body.string()
|
||||
.substringAfter("\"embed_url\":\"")
|
||||
.substringBefore("\",")
|
||||
.replace("\\", "")
|
||||
}
|
||||
}
|
||||
|
||||
// =========================== Anime Details ============================
|
||||
override fun Document.getDescription(): String {
|
||||
return select("$additionalInfoSelector div.wp-content p")
|
||||
.eachText()
|
||||
.joinToString("\n")
|
||||
}
|
||||
|
||||
override val additionalInfoItems = listOf("Título", "Temporadas", "Episodios", "Duración media")
|
||||
|
||||
// =============================== Latest ===============================
|
||||
override val latestUpdatesPath = "episodio"
|
||||
|
||||
override fun latestUpdatesNextPageSelector() = "div.pagination > *:last-child:not(span):not(.current)"
|
||||
|
||||
// ============================== Filters ===============================
|
||||
override val fetchGenres = false
|
||||
|
||||
override fun getFilterList() = AnimeOnlineNinjaFilters.filterList
|
||||
|
||||
// ============================== Settings ==============================
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
super.setupPreferenceScreen(screen) // Quality preference
|
||||
|
||||
val langPref = ListPreference(screen.context).apply {
|
||||
key = PREF_LANG_KEY
|
||||
title = PREF_LANG_TITLE
|
||||
entries = PREF_LANG_ENTRIES
|
||||
entryValues = PREF_LANG_VALUES
|
||||
setDefaultValue(PREF_LANG_DEFAULT)
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}
|
||||
|
||||
val vrfIterceptPref = CheckBoxPreference(screen.context).apply {
|
||||
key = PREF_VRF_INTERCEPT_KEY
|
||||
title = PREF_VRF_INTERCEPT_TITLE
|
||||
summary = PREF_VRF_INTERCEPT_SUMMARY
|
||||
setDefaultValue(PREF_VRF_INTERCEPT_DEFAULT)
|
||||
}
|
||||
|
||||
screen.addPreference(vrfIterceptPref)
|
||||
screen.addPreference(langPref)
|
||||
}
|
||||
|
||||
// ============================= Utilities ==============================
|
||||
override fun String.toDate() = 0L
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
val quality = preferences.getString(PREF_QUALITY_KEY, PREF_QUALITY_DEFAULT)!!
|
||||
val lang = preferences.getString(PREF_LANG_KEY, PREF_LANG_DEFAULT)!!
|
||||
return sortedWith(
|
||||
compareBy(
|
||||
{ it.quality.contains(lang) },
|
||||
{ it.quality.contains(quality) },
|
||||
),
|
||||
).reversed()
|
||||
}
|
||||
|
||||
override val PREF_QUALITY_VALUES = arrayOf("480p", "720p", "1080p")
|
||||
override val PREF_QUALITY_ENTRIES = PREF_QUALITY_VALUES
|
||||
|
||||
companion object {
|
||||
private const val PREF_LANG_KEY = "preferred_lang"
|
||||
private const val PREF_LANG_TITLE = "Preferred language"
|
||||
private const val PREF_LANG_DEFAULT = "SUB"
|
||||
private val PREF_LANG_ENTRIES = arrayOf("SUB", "All", "ES", "LAT")
|
||||
private val PREF_LANG_VALUES = arrayOf("SUB", "", "ES", "LAT")
|
||||
|
||||
private const val PREF_VRF_INTERCEPT_KEY = "vrf_intercept"
|
||||
private const val PREF_VRF_INTERCEPT_TITLE = "Intercept VRF links (Requiere Reiniciar)"
|
||||
private const val PREF_VRF_INTERCEPT_SUMMARY = "Intercept VRF links and open them in the browser"
|
||||
private const val PREF_VRF_INTERCEPT_DEFAULT = false
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package eu.kanade.tachiyomi.animeextension.es.animeonlineninja
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilter
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||
|
||||
object AnimeOnlineNinjaFilters {
|
||||
|
||||
open class UriPartFilter(
|
||||
displayName: String,
|
||||
val vals: Array<Pair<String, String>>,
|
||||
) : AnimeFilter.Select<String>(
|
||||
displayName,
|
||||
vals.map { it.first }.toTypedArray(),
|
||||
) {
|
||||
|
||||
fun toUriPart() = vals[state].second
|
||||
}
|
||||
|
||||
private inline fun <reified R> AnimeFilterList.getFirst(): R {
|
||||
return first { it is R } as R
|
||||
}
|
||||
|
||||
private inline fun <reified R> AnimeFilterList.asUriPart(): String {
|
||||
return getFirst<R>().let {
|
||||
(it as UriPartFilter).toUriPart()
|
||||
}
|
||||
}
|
||||
|
||||
class InvertedResultsFilter : AnimeFilter.CheckBox("Invertir resultados", false)
|
||||
class TypeFilter : UriPartFilter("Tipo", AnimesOnlineNinjaData.types)
|
||||
class LetterFilter : UriPartFilter("Filtrar por letra", AnimesOnlineNinjaData.letters)
|
||||
|
||||
class GenreFilter : UriPartFilter("Generos", AnimesOnlineNinjaData.genres)
|
||||
class LanguageFilter : UriPartFilter("Idiomas", AnimesOnlineNinjaData.languages)
|
||||
class YearFilter : UriPartFilter("Año", AnimesOnlineNinjaData.years)
|
||||
class MovieFilter : UriPartFilter("Peliculas", AnimesOnlineNinjaData.movies)
|
||||
|
||||
class OtherOptionsGroup : AnimeFilter.Group<UriPartFilter>(
|
||||
"Otros filtros",
|
||||
listOf(
|
||||
GenreFilter(),
|
||||
LanguageFilter(),
|
||||
YearFilter(),
|
||||
MovieFilter(),
|
||||
),
|
||||
)
|
||||
|
||||
private inline fun <reified R> AnimeFilter.Group<UriPartFilter>.getItemUri(): String {
|
||||
return state.first { it is R }.toUriPart()
|
||||
}
|
||||
|
||||
val filterList = AnimeFilterList(
|
||||
InvertedResultsFilter(),
|
||||
TypeFilter(),
|
||||
LetterFilter(),
|
||||
AnimeFilter.Separator(),
|
||||
AnimeFilter.Header("Estos filtros no afectan a la busqueda por texto"),
|
||||
OtherOptionsGroup(),
|
||||
)
|
||||
|
||||
data class FilterSearchParams(
|
||||
val isInverted: Boolean = false,
|
||||
val type: String = "",
|
||||
val letter: String = "",
|
||||
val genre: String = "",
|
||||
val language: String = "",
|
||||
val year: String = "",
|
||||
val movie: String = "",
|
||||
)
|
||||
|
||||
internal fun getSearchParameters(filters: AnimeFilterList): FilterSearchParams {
|
||||
if (filters.isEmpty()) return FilterSearchParams()
|
||||
|
||||
val others = filters.getFirst<OtherOptionsGroup>()
|
||||
|
||||
return FilterSearchParams(
|
||||
filters.getFirst<InvertedResultsFilter>().state,
|
||||
filters.asUriPart<TypeFilter>(),
|
||||
filters.asUriPart<LetterFilter>(),
|
||||
others.getItemUri<GenreFilter>(),
|
||||
others.getItemUri<LanguageFilter>(),
|
||||
others.getItemUri<YearFilter>(),
|
||||
others.getItemUri<MovieFilter>(),
|
||||
)
|
||||
}
|
||||
|
||||
private object AnimesOnlineNinjaData {
|
||||
val every = Pair("Seleccionar", "")
|
||||
|
||||
val types = arrayOf(
|
||||
Pair("Todos", "todos"),
|
||||
Pair("Series", "serie"),
|
||||
Pair("Peliculas", "pelicula"),
|
||||
)
|
||||
|
||||
val letters = arrayOf(every) + ('a'..'z').map {
|
||||
Pair(it.toString(), it.toString())
|
||||
}.toTypedArray()
|
||||
|
||||
val genres = arrayOf(
|
||||
every,
|
||||
Pair("Sin Censura \uD83D\uDD1E", "sin-censura"),
|
||||
Pair("En emisión ⏩", "en-emision"),
|
||||
Pair("Blu-Ray / DVD \uD83D\uDCC0", "blu-ray-dvd"),
|
||||
Pair("Próximamente", "proximamente"),
|
||||
Pair("Live Action \uD83C\uDDEF\uD83C\uDDF5", "live-action"),
|
||||
Pair("Popular en la web \uD83D\uDCAB", "tendencias"),
|
||||
Pair("Mejores valorados ⭐", "ratings"),
|
||||
)
|
||||
|
||||
val languages = arrayOf(
|
||||
every,
|
||||
Pair("Audio Latino \uD83C\uDDF2\uD83C\uDDFD", "audio-latino"),
|
||||
Pair("Audio Castellano \uD83C\uDDEA\uD83C\uDDF8", "anime-castellano"),
|
||||
)
|
||||
|
||||
val years = arrayOf(every) + (2023 downTo 1979).map {
|
||||
Pair(it.toString(), it.toString())
|
||||
}.toTypedArray()
|
||||
|
||||
val movies = arrayOf(
|
||||
every,
|
||||
Pair("Anime ㊗️", "pelicula"),
|
||||
Pair("Live Action \uD83C\uDDEF\uD83C\uDDF5", "live-action"),
|
||||
)
|
||||
}
|
||||
}
|
@ -32,10 +32,9 @@ class VrfInterceptor : Interceptor {
|
||||
}
|
||||
|
||||
private fun evalJs(west: String, east: String): String {
|
||||
val quickjs = QuickJs.create()
|
||||
val jscript = """$west + $east;"""
|
||||
val result = quickjs.evaluate(jscript).toString()
|
||||
quickjs.close()
|
||||
return result
|
||||
return QuickJs.create().use { qjs ->
|
||||
val jscript = """$west + $east;"""
|
||||
qjs.evaluate(jscript).toString()
|
||||
}
|
||||
}
|
||||
}
|
@ -8,12 +8,14 @@ import okhttp3.OkHttpClient
|
||||
|
||||
class UploadExtractor(private val client: OkHttpClient) {
|
||||
fun videoFromUrl(url: String, headers: Headers, quality: String): Video? {
|
||||
return try {
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
val basicUrl = document.selectFirst("script:containsData(var player =)")!!.data().substringAfter("sources: [\"").substringBefore("\"],")
|
||||
return Video(basicUrl, "$quality Uqload", basicUrl, headers = headers)
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
val newHeaders = headers.newBuilder().add("referer", "https://uqload.com/").build()
|
||||
return runCatching {
|
||||
val document = client.newCall(GET(url, newHeaders)).execute().asJsoup()
|
||||
val basicUrl = document.selectFirst("script:containsData(var player =)")!!
|
||||
.data()
|
||||
.substringAfter("sources: [\"")
|
||||
.substringBefore("\"],")
|
||||
Video(basicUrl, "$quality Uqload", basicUrl, headers = headers)
|
||||
}.getOrNull()
|
||||
}
|
||||
}
|
@ -480,7 +480,7 @@ abstract class DooPlay(
|
||||
SimpleDateFormat("MMMM. dd, yyyy", Locale.ENGLISH)
|
||||
}
|
||||
|
||||
private fun String.toDate(): Long {
|
||||
protected open fun String.toDate(): Long {
|
||||
return runCatching { DATE_FORMATTER.parse(trim())?.time }
|
||||
.getOrNull() ?: 0L
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ class DooPlayGenerator : ThemeSourceGenerator {
|
||||
|
||||
override val sources = listOf(
|
||||
SingleLang("Animes House", "https://animeshouse.net", "pt-BR", isNsfw = false, overrideVersionCode = 4),
|
||||
SingleLang("AnimeOnline.Ninja", "https://www1.animeonline.ninja", "es", className = "AnimeOnlineNinja", isNsfw = false, overrideVersionCode = 26),
|
||||
SingleLang("AnimesFox BR", "https://animesfoxbr.com", "pt-BR", isNsfw = false),
|
||||
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true),
|
||||
SingleLang("Cinemathek", "https://cinemathek.net", "de", isNsfw = true, overrideVersionCode = 11),
|
||||
|
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest />
|
@ -1,19 +0,0 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
ext {
|
||||
extName = 'AnimeonlineNinja'
|
||||
pkgNameSuffix = 'es.animeonlineninja'
|
||||
extClass = '.AnimeonlineNinja'
|
||||
extVersionCode = 26
|
||||
libVersion = '13'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(':lib-fembed-extractor'))
|
||||
implementation(project(':lib-streamtape-extractor'))
|
||||
implementation(project(':lib-streamsb-extractor'))
|
||||
implementation(project(':lib-dood-extractor'))
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
Before Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 122 KiB |
@ -1,460 +0,0 @@
|
||||
package eu.kanade.tachiyomi.animeextension.es.animeonlineninja
|
||||
|
||||
import android.app.Application
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.CheckBoxPreference
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animeextension.es.animeonlineninja.extractors.JsUnpacker
|
||||
import eu.kanade.tachiyomi.animeextension.es.animeonlineninja.extractors.UploadExtractor
|
||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilter
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimesPage
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||
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.fembedextractor.FembedExtractor
|
||||
import eu.kanade.tachiyomi.lib.streamsbextractor.StreamSBExtractor
|
||||
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.lang.Exception
|
||||
|
||||
class AnimeonlineNinja : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
|
||||
override val name = "AnimeOnline.Ninja"
|
||||
|
||||
override val baseUrl = "https://www1.animeonline.ninja"
|
||||
|
||||
override val lang = "es"
|
||||
|
||||
override val supportsLatest = true
|
||||
|
||||
private val preferences: SharedPreferences by lazy {
|
||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||
}
|
||||
|
||||
override val client: OkHttpClient = if (preferences.getBoolean("vrf_intercept", false)) {
|
||||
network.cloudflareClient
|
||||
.newBuilder().addInterceptor(VrfInterceptor()).build()
|
||||
} else {
|
||||
network.cloudflareClient
|
||||
}
|
||||
|
||||
override fun popularAnimeSelector(): String = "div.content.right div.items article"
|
||||
|
||||
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/tendencias/page/$page/")
|
||||
|
||||
override fun popularAnimeFromElement(element: Element): SAnime {
|
||||
val anime = SAnime.create()
|
||||
anime.setUrlWithoutDomain(element.select("div.data h3 a").attr("href"))
|
||||
anime.title = element.select("div.data h3 a").text()
|
||||
anime.thumbnail_url = element.select("div.poster img").attr("data-src").replace("-185x278", "")
|
||||
return anime
|
||||
}
|
||||
|
||||
override fun popularAnimeNextPageSelector(): String = "a.arrow_pag i#nextpagination"
|
||||
|
||||
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||
val episodes = mutableListOf<SEpisode>()
|
||||
val url = response.request.url.toString()
|
||||
val document = response.asJsoup()
|
||||
|
||||
if (url.contains("/pelicula/")) {
|
||||
document.select("ul#playeroptionsul li").forEach {
|
||||
if (it.attr("data-nume").toFloatOrNull() != null) {
|
||||
val epNum = it.attr("data-nume").toFloat()
|
||||
val epName = it.select("span.title").text()
|
||||
|
||||
val episode = SEpisode.create().apply {
|
||||
episode_number = epNum
|
||||
name = epName
|
||||
setUrlWithoutDomain("$url?$epNum")
|
||||
}
|
||||
|
||||
episodes.add(episode)
|
||||
}
|
||||
}
|
||||
return episodes
|
||||
}
|
||||
|
||||
document.select("div#serie_contenido div#seasons div.se-c div.se-a ul.episodios li").forEach {
|
||||
val epTemp = it.select("div.numerando").text().substringBefore("-").replace(" ", "")
|
||||
val epNum = it.select("div.numerando").text().substringAfter("-").replace(" ", "").replace(".", "")
|
||||
val epName = it.select("div.episodiotitle a").text()
|
||||
if (epTemp.isNotBlank() && epNum.isNotBlank()) {
|
||||
val episode = SEpisode.create().apply {
|
||||
episode_number = "$epTemp.$epNum".toFloat()
|
||||
name = "T$epTemp $epName"
|
||||
}
|
||||
episode.setUrlWithoutDomain(it.select("div.episodiotitle a").attr("href"))
|
||||
episodes.add(episode)
|
||||
}
|
||||
}
|
||||
|
||||
return episodes.reversed()
|
||||
}
|
||||
|
||||
override fun episodeListSelector() = throw Exception("not used")
|
||||
|
||||
override fun episodeFromElement(element: Element) = throw Exception("not used")
|
||||
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
val document = response.asJsoup()
|
||||
val videoList = mutableListOf<Video>()
|
||||
val datapost = document.selectFirst("#playeroptionsul li")!!.attr("data-post")
|
||||
val datatype = document.selectFirst("#playeroptionsul li")!!.attr("data-type")
|
||||
|
||||
if (multiserverCheck(document)) {
|
||||
val apiCall = client.newCall(GET("https://www1.animeonline.ninja/wp-json/dooplayer/v1/post/$datapost?type=$datatype&source=1")).execute().asJsoup().body()
|
||||
val iframeLink = apiCall.toString().substringAfter("{\"embed_url\":\"").substringBefore("\"")
|
||||
val sDocument = client.newCall(GET(iframeLink)).execute().asJsoup()
|
||||
sDocument.select("div.ODDIV div").forEach {
|
||||
val lang = it.attr("class").toString().substringAfter("OD OD_").replace("REactiv", "").trim()
|
||||
it.select("li").forEach { source ->
|
||||
val sourceUrl = source.attr("onclick").toString().substringAfter("go_to_player('").substringBefore("')")
|
||||
serverslangParse(sourceUrl, lang).map { video -> videoList.add(video) }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
document.select("#playeroptionsul li").forEach {
|
||||
val sourceId = it.attr("data-nume")
|
||||
val apiCall = client.newCall(GET("https://www1.animeonline.ninja/wp-json/dooplayer/v1/post/$datapost?type=$datatype&source=$sourceId")).execute().asJsoup().body()
|
||||
val sourceUrl = apiCall.toString().substringAfter("{\"embed_url\":\"").substringBefore("\"").replace("\\/", "/")
|
||||
|
||||
val lang2 = preferences.getString("preferred_lang", "SUB").toString().trim()
|
||||
serverslangParse(sourceUrl, lang2).map { video -> videoList.add(video) }
|
||||
}
|
||||
}
|
||||
|
||||
return videoList
|
||||
}
|
||||
|
||||
private fun multiserverCheck(document: Document): Boolean {
|
||||
document.select("#playeroptionsul li").forEach {
|
||||
val title = it.select("span.title").text()
|
||||
val url = it.select("span.server").toString()
|
||||
if (title.lowercase() == "multiserver" || url.contains("saidochesto.top")) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun serverslangParse(serverUrl: String, lang: String): List<Video> {
|
||||
val videos = mutableListOf<Video>()
|
||||
val langSelect = preferences.getString("preferred_lang", "SUB").toString()
|
||||
try {
|
||||
when {
|
||||
serverUrl.contains("fembed") && lang.contains(langSelect) -> {
|
||||
val video = FembedExtractor(client).videosFromUrl(serverUrl, lang)
|
||||
videos.addAll(video)
|
||||
}
|
||||
serverUrl.contains("streamtape") && lang.contains(langSelect) -> {
|
||||
StreamTapeExtractor(client).videoFromUrl(serverUrl, "$lang StreamTape")?.let { it1 -> videos.add(it1) }
|
||||
}
|
||||
serverUrl.contains("dood") && lang.contains(langSelect) -> {
|
||||
DoodExtractor(client).videoFromUrl(serverUrl, "$lang DoodStream", false)?.let { it1 -> videos.add(it1) }
|
||||
}
|
||||
serverUrl.contains("sb") && lang.contains(langSelect) -> {
|
||||
try {
|
||||
val video = StreamSBExtractor(client).videosFromUrl(serverUrl, headers, lang)
|
||||
videos.addAll(video)
|
||||
} catch (_: Exception) { }
|
||||
}
|
||||
serverUrl.contains("mixdrop") && lang.contains(langSelect) -> {
|
||||
try {
|
||||
val jsE = client.newCall(GET(serverUrl)).execute().asJsoup().selectFirst("script:containsData(eval)")!!.data()
|
||||
if (jsE.contains("MDCore")) {
|
||||
val url = "http:" + JsUnpacker(jsE).unpack().toString().substringAfter("MDCore.wurl=\"").substringBefore("\"")
|
||||
if (!url.contains("\$(document).ready(function(){});")) {
|
||||
videos.add(Video(url, "$lang MixDrop", url))
|
||||
}
|
||||
}
|
||||
} catch (_: Exception) { }
|
||||
}
|
||||
serverUrl.contains("wolfstream") && lang.contains(langSelect) -> {
|
||||
val jsE = client.newCall(GET(serverUrl)).execute().asJsoup().selectFirst("script:containsData(sources)")!!.data()
|
||||
val url = jsE.substringAfter("{file:\"").substringBefore("\"")
|
||||
videos.add(Video(url, "$lang WolfStream", url))
|
||||
}
|
||||
serverUrl.contains("uqload") && lang.contains(langSelect) -> {
|
||||
val headers = headers.newBuilder().add("referer", "https://uqload.com/").build()
|
||||
val video = UploadExtractor(client).videoFromUrl(serverUrl, headers, lang)
|
||||
if (video != null) videos.add(video)
|
||||
}
|
||||
}
|
||||
} catch (_: Exception) { }
|
||||
|
||||
return videos
|
||||
}
|
||||
|
||||
override fun videoListSelector() = throw Exception("not used")
|
||||
|
||||
override fun videoUrlParse(document: Document) = throw Exception("not used")
|
||||
|
||||
override fun videoFromElement(element: Element) = throw Exception("not used")
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
return try {
|
||||
val videoSorted = this.sortedWith(
|
||||
compareBy<Video> { it.quality.replace("[0-9]".toRegex(), "") }.thenByDescending { getNumberFromString(it.quality) },
|
||||
).toTypedArray()
|
||||
val userPreferredQuality = preferences.getString("preferred_quality", "SUB Fembed:1080p")
|
||||
val preferredIdx = videoSorted.indexOfFirst { x -> x.quality == userPreferredQuality }
|
||||
if (preferredIdx != -1) {
|
||||
videoSorted.drop(preferredIdx + 1)
|
||||
videoSorted[0] = videoSorted[preferredIdx]
|
||||
}
|
||||
videoSorted.toList()
|
||||
} catch (e: Exception) {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
private fun getNumberFromString(epsStr: String): String {
|
||||
return epsStr.filter { it.isDigit() }.ifEmpty { "0" }
|
||||
}
|
||||
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
||||
val otherOptionsGroup = filters.find { it is OtherOptionsGroup } as? OtherOptionsGroup ?: OtherOptionsGroup()
|
||||
val typeFilter = (filters.find { it is TypeFilter } as? TypeFilter) ?: TypeFilter()
|
||||
val letterFilter = filters.find { it is LetterFilter } as? LetterFilter ?: LetterFilter()
|
||||
val invertedResultsFilter = filters.find { it is InvertedResultsFilter } as? InvertedResultsFilter ?: InvertedResultsFilter()
|
||||
val genreFilter = otherOptionsGroup.state.find { it is GenreFilter } as? GenreFilter ?: GenreFilter()
|
||||
val langFilter = otherOptionsGroup.state.find { it is LangFilter } as? LangFilter ?: LangFilter()
|
||||
val movieFilter = otherOptionsGroup.state.find { it is MovieFilter } as? MovieFilter ?: MovieFilter()
|
||||
|
||||
if (genreFilter.state != 0) {
|
||||
return if (genreFilter.toUriPart() != "tendencias" && genreFilter.toUriPart() != "ratings") {
|
||||
GET("$baseUrl/genero/${genreFilter.toUriPart()}/page/$page/")
|
||||
} else {
|
||||
GET("$baseUrl/${genreFilter.toUriPart()}")
|
||||
}
|
||||
}
|
||||
if (langFilter.state != 0) {
|
||||
return GET("$baseUrl/genero/${langFilter.toUriPart()}/page/$page/")
|
||||
}
|
||||
if (movieFilter.state != 0) {
|
||||
return if (movieFilter.toUriPart() == "pelicula") {
|
||||
GET("$baseUrl/pelicula/page/$page/")
|
||||
} else {
|
||||
GET("$baseUrl/genero/${movieFilter.toUriPart()}/page/$page/")
|
||||
}
|
||||
}
|
||||
|
||||
var url = when {
|
||||
query.isNotBlank() -> "$baseUrl/?s=$query"
|
||||
else -> "$baseUrl/tendencias/?"
|
||||
}
|
||||
|
||||
if (letterFilter.state.isNotBlank()) {
|
||||
url = try {
|
||||
if (letterFilter.state.first().isLetter()) {
|
||||
"$baseUrl/letra/${letterFilter.state.first().uppercase()}/?"
|
||||
} else {
|
||||
"$baseUrl/letra/a/?"
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
"$baseUrl/letra/a/?"
|
||||
}
|
||||
}
|
||||
|
||||
if (typeFilter.state != 0) {
|
||||
url += if (url.contains("tendencias")) {
|
||||
"&get=${when (typeFilter.toUriPart()){
|
||||
"serie" -> "TV"
|
||||
"pelicula" -> "movies"
|
||||
else -> "todos"
|
||||
}}"
|
||||
} else {
|
||||
"&tipo=${typeFilter.toUriPart()}"
|
||||
}
|
||||
}
|
||||
|
||||
if (invertedResultsFilter.state) url += "&orden=asc"
|
||||
|
||||
return GET(url)
|
||||
}
|
||||
|
||||
override fun searchAnimeParse(response: Response): AnimesPage {
|
||||
return if (response.request.url.toString().contains("?s=")) {
|
||||
val document = response.asJsoup()
|
||||
val animes = document.select("div.search-page div.result-item").map {
|
||||
SAnime.create().apply {
|
||||
setUrlWithoutDomain(it.select("article div.details div.title a").attr("href"))
|
||||
title = it.select("article div.details div.title a").text()
|
||||
thumbnail_url = it.select("article div.image div.thumbnail.animation-2 a img").attr("data-src").replace("-150x150", "")
|
||||
}
|
||||
}
|
||||
AnimesPage(animes, false)
|
||||
} else if (response.request.url.toString().contains("letra")) {
|
||||
val document = response.asJsoup()
|
||||
val animes = document.select("div.content div#archive-content.animation-2.items article").map {
|
||||
SAnime.create().apply {
|
||||
setUrlWithoutDomain(it.select("div.data h3 a").attr("href"))
|
||||
title = it.select("div.data h3 a").text()
|
||||
thumbnail_url = it.select("div.poster img").attr("data-src").replace("-500x750", "")
|
||||
}
|
||||
}
|
||||
AnimesPage(animes, true)
|
||||
} else {
|
||||
val document = response.asJsoup()
|
||||
val animes = document.select(popularAnimeSelector()).map { popularAnimeFromElement(it) }
|
||||
AnimesPage(animes, true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun searchAnimeFromElement(element: Element): SAnime = throw Exception("not used")
|
||||
|
||||
override fun searchAnimeNextPageSelector(): String = throw Exception("not used")
|
||||
|
||||
override fun searchAnimeSelector(): String = "div.search-page div.result-item"
|
||||
|
||||
override fun animeDetailsParse(document: Document): SAnime {
|
||||
val anime = SAnime.create()
|
||||
anime.title = document.select("div.sheader div.data h1").text()
|
||||
val uselessTags = listOf("supergoku", "younime", "zonamixs", "monoschinos", "otakustv", "Hanaojara", "series flv", "zenkimex", "Crunchyroll")
|
||||
anime.genre = document.select("div.sheader div.data div.sgeneros a").joinToString("") {
|
||||
if (it.text() in uselessTags || it.text().lowercase().contains("anime")) {
|
||||
""
|
||||
} else {
|
||||
it.text() + ", "
|
||||
}
|
||||
}
|
||||
anime.description = document.select("div.wp-content p").joinToString { it.text() }
|
||||
anime.author = document.select("div.sheader div.data div.extra span a").text()
|
||||
anime.thumbnail_url = document.select("div.poster img").attr("data-src")
|
||||
return anime
|
||||
}
|
||||
|
||||
override fun latestUpdatesNextPageSelector() = popularAnimeNextPageSelector()
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element) = popularAnimeFromElement(element)
|
||||
|
||||
override fun latestUpdatesRequest(page: Int) = GET("https://www1.animeonline.ninja/genero/en-emision/page/$page")
|
||||
|
||||
override fun latestUpdatesSelector() = popularAnimeSelector()
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
val videoQualityPref = ListPreference(screen.context).apply {
|
||||
key = "preferred_quality"
|
||||
title = "Preferred quality"
|
||||
entries = arrayOf("SUB Fembed:480p", "SUB Fembed:720p", "SUB Fembed:1080p")
|
||||
entryValues = arrayOf("SUB Fembed:480p", "SUB Fembed:720p", "SUB Fembed:1080p")
|
||||
setDefaultValue("SUB Fembed:1080p")
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}
|
||||
val langPref = ListPreference(screen.context).apply {
|
||||
key = "preferred_lang"
|
||||
title = "Preferred language"
|
||||
entries = arrayOf("SUB", "All", "ES", "LAT")
|
||||
entryValues = arrayOf("SUB", "", "ES", "LAT")
|
||||
setDefaultValue("SUB")
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}
|
||||
|
||||
val vrfIterceptPref = CheckBoxPreference(screen.context).apply {
|
||||
key = "vrf_intercept"
|
||||
title = "Intercept VRF links (Requiere Reiniciar)"
|
||||
summary = "Intercept VRF links and open them in the browser"
|
||||
setDefaultValue(false)
|
||||
}
|
||||
|
||||
screen.addPreference(videoQualityPref)
|
||||
screen.addPreference(vrfIterceptPref)
|
||||
screen.addPreference(langPref)
|
||||
}
|
||||
|
||||
override fun getFilterList(): AnimeFilterList = AnimeFilterList(
|
||||
InvertedResultsFilter(),
|
||||
TypeFilter(),
|
||||
LetterFilter(),
|
||||
AnimeFilter.Separator(),
|
||||
AnimeFilter.Header("Estos filtros no afectan a la busqueda por texto"),
|
||||
OtherOptionsGroup(),
|
||||
)
|
||||
|
||||
private class OtherOptionsGroup : AnimeFilter.Group<AnimeFilter<*>>(
|
||||
"Otros filtros",
|
||||
listOf(
|
||||
GenreFilter(),
|
||||
LangFilter(),
|
||||
MovieFilter(),
|
||||
),
|
||||
)
|
||||
|
||||
private class LetterFilter : AnimeFilter.Text("Filtrar por letra", "")
|
||||
|
||||
private class InvertedResultsFilter : AnimeFilter.CheckBox("Invertir resultados", false)
|
||||
|
||||
private class TypeFilter : UriPartFilter(
|
||||
"Tipo",
|
||||
arrayOf(
|
||||
Pair("Todos", "todos"),
|
||||
Pair("Series", "serie"),
|
||||
Pair("Peliculas", "pelicula"),
|
||||
),
|
||||
)
|
||||
|
||||
private class GenreFilter : UriPartFilter(
|
||||
"Generos",
|
||||
arrayOf(
|
||||
Pair("Seleccionar", ""),
|
||||
Pair("Sin Censura \uD83D\uDD1E", "sin-censura"),
|
||||
Pair("En emisión ⏩", "en-emision"),
|
||||
Pair("Blu-Ray / DVD \uD83D\uDCC0", "blu-ray-dvd"),
|
||||
Pair("Próximamente", "proximamente"),
|
||||
Pair("Live Action \uD83C\uDDEF\uD83C\uDDF5", "live-action"),
|
||||
Pair("Popular en la web \uD83D\uDCAB", "tendencias"),
|
||||
Pair("Mejores valorados ⭐", "ratings"),
|
||||
),
|
||||
)
|
||||
|
||||
private class LangFilter : UriPartFilter(
|
||||
"Idiomas",
|
||||
arrayOf(
|
||||
Pair("Seleccionar", ""),
|
||||
Pair("Audio Latino \uD83C\uDDF2\uD83C\uDDFD", "audio-latino"),
|
||||
Pair("Audio Castellano \uD83C\uDDEA\uD83C\uDDF8", "anime-castellano"),
|
||||
),
|
||||
)
|
||||
|
||||
private class MovieFilter : UriPartFilter(
|
||||
"Peliculas",
|
||||
arrayOf(
|
||||
Pair("Seleccionar", ""),
|
||||
Pair("Anime ㊗️", "pelicula"),
|
||||
Pair("Live Action \uD83C\uDDEF\uD83C\uDDF5", "live-action"),
|
||||
),
|
||||
)
|
||||
|
||||
private open class UriPartFilter(displayName: String, val vals: Array<Pair<String, String>>) :
|
||||
AnimeFilter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
||||
fun toUriPart() = vals[state].second
|
||||
}
|
||||
}
|
@ -1,214 +0,0 @@
|
||||
package eu.kanade.tachiyomi.animeextension.es.animeonlineninja.extractors
|
||||
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.math.pow
|
||||
|
||||
// https://github.com/cylonu87/JsUnpacker
|
||||
class JsUnpacker(packedJS: String?) {
|
||||
private var packedJS: String? = null
|
||||
|
||||
/**
|
||||
* Detects whether the javascript is P.A.C.K.E.R. coded.
|
||||
*
|
||||
* @return true if it's P.A.C.K.E.R. coded.
|
||||
*/
|
||||
fun detect(): Boolean {
|
||||
val js = packedJS!!.replace(" ", "")
|
||||
val p = Pattern.compile("eval\\(function\\(p,a,c,k,e,[rd]")
|
||||
val m = p.matcher(js)
|
||||
return m.find()
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the javascript
|
||||
*
|
||||
* @return the javascript unpacked or null.
|
||||
*/
|
||||
fun unpack(): String? {
|
||||
val js = packedJS
|
||||
try {
|
||||
var p =
|
||||
Pattern.compile("""\}\s*\('(.*)',\s*(.*?),\s*(\d+),\s*'(.*?)'\.split\('\|'\)""", Pattern.DOTALL)
|
||||
var m = p.matcher(js)
|
||||
if (m.find() && m.groupCount() == 4) {
|
||||
val payload = m.group(1).replace("\\'", "'")
|
||||
val radixStr = m.group(2)
|
||||
val countStr = m.group(3)
|
||||
val symtab = m.group(4).split("\\|".toRegex()).toTypedArray()
|
||||
var radix = 36
|
||||
var count = 0
|
||||
try {
|
||||
radix = radixStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
try {
|
||||
count = countStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
if (symtab.size != count) {
|
||||
throw Exception("Unknown p.a.c.k.e.r. encoding")
|
||||
}
|
||||
val unbase = Unbase(radix)
|
||||
p = Pattern.compile("\\b\\w+\\b")
|
||||
m = p.matcher(payload)
|
||||
val decoded = StringBuilder(payload)
|
||||
var replaceOffset = 0
|
||||
while (m.find()) {
|
||||
val word = m.group(0)
|
||||
val x = unbase.unbase(word)
|
||||
var value: String? = null
|
||||
if (x < symtab.size && x >= 0) {
|
||||
value = symtab[x]
|
||||
}
|
||||
if (value != null && value.isNotEmpty()) {
|
||||
decoded.replace(m.start() + replaceOffset, m.end() + replaceOffset, value)
|
||||
replaceOffset += value.length - word.length
|
||||
}
|
||||
}
|
||||
return decoded.toString()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private inner class Unbase(private val radix: Int) {
|
||||
private val ALPHABET_62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
private val ALPHABET_95 =
|
||||
" !\"#$%&\\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
||||
private var alphabet: String? = null
|
||||
private var dictionary: HashMap<String, Int>? = null
|
||||
fun unbase(str: String): Int {
|
||||
var ret = 0
|
||||
if (alphabet == null) {
|
||||
ret = str.toInt(radix)
|
||||
} else {
|
||||
val tmp = StringBuilder(str).reverse().toString()
|
||||
for (i in tmp.indices) {
|
||||
ret += (radix.toDouble().pow(i.toDouble()) * dictionary!![tmp.substring(i, i + 1)]!!).toInt()
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
init {
|
||||
if (radix > 36) {
|
||||
when {
|
||||
radix < 62 -> {
|
||||
alphabet = ALPHABET_62.substring(0, radix)
|
||||
}
|
||||
radix in 63..94 -> {
|
||||
alphabet = ALPHABET_95.substring(0, radix)
|
||||
}
|
||||
radix == 62 -> {
|
||||
alphabet = ALPHABET_62
|
||||
}
|
||||
radix == 95 -> {
|
||||
alphabet = ALPHABET_95
|
||||
}
|
||||
}
|
||||
dictionary = HashMap(95)
|
||||
for (i in 0 until alphabet!!.length) {
|
||||
dictionary!![alphabet!!.substring(i, i + 1)] = i
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param packedJS javascript P.A.C.K.E.R. coded.
|
||||
*/
|
||||
init {
|
||||
this.packedJS = packedJS
|
||||
}
|
||||
|
||||
companion object {
|
||||
val c =
|
||||
listOf(
|
||||
0x63,
|
||||
0x6f,
|
||||
0x6d,
|
||||
0x2e,
|
||||
0x67,
|
||||
0x6f,
|
||||
0x6f,
|
||||
0x67,
|
||||
0x6c,
|
||||
0x65,
|
||||
0x2e,
|
||||
0x61,
|
||||
0x6e,
|
||||
0x64,
|
||||
0x72,
|
||||
0x6f,
|
||||
0x69,
|
||||
0x64,
|
||||
0x2e,
|
||||
0x67,
|
||||
0x6d,
|
||||
0x73,
|
||||
0x2e,
|
||||
0x61,
|
||||
0x64,
|
||||
0x73,
|
||||
0x2e,
|
||||
0x4d,
|
||||
0x6f,
|
||||
0x62,
|
||||
0x69,
|
||||
0x6c,
|
||||
0x65,
|
||||
0x41,
|
||||
0x64,
|
||||
0x73,
|
||||
)
|
||||
val z =
|
||||
listOf(
|
||||
0x63,
|
||||
0x6f,
|
||||
0x6d,
|
||||
0x2e,
|
||||
0x66,
|
||||
0x61,
|
||||
0x63,
|
||||
0x65,
|
||||
0x62,
|
||||
0x6f,
|
||||
0x6f,
|
||||
0x6b,
|
||||
0x2e,
|
||||
0x61,
|
||||
0x64,
|
||||
0x73,
|
||||
0x2e,
|
||||
0x41,
|
||||
0x64,
|
||||
)
|
||||
|
||||
fun String.load(): String? {
|
||||
return try {
|
||||
var load = this
|
||||
|
||||
for (q in c.indices) {
|
||||
if (c[q % 4] > 270) {
|
||||
load += c[q % 3]
|
||||
} else {
|
||||
load += c[q].toChar()
|
||||
}
|
||||
}
|
||||
|
||||
Class.forName(load.substring(load.length - c.size, load.length)).name
|
||||
} catch (_: Exception) {
|
||||
try {
|
||||
var f = c[2].toChar().toString()
|
||||
for (w in z.indices) {
|
||||
f += z[w].toChar()
|
||||
}
|
||||
return Class.forName(f.substring(0b001, f.length)).name
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package eu.kanade.tachiyomi.animeextension.es.animeonlineninja.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class SolidFilesExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
||||
val videoList = mutableListOf<Video>()
|
||||
return try {
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
document.select("script").forEach { script ->
|
||||
if (script.data().contains("\"downloadUrl\":")) {
|
||||
val data = script.data().substringAfter("\"downloadUrl\":").substringBefore(",")
|
||||
val url = data.replace("\"", "")
|
||||
val videoUrl = url
|
||||
val quality = prefix + "SolidFiles"
|
||||
videoList.add(Video(videoUrl, quality, videoUrl))
|
||||
}
|
||||
}
|
||||
videoList
|
||||
} catch (e: Exception) {
|
||||
videoList
|
||||
}
|
||||
}
|
||||
}
|