fixes in AnimeOnlineNinja (#1460)
This commit is contained in:
committed by
GitHub
parent
4b6bf5bbbe
commit
1a6bd3f7a0
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'AnimeonlineNinja'
|
extName = 'AnimeonlineNinja'
|
||||||
pkgNameSuffix = 'es.animeonlineninja'
|
pkgNameSuffix = 'es.animeonlineninja'
|
||||||
extClass = '.AnimeonlineNinja'
|
extClass = '.AnimeonlineNinja'
|
||||||
extVersionCode = 23
|
extVersionCode = 24
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.animeextension.es.animeonlineninja
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import androidx.preference.CheckBoxPreference
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.animeextension.es.animeonlineninja.extractors.JsUnpacker
|
import eu.kanade.tachiyomi.animeextension.es.animeonlineninja.extractors.JsUnpacker
|
||||||
@ -39,13 +40,17 @@ class AnimeonlineNinja : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient
|
|
||||||
.newBuilder().addInterceptor(VrfInterceptor()).build()
|
|
||||||
|
|
||||||
private val preferences: SharedPreferences by lazy {
|
private val preferences: SharedPreferences by lazy {
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
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 popularAnimeSelector(): String = "div.content.right div.items article"
|
||||||
|
|
||||||
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/tendencias/page/$page/")
|
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/tendencias/page/$page/")
|
||||||
@ -149,6 +154,7 @@ class AnimeonlineNinja : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
private fun serverslangParse(serverUrl: String, lang: String): List<Video> {
|
private fun serverslangParse(serverUrl: String, lang: String): List<Video> {
|
||||||
val videos = mutableListOf<Video>()
|
val videos = mutableListOf<Video>()
|
||||||
val langSelect = preferences.getString("preferred_lang", "SUB").toString()
|
val langSelect = preferences.getString("preferred_lang", "SUB").toString()
|
||||||
|
try {
|
||||||
when {
|
when {
|
||||||
serverUrl.contains("fembed") && lang.contains(langSelect) -> {
|
serverUrl.contains("fembed") && lang.contains(langSelect) -> {
|
||||||
val video = FembedExtractor(client).videosFromUrl(serverUrl, lang)
|
val video = FembedExtractor(client).videosFromUrl(serverUrl, lang)
|
||||||
@ -188,6 +194,7 @@ class AnimeonlineNinja : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
if (video != null) videos.add(video)
|
if (video != null) videos.add(video)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (_: Exception) { }
|
||||||
|
|
||||||
return videos
|
return videos
|
||||||
}
|
}
|
||||||
@ -327,6 +334,7 @@ class AnimeonlineNinja : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
anime.description = document.select("div.wp-content p").joinToString { 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.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
|
return anime
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +378,15 @@ class AnimeonlineNinja : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(videoQualityPref)
|
||||||
|
screen.addPreference(vrfIterceptPref)
|
||||||
screen.addPreference(langPref)
|
screen.addPreference(langPref)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ class VrfInterceptor : Interceptor {
|
|||||||
val request = chain.request()
|
val request = chain.request()
|
||||||
val response = chain.proceed(request)
|
val response = chain.proceed(request)
|
||||||
val respBody = response.body.string()
|
val respBody = response.body.string()
|
||||||
|
if (response.headers["Content-Type"]?.contains("image") == true) {
|
||||||
|
return chain.proceed(request)
|
||||||
|
}
|
||||||
val body = if (respBody.contains("One moment, please")) {
|
val body = if (respBody.contains("One moment, please")) {
|
||||||
val parsed = Jsoup.parse(respBody)
|
val parsed = Jsoup.parse(respBody)
|
||||||
val js = parsed.selectFirst("script:containsData(west=)")!!.data()
|
val js = parsed.selectFirst("script:containsData(west=)")!!.data()
|
||||||
|
Reference in New Issue
Block a user