chore(multisrc/pt): Purge AnimeSync (#2332)
This commit is contained in:
@ -1,3 +0,0 @@
|
||||
dependencies {
|
||||
implementation(project(":lib-blogger-extractor"))
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
@ -1,116 +0,0 @@
|
||||
package eu.kanade.tachiyomi.animeextension.pt.animesync
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.lib.bloggerextractor.BloggerExtractor
|
||||
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import okhttp3.Headers
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class AnimeSync : DooPlay(
|
||||
"pt-BR",
|
||||
"AnimeSync",
|
||||
"https://animesync.org",
|
||||
) {
|
||||
// ============================== Popular ===============================
|
||||
override fun popularAnimeSelector() = "div.imdbRating > article > a"
|
||||
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes")
|
||||
|
||||
// =============================== Search ===============================
|
||||
override fun searchAnimeSelector() = "div.items > article.item"
|
||||
override fun searchAnimeFromElement(element: Element) = popularAnimeFromElement(element)
|
||||
|
||||
// ============================== Filters ===============================
|
||||
override fun genresListRequest() = GET("$baseUrl/generos/")
|
||||
override fun genresListSelector() = "ul.generos li > a"
|
||||
|
||||
// ============================ Video Links =============================
|
||||
override val prefQualityValues = arrayOf("360p", "720p", "1080p")
|
||||
override val prefQualityEntries = prefQualityValues
|
||||
|
||||
override fun videoListParse(response: Response): List<Video> {
|
||||
val document = response.asJsoup()
|
||||
val players = document.select("ul#playeroptionsul li")
|
||||
return players.parallelMap {
|
||||
runCatching { getPlayerVideos(it) }.getOrElse { emptyList() }
|
||||
}.flatten()
|
||||
}
|
||||
|
||||
private fun getPlayerVideos(player: Element): List<Video> {
|
||||
val url = getPlayerUrl(player)
|
||||
return when {
|
||||
url.contains("/jwplayer/") -> {
|
||||
val doc = client.newCall(GET(url, headers)).execute()
|
||||
.use { it.asJsoup() }
|
||||
val source = doc.selectFirst("source") ?: return emptyList()
|
||||
val quality = source.attr("size").ifEmpty { "360" } + "p"
|
||||
val videoUrl = source.attr("src")
|
||||
listOf(Video(videoUrl, "JWPlayer - $quality", videoUrl, headers))
|
||||
}
|
||||
|
||||
url.contains("/player2/") -> {
|
||||
val doc = client.newCall(GET(url, headers)).execute()
|
||||
.use { it.asJsoup() }
|
||||
doc.selectFirst("script:containsData(sources:)")
|
||||
?.data()
|
||||
?.substringAfter("sources: [")
|
||||
?.substringBefore("]")
|
||||
?.split("{")
|
||||
?.drop(1)
|
||||
.orEmpty()
|
||||
.map {
|
||||
val quality = it.substringAfter("label\":\"").substringBefore('"')
|
||||
val videoUrl = it.substringAfter("file\":\"").substringBefore('"')
|
||||
Video(videoUrl, "Player 2 - $quality", videoUrl, headers)
|
||||
}
|
||||
}
|
||||
|
||||
url.contains("/player/") -> {
|
||||
BloggerExtractor(client).videosFromUrl(url, headers)
|
||||
}
|
||||
|
||||
url.contains("csst.online") -> {
|
||||
val doc = client.newCall(GET(url, headers)).execute()
|
||||
.use { it.asJsoup() }
|
||||
doc.selectFirst("script:containsData(isMobile):containsData(file:)")
|
||||
?.data()
|
||||
?.substringAfter("file:\"")
|
||||
?.substringBefore('"')
|
||||
?.split(",")
|
||||
.orEmpty()
|
||||
.map {
|
||||
val quality = it.substringAfter("[").substringBefore("]")
|
||||
val videoUrl = it.substringAfter("]")
|
||||
val videoHeaders = Headers.Builder().add("Referer", videoUrl).build()
|
||||
Video(videoUrl, "CSST - $quality", videoUrl, videoHeaders)
|
||||
}
|
||||
}
|
||||
|
||||
else -> emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
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/v2/$id/$type/$num"))
|
||||
.execute()
|
||||
.body.string()
|
||||
.substringAfter("\"embed_url\":\"")
|
||||
.substringBefore("\",")
|
||||
.replace("\\", "")
|
||||
}
|
||||
|
||||
// ============================= Utilities ==============================
|
||||
private inline fun <A, B> Iterable<A>.parallelMap(crossinline f: suspend (A) -> B): List<B> =
|
||||
runBlocking {
|
||||
map { async(Dispatchers.Default) { f(it) } }.awaitAll()
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ class DooPlayGenerator : ThemeSourceGenerator {
|
||||
SingleLang("AnimeOnline.Ninja", "https://ww3.animeonline.ninja", "es", className = "AnimeOnlineNinja", isNsfw = false, overrideVersionCode = 33),
|
||||
SingleLang("AnimesOnline", "https://animesonline.nz", "pt-BR", isNsfw = false, overrideVersionCode = 5, pkgName = "animesgratis"),
|
||||
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 1),
|
||||
SingleLang("AnimeSync", "https://animesync.org", "pt-BR", isNsfw = true),
|
||||
SingleLang("AnimeSAGA", "https://www.animesaga.in", "hi", isNsfw = false, overrideVersionCode = 6),
|
||||
SingleLang("AnimesFox BR", "https://animesfox.net", "pt-BR", isNsfw = false, overrideVersionCode = 2),
|
||||
SingleLang("Animes House", "https://animeshouse.net", "pt-BR", isNsfw = false, overrideVersionCode = 5),
|
||||
|
Reference in New Issue
Block a user