feat(multisrc/DooPlay): New source: Animes Grátis(pt) (#1695)
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
dependencies {
|
||||
implementation(project(":lib-streamsb-extractor"))
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
76
multisrc/overrides/dooplay/animesgratis/src/AnimesGratis.kt
Normal file
76
multisrc/overrides/dooplay/animesgratis/src/AnimesGratis.kt
Normal file
@ -0,0 +1,76 @@
|
||||
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.lib.streamsbextractor.StreamSBExtractor
|
||||
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 okhttp3.FormBody
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class AnimesGratis : DooPlay(
|
||||
"pt-BR",
|
||||
"Animes Grátis",
|
||||
"https://animesgratis.org",
|
||||
) {
|
||||
// ============================== 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.flatMap(::getPlayerVideos)
|
||||
}
|
||||
|
||||
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 {
|
||||
"streamsb" in name ->
|
||||
StreamSBExtractor(client).videosFromUrl(url, headers)
|
||||
"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"
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class AnimesGratisPlayerExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
return client.newCall(GET(url)).execute()
|
||||
.use { it.body.string() }
|
||||
.substringAfter("sources: [")
|
||||
.substringBefore("]")
|
||||
.split("{")
|
||||
.drop(1)
|
||||
.map {
|
||||
val label = it.substringAfter("label").substringAfter(":\"").substringBefore('"')
|
||||
val videoUrl = it.substringAfter("file")
|
||||
.substringAfter(":\"")
|
||||
.substringBefore('"')
|
||||
.replace("\\", "")
|
||||
Video(videoUrl, "Player 2 - $label", videoUrl)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class BloggerExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String, headers: Headers): List<Video> {
|
||||
return client.newCall(GET(url)).execute()
|
||||
.use { it.body.string() }
|
||||
.substringAfter("\"streams\":[")
|
||||
.substringBefore("]")
|
||||
.split("},")
|
||||
.map {
|
||||
val url = it.substringAfter("{\"play_url\":\"").substringBefore('"')
|
||||
val format = it.substringAfter("\"format_id\":").substringBefore("}")
|
||||
val quality = when (format) {
|
||||
"18" -> "360p"
|
||||
"22" -> "720p"
|
||||
else -> "Unknown"
|
||||
}
|
||||
Video(url, quality, url, headers = headers)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class RuplayExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
return client.newCall(GET(url)).execute()
|
||||
.use { it.body.string() }
|
||||
.substringAfter("Playerjs({")
|
||||
.substringAfter("file:\"")
|
||||
.substringBefore("\"")
|
||||
.split(",")
|
||||
.map {
|
||||
val videoUrl = it.substringAfter("]")
|
||||
val quality = it.substringAfter("[").substringBefore("]")
|
||||
val headers = Headers.headersOf("Referer", videoUrl)
|
||||
Video(videoUrl, "Ruplay - $quality", videoUrl, headers = headers)
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ class DooPlayGenerator : ThemeSourceGenerator {
|
||||
SingleLang("AnimeOnline.Ninja", "https://www1.animeonline.ninja", "es", className = "AnimeOnlineNinja", isNsfw = false, overrideVersionCode = 26),
|
||||
SingleLang("AnimePlayer", "https://animeplayer.com.br", "pt-BR", isNsfw = true),
|
||||
SingleLang("AnimesFox BR", "https://animesfoxbr.com", "pt-BR", isNsfw = false, overrideVersionCode = 1),
|
||||
SingleLang("Animes Grátis", "https://animesgratis.org", "pt-BR", className = "AnimesGratis", isNsfw = false),
|
||||
SingleLang("Animes House", "https://animeshouse.net", "pt-BR", isNsfw = false, overrideVersionCode = 5),
|
||||
SingleLang("Cinemathek", "https://cinemathek.net", "de", isNsfw = true, overrideVersionCode = 12),
|
||||
SingleLang("CineVision", "https://cinevisionv3.online", "pt-BR", isNsfw = true, overrideVersionCode = 5),
|
||||
|
Reference in New Issue
Block a user