fix(pt/vizer): Update baseUrl, fix episode list, add WarezCDN extractor (#3036)
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'Vizer.tv'
|
extName = 'Vizer.tv'
|
||||||
extClass = '.Vizer'
|
extClass = '.Vizer'
|
||||||
extVersionCode = 13
|
extVersionCode = 14
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,4 +10,4 @@ apply from: "$rootDir/common.gradle"
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(':lib:mixdrop-extractor'))
|
implementation(project(':lib:mixdrop-extractor'))
|
||||||
implementation(project(':lib:streamtape-extractor'))
|
implementation(project(':lib:streamtape-extractor'))
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,12 @@ import androidx.preference.ListPreference
|
|||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.vizer.VizerFilters.FilterSearchParams
|
import eu.kanade.tachiyomi.animeextension.pt.vizer.VizerFilters.FilterSearchParams
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.EpisodeListDto
|
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.EpisodeListDto
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.PlayersDto
|
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.HostersDto
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.SearchItemDto
|
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.SearchItemDto
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.SearchResultDto
|
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.SearchResultDto
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.VideoDto
|
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.VideoDto
|
||||||
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.VideoLanguagesDto
|
import eu.kanade.tachiyomi.animeextension.pt.vizer.dto.VideoListDto
|
||||||
|
import eu.kanade.tachiyomi.animeextension.pt.vizer.extractors.WarezExtractor
|
||||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||||
import eu.kanade.tachiyomi.animesource.model.AnimesPage
|
import eu.kanade.tachiyomi.animesource.model.AnimesPage
|
||||||
@ -24,7 +25,6 @@ import eu.kanade.tachiyomi.network.POST
|
|||||||
import eu.kanade.tachiyomi.network.awaitSuccess
|
import eu.kanade.tachiyomi.network.awaitSuccess
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import eu.kanade.tachiyomi.util.parseAs
|
import eu.kanade.tachiyomi.util.parseAs
|
||||||
import kotlinx.serialization.json.Json
|
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.MediaType.Companion.toMediaType
|
import okhttp3.MediaType.Companion.toMediaType
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
@ -33,20 +33,19 @@ import okhttp3.Response
|
|||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import uy.kohesive.injekt.injectLazy
|
|
||||||
|
|
||||||
class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
|
|
||||||
override val name = "Vizer.tv"
|
override val name = "Vizer.tv"
|
||||||
|
|
||||||
override val baseUrl = "https://vizer.tv"
|
override val baseUrl = "https://vizertv.in"
|
||||||
private val apiUrl = "$baseUrl/includes/ajax"
|
private val apiUrl = "$baseUrl/includes/ajax"
|
||||||
|
|
||||||
override val lang = "pt-BR"
|
override val lang = "pt-BR"
|
||||||
|
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
|
||||||
private val json: Json by injectLazy()
|
override fun headersBuilder() = super.headersBuilder().add("Referer", "$baseUrl/")
|
||||||
|
|
||||||
private val preferences by lazy {
|
private val preferences by lazy {
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
@ -65,7 +64,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
override fun popularAnimeParse(response: Response): AnimesPage {
|
override fun popularAnimeParse(response: Response): AnimesPage {
|
||||||
val result = response.parseAs<SearchResultDto>()
|
val result = response.parseAs<SearchResultDto>()
|
||||||
val animes = result.list.map(::animeFromObject)
|
val animes = result.items.values.map(::animeFromObject)
|
||||||
val hasNext = result.quantity == 35
|
val hasNext = result.quantity == 35
|
||||||
return AnimesPage(animes, hasNext)
|
return AnimesPage(animes, hasNext)
|
||||||
}
|
}
|
||||||
@ -89,7 +88,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
override fun latestUpdatesParse(response: Response): AnimesPage {
|
override fun latestUpdatesParse(response: Response): AnimesPage {
|
||||||
val parsedData = response.parseAs<SearchResultDto>()
|
val parsedData = response.parseAs<SearchResultDto>()
|
||||||
val animes = parsedData.list.map(::animeFromObject)
|
val animes = parsedData.items.values.map(::animeFromObject)
|
||||||
return AnimesPage(animes, false)
|
return AnimesPage(animes, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +164,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
val sname = seasonElement.text()
|
val sname = seasonElement.text()
|
||||||
val response = client.newCall(apiRequest("getEpisodes=$id")).execute()
|
val response = client.newCall(apiRequest("getEpisodes=$id")).execute()
|
||||||
val episodes = response.parseAs<EpisodeListDto>().episodes
|
val episodes = response.parseAs<EpisodeListDto>().episodes
|
||||||
|
.values
|
||||||
.filter { it.released }
|
.filter { it.released }
|
||||||
.map {
|
.map {
|
||||||
SEpisode.create().apply {
|
SEpisode.create().apply {
|
||||||
@ -178,7 +178,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
override fun episodeListParse(response: Response): List<SEpisode> {
|
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||||
val doc = response.asJsoup()
|
val doc = response.asJsoup()
|
||||||
val seasons = doc.select("div#seasonsList div.item[data-season-id]")
|
val seasons = doc.select("div.seasons div.list div.item[data-season-id]")
|
||||||
return if (seasons.size > 0) {
|
return if (seasons.size > 0) {
|
||||||
seasons.flatMap(::getSeasonEps).reversed()
|
seasons.flatMap(::getSeasonEps).reversed()
|
||||||
} else {
|
} else {
|
||||||
@ -201,17 +201,24 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
} else {
|
} else {
|
||||||
// Fake url, its an ID that will be used to get episode languages
|
// Fake url, its an ID that will be used to get episode languages
|
||||||
// (sub/dub) and then return the video link
|
// (sub/dub) and then return the video link
|
||||||
apiRequest("getEpisodeLanguages=$url")
|
apiRequest("getEpisodeData=$url")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun videoListParse(response: Response): List<Video> {
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
val body = response.body.string()
|
val body = response.body.string()
|
||||||
val videoObjectList = if (body.startsWith("{")) {
|
val videoObjectList = if (body.startsWith("{")) {
|
||||||
json.decodeFromString<VideoLanguagesDto>(body).videos
|
body.parseAs<VideoListDto>().videos.values.toList()
|
||||||
} else {
|
} else {
|
||||||
val videoJson = body.substringAfterLast("videoPlayerBox(").substringBefore(");")
|
val doc = response.asJsoup(body)
|
||||||
json.decodeFromString<VideoLanguagesDto>(videoJson).videos
|
doc.select("div.audios div[data-load-player]").mapNotNull {
|
||||||
|
try {
|
||||||
|
val movieHosters = it.attr("data-players").parseAs<HostersDto>()
|
||||||
|
val movieId = it.attr("data-load-player")
|
||||||
|
val movieLang = if (it.hasClass("legendado")) "1" else "0"
|
||||||
|
VideoDto(movieId, movieLang).apply { hosters = movieHosters }
|
||||||
|
} catch (_: Throwable) { null }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return videoObjectList.flatMap(::getVideosFromObject)
|
return videoObjectList.flatMap(::getVideosFromObject)
|
||||||
@ -219,22 +226,23 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
private val mixdropExtractor by lazy { MixDropExtractor(client) }
|
private val mixdropExtractor by lazy { MixDropExtractor(client) }
|
||||||
private val streamtapeExtractor by lazy { StreamTapeExtractor(client) }
|
private val streamtapeExtractor by lazy { StreamTapeExtractor(client) }
|
||||||
|
private val warezExtractor by lazy { WarezExtractor(client, headers) }
|
||||||
|
|
||||||
private fun getVideosFromObject(videoObj: VideoDto): List<Video> {
|
private fun getVideosFromObject(videoObj: VideoDto): List<Video> {
|
||||||
val players = client.newCall(apiRequest("getVideoPlayers=${videoObj.id}"))
|
val hosters = videoObj.hosters ?: return emptyList()
|
||||||
.execute()
|
|
||||||
.parseAs<PlayersDto>()
|
|
||||||
val langPrefix = if (videoObj.lang == "1") "LEG" else "DUB"
|
val langPrefix = if (videoObj.lang == "1") "LEG" else "DUB"
|
||||||
val videoList = players.iterator().mapNotNull { (name, status) ->
|
|
||||||
if (status == "0") return@mapNotNull null
|
return hosters.iterator().flatMap { (name, status) ->
|
||||||
|
if (status != 3) return@flatMap emptyList()
|
||||||
val url = getPlayerUrl(videoObj.id, name)
|
val url = getPlayerUrl(videoObj.id, name)
|
||||||
when (name) {
|
when (name) {
|
||||||
"mixdrop" -> mixdropExtractor.videoFromUrl(url, langPrefix)
|
"mixdrop" -> mixdropExtractor.videosFromUrl(url, langPrefix)
|
||||||
"streamtape" -> streamtapeExtractor.videosFromUrl(url, "StreamTape($langPrefix)")
|
"streamtape" -> streamtapeExtractor.videosFromUrl(url, "StreamTape($langPrefix)")
|
||||||
else -> null
|
"warezcdn" -> warezExtractor.videosFromUrl(url, langPrefix)
|
||||||
|
else -> emptyList()
|
||||||
}
|
}
|
||||||
}.flatten()
|
}
|
||||||
return videoList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================== Settings ==============================
|
// ============================== Settings ==============================
|
||||||
@ -289,10 +297,19 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============================= Utilities ==============================
|
// ============================= Utilities ==============================
|
||||||
|
private val noRedirectClient = client.newBuilder().followRedirects(false).build()
|
||||||
|
|
||||||
private fun getPlayerUrl(id: String, name: String): String {
|
private fun getPlayerUrl(id: String, name: String): String {
|
||||||
val req = GET("$baseUrl/embed/getPlay.php?id=$id&sv=$name")
|
val req = GET("$baseUrl/embed/getPlay.php?id=$id&sv=$name", headers)
|
||||||
val body = client.newCall(req).execute().body.string()
|
return if (name == "warezcdn") {
|
||||||
return body.substringAfter("location.href=\"").substringBefore("\";")
|
val res = noRedirectClient.newCall(req).execute()
|
||||||
|
res.close()
|
||||||
|
res.headers["location"]!!
|
||||||
|
} else {
|
||||||
|
val res = client.newCall(req).execute()
|
||||||
|
val body = res.body.string()
|
||||||
|
body.substringAfter("location.href=\"", "").substringBefore("\";", "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun apiRequest(body: String): Request {
|
private fun apiRequest(body: String): Request {
|
||||||
@ -333,6 +350,7 @@ class Vizer : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
private val PREF_PLAYER_ARRAY = arrayOf(
|
private val PREF_PLAYER_ARRAY = arrayOf(
|
||||||
"MixDrop",
|
"MixDrop",
|
||||||
"StreamTape",
|
"StreamTape",
|
||||||
|
"WarezCDN",
|
||||||
)
|
)
|
||||||
|
|
||||||
private const val PREF_LANGUAGE_KEY = "pref_language"
|
private const val PREF_LANGUAGE_KEY = "pref_language"
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.pt.vizer.dto
|
package eu.kanade.tachiyomi.animeextension.pt.vizer.dto
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.util.parseAs
|
||||||
import kotlinx.serialization.EncodeDefault
|
import kotlinx.serialization.EncodeDefault
|
||||||
import kotlinx.serialization.KSerializer
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.builtins.ListSerializer
|
|
||||||
import kotlinx.serialization.json.JsonArray
|
typealias FakeList<T> = Map<String, T>
|
||||||
import kotlinx.serialization.json.JsonElement
|
|
||||||
import kotlinx.serialization.json.JsonObject
|
|
||||||
import kotlinx.serialization.json.JsonTransformingSerializer
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SearchResultDto(
|
class SearchResultDto(
|
||||||
val quantity: Int = 0,
|
val quantity: Int = 0,
|
||||||
@Serializable(with = GenericListSerializer::class)
|
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
val list: List<SearchItemDto> = emptyList(),
|
@SerialName("list")
|
||||||
|
val items: FakeList<SearchItemDto> = emptyMap(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SearchItemDto(
|
class SearchItemDto(
|
||||||
val id: String,
|
val id: String,
|
||||||
val title: String,
|
val title: String,
|
||||||
val url: String,
|
val url: String,
|
||||||
@ -28,14 +25,13 @@ data class SearchItemDto(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EpisodeListDto(
|
class EpisodeListDto(
|
||||||
@Serializable(with = GenericListSerializer::class)
|
|
||||||
@SerialName("list")
|
@SerialName("list")
|
||||||
val episodes: List<EpisodeItemDto>,
|
val episodes: FakeList<EpisodeItemDto>,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EpisodeItemDto(
|
class EpisodeItemDto(
|
||||||
val id: String,
|
val id: String,
|
||||||
val name: String,
|
val name: String,
|
||||||
val released: Boolean,
|
val released: Boolean,
|
||||||
@ -43,36 +39,36 @@ data class EpisodeItemDto(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class VideoLanguagesDto(
|
class VideoListDto(
|
||||||
@SerialName("list")
|
@SerialName("list")
|
||||||
@Serializable(with = GenericListSerializer::class)
|
val videos: FakeList<VideoDto>,
|
||||||
val videos: List<VideoDto>,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class VideoDto(
|
class VideoDto(
|
||||||
val id: String,
|
val id: String,
|
||||||
val lang: String,
|
val lang: String,
|
||||||
)
|
@SerialName("players")
|
||||||
|
private val players: String? = null,
|
||||||
|
) {
|
||||||
|
var hosters = try {
|
||||||
|
players?.parseAs<HostersDto>()
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class PlayersDto(
|
class HostersDto(
|
||||||
val mixdrop: String = "0",
|
val mixdrop: Int = 0,
|
||||||
val streamtape: String = "0",
|
val streamtape: Int = 0,
|
||||||
|
val warezcdn: Int = 0,
|
||||||
) {
|
) {
|
||||||
operator fun iterator(): List<Pair<String, String>> {
|
operator fun iterator(): List<Pair<String, Int>> {
|
||||||
return listOf(
|
return listOf(
|
||||||
"mixdrop" to mixdrop,
|
"mixdrop" to mixdrop,
|
||||||
"streamtape" to streamtape,
|
"streamtape" to streamtape,
|
||||||
|
"warezcdn" to warezcdn,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GenericListSerializer<T>(
|
|
||||||
private val itemSerializer: KSerializer<T>,
|
|
||||||
) : JsonTransformingSerializer<List<T>>(ListSerializer(itemSerializer)) {
|
|
||||||
override fun transformDeserialize(element: JsonElement): JsonElement {
|
|
||||||
val jsonObj = element as JsonObject
|
|
||||||
return JsonArray(jsonObj.values.toList())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
package eu.kanade.tachiyomi.animeextension.pt.vizer.extractors
|
||||||
|
|
||||||
|
import android.util.Base64
|
||||||
|
import eu.kanade.tachiyomi.animesource.model.Video
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.POST
|
||||||
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import okhttp3.FormBody
|
||||||
|
import okhttp3.Headers
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
|
class WarezExtractor(private val client: OkHttpClient, private val headers: Headers) {
|
||||||
|
|
||||||
|
fun videosFromUrl(url: String, lang: String): List<Video> {
|
||||||
|
val doc = client.newCall(GET(url, headers)).execute().asJsoup()
|
||||||
|
val httpUrl = doc.location().toHttpUrl()
|
||||||
|
val videoId = httpUrl.queryParameter("id") ?: return emptyList()
|
||||||
|
val script = doc.selectFirst("script:containsData(allowanceKey)")?.data()
|
||||||
|
?: return emptyList()
|
||||||
|
val key = script.substringAfter("allowanceKey").substringAfter('"').substringBefore('"')
|
||||||
|
val cdn = script.substringAfter("cdnListing").substringAfter('[').substringBefore(']')
|
||||||
|
.split(',')
|
||||||
|
.random()
|
||||||
|
|
||||||
|
val body = FormBody.Builder()
|
||||||
|
.add("getVideo", videoId)
|
||||||
|
.add("key", key)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val host = "https://" + httpUrl.host
|
||||||
|
val reqHeaders = headers.newBuilder()
|
||||||
|
.set("Origin", host)
|
||||||
|
.set("Referer", url)
|
||||||
|
.set("X-Requested-With", "XMLHttpRequest")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val req = client.newCall(POST("$host/player/functions.php", reqHeaders, body)).execute()
|
||||||
|
val id = req.body.string().substringAfter("id\":\"", "").substringBefore('"', "")
|
||||||
|
.ifBlank { return emptyList() }
|
||||||
|
val decrypted = decryptorium(id)
|
||||||
|
val videoUrl = "https://workerproxy.warezcdn.workers.dev/?url=https://cloclo$cdn.cloud.mail.ru/weblink/view/$decrypted"
|
||||||
|
return listOf(Video(videoUrl, "WarezCDN - $lang", videoUrl, headers))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun decryptorium(enc: String): String {
|
||||||
|
val b64dec = String(Base64.decode(enc, Base64.DEFAULT)).trim()
|
||||||
|
val start = b64dec.reversed().dropLast(5)
|
||||||
|
val end = b64dec.substring(0, 5)
|
||||||
|
return start + end
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user