fix(pt/animesgratis): Rename Animes Grátis to AnimesOnline + fixes (#2074)
@ -0,0 +1,6 @@
|
|||||||
|
dependencies {
|
||||||
|
implementation(project(":lib-filemoon-extractor"))
|
||||||
|
implementation(project(":lib-streamwish-extractor"))
|
||||||
|
implementation(project(":lib-mixdrop-extractor"))
|
||||||
|
implementation(project(":lib-streamtape-extractor"))
|
||||||
|
}
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -1,87 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.pt.animesgratis
|
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.AnimesGratisPlayerExtractor
|
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.BloggerExtractor
|
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.RuplayExtractor
|
|
||||||
import eu.kanade.tachiyomi.animesource.model.Video
|
|
||||||
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
|
||||||
import eu.kanade.tachiyomi.network.POST
|
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.async
|
|
||||||
import kotlinx.coroutines.awaitAll
|
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import okhttp3.FormBody
|
|
||||||
import okhttp3.Response
|
|
||||||
import org.jsoup.nodes.Element
|
|
||||||
|
|
||||||
class AnimesGratis : DooPlay(
|
|
||||||
"pt-BR",
|
|
||||||
"Animes Grátis",
|
|
||||||
"https://animesgratis.org",
|
|
||||||
) {
|
|
||||||
override val client by lazy {
|
|
||||||
super.client.newBuilder().addInterceptor(VrfInterceptor()).build()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================== Popular ===============================
|
|
||||||
override fun popularAnimeSelector() = "div.imdbRating > article > a"
|
|
||||||
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes/")
|
|
||||||
|
|
||||||
// =============================== Search ===============================
|
|
||||||
override fun searchAnimeSelector() = latestUpdatesSelector()
|
|
||||||
override fun searchAnimeFromElement(element: Element) = popularAnimeFromElement(element)
|
|
||||||
|
|
||||||
// ============================ Video Links =============================
|
|
||||||
override fun videoListParse(response: Response): List<Video> {
|
|
||||||
val document = response.asJsoup()
|
|
||||||
val players = document.select("ul#playeroptionsul li")
|
|
||||||
return players.parallelMap(::getPlayerVideos).flatten()
|
|
||||||
}
|
|
||||||
|
|
||||||
override val prefQualityValues = arrayOf("360p", "480p", "720p", "1080p")
|
|
||||||
override val prefQualityEntries = prefQualityValues
|
|
||||||
|
|
||||||
private fun getPlayerVideos(player: Element): List<Video> {
|
|
||||||
val name = player.selectFirst("span.title")!!.text().lowercase()
|
|
||||||
val url = getPlayerUrl(player)
|
|
||||||
return when {
|
|
||||||
"ruplay" in name ->
|
|
||||||
RuplayExtractor(client).videosFromUrl(url)
|
|
||||||
"/player2/" in url ->
|
|
||||||
AnimesGratisPlayerExtractor(client).videosFromUrl(url)
|
|
||||||
"/player/" in url ->
|
|
||||||
BloggerExtractor(client).videosFromUrl(url, headers)
|
|
||||||
else -> emptyList<Video>()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getPlayerUrl(player: Element): String {
|
|
||||||
val body = FormBody.Builder()
|
|
||||||
.add("action", "doo_player_ajax")
|
|
||||||
.add("post", player.attr("data-post"))
|
|
||||||
.add("nume", player.attr("data-nume"))
|
|
||||||
.add("type", player.attr("data-type"))
|
|
||||||
.build()
|
|
||||||
|
|
||||||
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
|
|
||||||
.execute()
|
|
||||||
.use { response ->
|
|
||||||
response.body.string()
|
|
||||||
.substringAfter("\"embed_url\":\"")
|
|
||||||
.substringBefore("\",")
|
|
||||||
.replace("\\", "")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================== Filters ===============================
|
|
||||||
override fun genresListRequest() = GET("$baseUrl/generos/")
|
|
||||||
override fun genresListSelector() = "ul.generos li > a"
|
|
||||||
|
|
||||||
// ============================= Utilities ==============================
|
|
||||||
private inline fun <A, B> Iterable<A>.parallelMap(crossinline f: suspend (A) -> B): List<B> =
|
|
||||||
runBlocking {
|
|
||||||
map { async(Dispatchers.Default) { f(it) } }.awaitAll()
|
|
||||||
}
|
|
||||||
}
|
|
154
multisrc/overrides/dooplay/animesgratis/src/AnimesOnline.kt
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
package eu.kanade.tachiyomi.animeextension.pt.animesgratis
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.AnimesOnlinePlayerExtractor
|
||||||
|
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.BloggerExtractor
|
||||||
|
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.RuplayExtractor
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
|
import eu.kanade.tachiyomi.lib.filemoonextractor.FilemoonExtractor
|
||||||
|
import eu.kanade.tachiyomi.lib.mixdropextractor.MixDropExtractor
|
||||||
|
import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
|
||||||
|
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
|
||||||
|
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.POST
|
||||||
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.async
|
||||||
|
import kotlinx.coroutines.awaitAll
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import okhttp3.FormBody
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
|
import okhttp3.Response
|
||||||
|
import org.jsoup.nodes.Document
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
|
class AnimesOnline : DooPlay(
|
||||||
|
"pt-BR",
|
||||||
|
"AnimesOnline",
|
||||||
|
"https://animesonline.nz",
|
||||||
|
) {
|
||||||
|
|
||||||
|
override val id: Long = 2969482460524685571L
|
||||||
|
|
||||||
|
// ============================== Popular ===============================
|
||||||
|
override fun popularAnimeSelector() = "div.sidebar.right article > a"
|
||||||
|
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes/")
|
||||||
|
|
||||||
|
// =============================== Search ===============================
|
||||||
|
override fun searchAnimeSelector() = "div.result-item article div.thumbnail > a"
|
||||||
|
override fun searchAnimeFromElement(element: Element) = popularAnimeFromElement(element)
|
||||||
|
|
||||||
|
// ============================== Episodes ==============================
|
||||||
|
override fun episodeListParse(response: Response) =
|
||||||
|
getRealAnimeDoc(response.asJsoup())
|
||||||
|
.select(episodeListSelector())
|
||||||
|
.map(::episodeFromElement)
|
||||||
|
.reversed()
|
||||||
|
|
||||||
|
override fun episodeListSelector() = "ul.episodios > li > div.episodiotitle > a"
|
||||||
|
|
||||||
|
override fun episodeFromElement(element: Element) = SEpisode.create().apply {
|
||||||
|
setUrlWithoutDomain(element.attr("href"))
|
||||||
|
element.text().also {
|
||||||
|
name = it
|
||||||
|
episode_number = it.substringAfter(" ").toFloatOrNull() ?: 0F
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================ Video Links =============================
|
||||||
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
|
val document = response.asJsoup()
|
||||||
|
val players = document.select("ul#playeroptionsul li")
|
||||||
|
return players.parallelMap(::getPlayerVideos).flatten()
|
||||||
|
}
|
||||||
|
|
||||||
|
override val prefQualityValues = arrayOf("360p", "480p", "720p", "1080p")
|
||||||
|
override val prefQualityEntries = prefQualityValues
|
||||||
|
|
||||||
|
private val ruplayExtractor by lazy { RuplayExtractor(client) }
|
||||||
|
private val animesOnlineExtractor by lazy { AnimesOnlinePlayerExtractor(client) }
|
||||||
|
private val bloggerExtractor by lazy { BloggerExtractor(client) }
|
||||||
|
private val filemoonExtractor by lazy { FilemoonExtractor(client) }
|
||||||
|
private val streamTapeExtractor by lazy { StreamTapeExtractor(client) }
|
||||||
|
private val streamWishExtractor by lazy { StreamWishExtractor(client, headers) }
|
||||||
|
private val mixDropExtractor by lazy { MixDropExtractor(client) }
|
||||||
|
|
||||||
|
private fun getPlayerVideos(player: Element): List<Video> {
|
||||||
|
val name = player.selectFirst("span.title")!!.text().lowercase()
|
||||||
|
val url = getPlayerUrl(player) ?: return emptyList()
|
||||||
|
return when {
|
||||||
|
"ruplay" in name -> ruplayExtractor.videosFromUrl(url)
|
||||||
|
"streamwish" in name -> streamWishExtractor.videosFromUrl(url)
|
||||||
|
"filemoon" in name -> filemoonExtractor.videosFromUrl(url)
|
||||||
|
"mixdrop" in name -> mixDropExtractor.videoFromUrl(url)
|
||||||
|
"streamtape" in name ->
|
||||||
|
streamTapeExtractor.videoFromUrl(url)
|
||||||
|
?.let(::listOf)
|
||||||
|
?: emptyList()
|
||||||
|
"/player1/" in url || "/player2/" in url ->
|
||||||
|
animesOnlineExtractor.videosFromUrl(url)
|
||||||
|
"/player/" in url -> bloggerExtractor.videosFromUrl(url, headers)
|
||||||
|
else -> emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getPlayerUrl(player: Element): String? {
|
||||||
|
val body = FormBody.Builder()
|
||||||
|
.add("action", "doo_player_ajax")
|
||||||
|
.add("post", player.attr("data-post"))
|
||||||
|
.add("nume", player.attr("data-nume"))
|
||||||
|
.add("type", player.attr("data-type"))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
|
||||||
|
.execute()
|
||||||
|
.use { response ->
|
||||||
|
response.body.string()
|
||||||
|
.substringAfter("\"embed_url\":\"")
|
||||||
|
.substringBefore("\",")
|
||||||
|
.replace("\\", "")
|
||||||
|
.takeIf(String::isNotBlank)
|
||||||
|
?.let {
|
||||||
|
when {
|
||||||
|
it.contains("$baseUrl/aviso/") ->
|
||||||
|
it.toHttpUrl().queryParameter("url")
|
||||||
|
else -> it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================== Filters ===============================
|
||||||
|
override fun genresListRequest() = GET("$baseUrl/animes/")
|
||||||
|
override fun genresListSelector() = "div.filter > div.select:first-child option:not([disabled])"
|
||||||
|
|
||||||
|
override fun genresListParse(document: Document): Array<Pair<String, String>> {
|
||||||
|
val items = document.select(genresListSelector()).map {
|
||||||
|
val name = it.text()
|
||||||
|
val value = it.attr("value").substringAfter("$baseUrl/")
|
||||||
|
Pair(name, value)
|
||||||
|
}.toTypedArray()
|
||||||
|
|
||||||
|
return if (items.isEmpty()) {
|
||||||
|
items
|
||||||
|
} else {
|
||||||
|
arrayOf(Pair(selectFilterText, "")) + items
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================= Utilities ==============================
|
||||||
|
private inline fun <A, B> Iterable<A>.parallelMap(crossinline f: suspend (A) -> B): List<B> =
|
||||||
|
runBlocking {
|
||||||
|
map { async(Dispatchers.Default) { f(it) } }.awaitAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getRealAnimeDoc(document: Document): Document {
|
||||||
|
if (!document.location().contains("/episodio/")) return document
|
||||||
|
|
||||||
|
return document.selectFirst("div.pag_episodes div.item > a:has(i.fa-th)")?.let {
|
||||||
|
client.newCall(GET(it.attr("href"), headers)).execute()
|
||||||
|
.use { req -> req.asJsoup() }
|
||||||
|
} ?: document
|
||||||
|
}
|
||||||
|
}
|
@ -1,40 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.pt.animesgratis
|
|
||||||
|
|
||||||
import app.cash.quickjs.QuickJs
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
|
||||||
import okhttp3.Interceptor
|
|
||||||
import okhttp3.Response
|
|
||||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
|
||||||
import org.jsoup.Jsoup
|
|
||||||
|
|
||||||
class VrfInterceptor : Interceptor {
|
|
||||||
|
|
||||||
override fun intercept(chain: Interceptor.Chain): Response {
|
|
||||||
val request = chain.request()
|
|
||||||
val response = chain.proceed(request)
|
|
||||||
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 parsed = Jsoup.parse(respBody)
|
|
||||||
val js = parsed.selectFirst("script:containsData(west=)")!!.data()
|
|
||||||
val west = js.substringAfter("west=").substringBefore(",")
|
|
||||||
val east = js.substringAfter("east=").substringBefore(",")
|
|
||||||
val form = parsed.selectFirst("form#wsidchk-form")!!.attr("action")
|
|
||||||
val eval = evalJs(west, east)
|
|
||||||
val getLink = "https://" + request.url.host + form + "?wsidchk=$eval"
|
|
||||||
chain.proceed(GET(getLink)).body
|
|
||||||
} else {
|
|
||||||
respBody.toResponseBody(response.body.contentType())
|
|
||||||
}
|
|
||||||
return response.newBuilder().body(body).build()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun evalJs(west: String, east: String): String {
|
|
||||||
return QuickJs.create().use { qjs ->
|
|
||||||
val jscript = """$west + $east;"""
|
|
||||||
qjs.evaluate(jscript).toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,7 +4,7 @@ import eu.kanade.tachiyomi.animesource.model.Video
|
|||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
class AnimesGratisPlayerExtractor(private val client: OkHttpClient) {
|
class AnimesOnlinePlayerExtractor(private val client: OkHttpClient) {
|
||||||
fun videosFromUrl(url: String): List<Video> {
|
fun videosFromUrl(url: String): List<Video> {
|
||||||
return client.newCall(GET(url)).execute()
|
return client.newCall(GET(url)).execute()
|
||||||
.use { it.body.string() }
|
.use { it.body.string() }
|
||||||
@ -18,7 +18,7 @@ class AnimesGratisPlayerExtractor(private val client: OkHttpClient) {
|
|||||||
.substringAfter(":\"")
|
.substringAfter(":\"")
|
||||||
.substringBefore('"')
|
.substringBefore('"')
|
||||||
.replace("\\", "")
|
.replace("\\", "")
|
||||||
Video(videoUrl, "Player 2 - $label", videoUrl)
|
Video(videoUrl, "Player - $label", videoUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,11 +13,11 @@ class DooPlayGenerator : ThemeSourceGenerator {
|
|||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
SingleLang("AnimeOnline360", "https://animeonline360.me", "en", isNsfw = false),
|
SingleLang("AnimeOnline360", "https://animeonline360.me", "en", isNsfw = false),
|
||||||
SingleLang("AnimeOnline.Ninja", "https://ww3.animeonline.ninja", "es", className = "AnimeOnlineNinja", isNsfw = false, overrideVersionCode = 31),
|
SingleLang("AnimeOnline.Ninja", "https://ww3.animeonline.ninja", "es", className = "AnimeOnlineNinja", isNsfw = false, overrideVersionCode = 31),
|
||||||
|
SingleLang("AnimesOnline", "https://animesonline.nz", "pt-BR", isNsfw = false, overrideVersionCode = 3, pkgName = "animesgratis"),
|
||||||
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 1),
|
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 1),
|
||||||
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true),
|
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true),
|
||||||
SingleLang("AnimeSync", "https://animesync.org", "pt-BR", isNsfw = true),
|
SingleLang("AnimeSync", "https://animesync.org", "pt-BR", isNsfw = true),
|
||||||
SingleLang("AnimesFox BR", "https://animesfox.net", "pt-BR", isNsfw = false, overrideVersionCode = 2),
|
SingleLang("AnimesFox BR", "https://animesfox.net", "pt-BR", isNsfw = false, overrideVersionCode = 2),
|
||||||
SingleLang("Animes Grátis", "https://animesgratis.org", "pt-BR", className = "AnimesGratis", isNsfw = false, overrideVersionCode = 2),
|
|
||||||
SingleLang("Animes House", "https://animeshouse.net", "pt-BR", isNsfw = false, overrideVersionCode = 5),
|
SingleLang("Animes House", "https://animeshouse.net", "pt-BR", isNsfw = false, overrideVersionCode = 5),
|
||||||
SingleLang("Cinemathek", "https://cinemathek.net", "de", isNsfw = true, overrideVersionCode = 15),
|
SingleLang("Cinemathek", "https://cinemathek.net", "de", isNsfw = true, overrideVersionCode = 15),
|
||||||
SingleLang("DonghuaX", "https://donghuax.com", "pt-BR", isNsfw = false, overrideVersionCode = 1),
|
SingleLang("DonghuaX", "https://donghuax.com", "pt-BR", isNsfw = false, overrideVersionCode = 1),
|
||||||
|