mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
9anime should work now
This commit is contained in:
parent
9b6b06437f
commit
c6a10518f5
5 changed files with 311 additions and 261 deletions
|
@ -837,9 +837,9 @@ fun AnimeSearchResponse.addDubStatus(
|
|||
|
||||
fun AnimeSearchResponse.addDubStatus(status: String, episodes: Int? = null) {
|
||||
if (status.contains("(dub)", ignoreCase = true)) {
|
||||
addDubStatus(DubStatus.Dubbed)
|
||||
addDubStatus(DubStatus.Dubbed, episodes)
|
||||
} else if (status.contains("(sub)", ignoreCase = true)) {
|
||||
addDubStatus(DubStatus.Subbed)
|
||||
addDubStatus(DubStatus.Subbed, episodes)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1020,25 +1020,28 @@ interface LoadResponse {
|
|||
}
|
||||
|
||||
fun LoadResponse.addDuration(input: String?) {
|
||||
val cleanInput = input?.trim()?.replace(" ", "") ?: return
|
||||
this.duration = getDurationFromString(input) ?: this.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getDurationFromString(input: String?): Int? {
|
||||
val cleanInput = input?.trim()?.replace(" ", "") ?: return null
|
||||
Regex("([0-9]*)h.*?([0-9]*)m").find(cleanInput)?.groupValues?.let { values ->
|
||||
if (values.size == 3) {
|
||||
val hours = values[1].toIntOrNull()
|
||||
val minutes = values[2].toIntOrNull()
|
||||
this.duration = if (minutes != null && hours != null) {
|
||||
return if (minutes != null && hours != null) {
|
||||
hours * 60 + minutes
|
||||
} else null
|
||||
if (this.duration != null) return
|
||||
}
|
||||
}
|
||||
Regex("([0-9]*)m").find(cleanInput)?.groupValues?.let { values ->
|
||||
if (values.size == 2) {
|
||||
this.duration = values[1].toIntOrNull()
|
||||
if (this.duration != null) return
|
||||
}
|
||||
}
|
||||
return values[1].toIntOrNull()
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun LoadResponse?.isEpisodeBased(): Boolean {
|
||||
|
@ -1118,7 +1121,7 @@ data class AnimeLoadResponse(
|
|||
) : LoadResponse, EpisodeResponse
|
||||
|
||||
fun AnimeLoadResponse.addEpisodes(status: DubStatus, episodes: List<Episode>?) {
|
||||
if (episodes == null) return
|
||||
if (episodes.isNullOrEmpty()) return
|
||||
this.episodes[status] = episodes
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,10 @@ package com.lagradost.cloudstream3.animeproviders
|
|||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||
import com.lagradost.cloudstream3.utils.Qualities
|
||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||
import org.jsoup.Jsoup
|
||||
import java.util.*
|
||||
|
||||
class NineAnimeProvider : MainAPI() {
|
||||
override var mainUrl = "https://9anime.id"
|
||||
|
@ -16,6 +15,7 @@ class NineAnimeProvider : MainAPI() {
|
|||
override val hasChromecastSupport = true
|
||||
override val hasDownloadSupport = true
|
||||
override val supportedTypes = setOf(TvType.Anime)
|
||||
override val hasQuickSearch = true
|
||||
|
||||
companion object {
|
||||
fun getDubStatus(title: String): DubStatus {
|
||||
|
@ -25,65 +25,27 @@ class NineAnimeProvider : MainAPI() {
|
|||
DubStatus.Subbed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getMainPage(): HomePageResponse {
|
||||
val items = listOf(
|
||||
Pair("$mainUrl/ajax/home/widget?name=trending", "Trending"),
|
||||
Pair("$mainUrl/ajax/home/widget?name=updated_all", "All"),
|
||||
Pair("$mainUrl/ajax/home/widget?name=updated_sub&page=1", "Recently Updated (SUB)"),
|
||||
Pair(
|
||||
"$mainUrl/ajax/home/widget?name=updated_dub&page=1",
|
||||
"Recently Updated (DUB)"
|
||||
),
|
||||
Pair(
|
||||
"$mainUrl/ajax/home/widget?name=updated_chinese&page=1",
|
||||
"Recently Updated (Chinese)"
|
||||
),
|
||||
Pair("$mainUrl/ajax/home/widget?name=random", "Random"),
|
||||
).apmap { (url, name) ->
|
||||
val home = Jsoup.parse(
|
||||
app.get(
|
||||
url
|
||||
).parsed<Response>().html
|
||||
).select("ul.anime-list li").map {
|
||||
val title = it.selectFirst("a.name")!!.text()
|
||||
val link = it.selectFirst("a")!!.attr("href")
|
||||
val poster = it.selectFirst("a.poster img")!!.attr("src")
|
||||
|
||||
newAnimeSearchResponse(title, link) {
|
||||
this.posterUrl = poster
|
||||
addDubStatus(getDubStatus(title))
|
||||
}
|
||||
}
|
||||
private const val nineAnimeKey =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
private const val cipherKey = "rTKp3auwu0ULA6II"
|
||||
|
||||
HomePageList(name, home)
|
||||
}
|
||||
|
||||
return HomePageResponse(items)
|
||||
}
|
||||
|
||||
//Credits to https://github.com/jmir1
|
||||
private val key =
|
||||
"c/aUAorINHBLxWTy3uRiPt8J+vjsOheFG1E0q2X9CYwDZlnmd4Kb5M6gSVzfk7pQ" //key credits to @Modder4869
|
||||
|
||||
private fun getVrf(id: String): String? {
|
||||
val reversed = ue(encode(id) + "0000000").slice(0..5).reversed()
|
||||
|
||||
return reversed + ue(je(reversed, encode(id) ?: return null)).replace(
|
||||
"""=+$""".toRegex(),
|
||||
""
|
||||
private fun encodeVrf(text: String): String {
|
||||
return encode(
|
||||
encrypt(
|
||||
cipher(cipherKey, encode(text)),
|
||||
nineAnimeKey
|
||||
).replace("""=+$""".toRegex(), "")
|
||||
)
|
||||
}
|
||||
|
||||
private fun getLink(url: String): String? {
|
||||
val i = url.slice(0..5)
|
||||
val n = url.slice(6..url.lastIndex)
|
||||
return decode(je(i, ze(n)))
|
||||
private fun decodeVrf(text: String): String {
|
||||
return decode(cipher(cipherKey, decrypt(text, nineAnimeKey)))
|
||||
}
|
||||
|
||||
private fun ue(input: String): String {
|
||||
if (input.any { it.code >= 256 }) throw Exception("illegal characters!")
|
||||
fun encrypt(input: String, key: String): String {
|
||||
if (input.any { it.code > 255 }) throw Exception("illegal characters!")
|
||||
var output = ""
|
||||
for (i in input.indices step 3) {
|
||||
val a = intArrayOf(-1, -1, -1, -1)
|
||||
|
@ -104,38 +66,39 @@ class NineAnimeProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
return output
|
||||
}
|
||||
|
||||
private fun je(inputOne: String, inputTwo: String): String {
|
||||
fun cipher(key: String, text: String): String {
|
||||
val arr = IntArray(256) { it }
|
||||
var output = ""
|
||||
|
||||
var u = 0
|
||||
var r: Int
|
||||
for (a in arr.indices) {
|
||||
u = (u + arr[a] + inputOne[a % inputOne.length].code) % 256
|
||||
r = arr[a]
|
||||
arr[a] = arr[u]
|
||||
arr.indices.forEach {
|
||||
u = (u + arr[it] + key[it % key.length].code) % 256
|
||||
r = arr[it]
|
||||
arr[it] = arr[u]
|
||||
arr[u] = r
|
||||
}
|
||||
u = 0
|
||||
var c = 0
|
||||
for (f in inputTwo.indices) {
|
||||
c = (c + f) % 256
|
||||
|
||||
return text.indices.map { j ->
|
||||
c = (c + 1) % 256
|
||||
u = (u + arr[c]) % 256
|
||||
r = arr[c]
|
||||
arr[c] = arr[u]
|
||||
arr[u] = r
|
||||
output += (inputTwo[f].code xor arr[(arr[c] + arr[u]) % 256]).toChar()
|
||||
}
|
||||
return output
|
||||
(text[j].code xor arr[(arr[c] + arr[u]) % 256]).toChar()
|
||||
}.joinToString("")
|
||||
}
|
||||
|
||||
private fun ze(input: String): String {
|
||||
@Suppress("SameParameterValue")
|
||||
private fun decrypt(input: String, key: String): String {
|
||||
val t = if (input.replace("""[\t\n\f\r]""".toRegex(), "").length % 4 == 0) {
|
||||
input.replace(Regex("""/==?$/"""), "")
|
||||
input.replace("""==?$""".toRegex(), "")
|
||||
} else input
|
||||
if (t.length % 4 == 1 || t.contains(Regex("""[^+/0-9A-Za-z]"""))) throw Exception("bad input")
|
||||
if (t.length % 4 == 1 || t.contains("""[^+/0-9A-Za-z]""".toRegex())) throw Exception("bad input")
|
||||
var i: Int
|
||||
var r = ""
|
||||
var e = 0
|
||||
|
@ -166,100 +129,200 @@ class NineAnimeProvider : MainAPI() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun encode(input: String): String? = java.net.URLEncoder.encode(input, "utf-8")
|
||||
private fun encode(input: String): String =
|
||||
java.net.URLEncoder.encode(input, "utf-8").replace("+", "%20")
|
||||
|
||||
private fun decode(input: String): String? = java.net.URLDecoder.decode(input, "utf-8")
|
||||
private fun decode(input: String): String = java.net.URLDecoder.decode(input, "utf-8")
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse> {
|
||||
val url = "$mainUrl/filter?sort=title%3Aasc&keyword=$query"
|
||||
override suspend fun getMainPage(): HomePageResponse {
|
||||
val items = listOf(
|
||||
"$mainUrl/ajax/home/widget/trending?page=1" to "Trending",
|
||||
"$mainUrl/ajax/home/widget/updated-all?page=1" to "All",
|
||||
"$mainUrl/ajax/home/widget/updated-sub?page=1" to "Recently Updated (SUB)",
|
||||
"$mainUrl/ajax/home/widget/updated-dub?page=1" to
|
||||
"Recently Updated (DUB)",
|
||||
"$mainUrl/ajax/home/widget/updated-china?page=1" to
|
||||
"Recently Updated (Chinese)",
|
||||
"$mainUrl/ajax/home/widget/random?page=1" to "Random",
|
||||
).apmap { (url, name) ->
|
||||
val home = Jsoup.parse(
|
||||
app.get(
|
||||
url
|
||||
).parsed<Response>().html
|
||||
).select("div.item").mapNotNull { element ->
|
||||
val title = element.selectFirst(".info > .name") ?: return@mapNotNull null
|
||||
val link = title.attr("href")
|
||||
val poster = element.selectFirst(".poster > a > img")?.attr("src")
|
||||
val meta = element.selectFirst(".poster > a > .meta > .inner > .left")
|
||||
val subbedEpisodes = meta?.selectFirst(".sub")?.text()?.toIntOrNull()
|
||||
val dubbedEpisodes = meta?.selectFirst(".dub")?.text()?.toIntOrNull()
|
||||
|
||||
return app.get(url).document.select("ul.anime-list li").mapNotNull {
|
||||
val title = it.selectFirst("a.name")!!.text()
|
||||
val href =
|
||||
fixUrlNull(it.selectFirst("a")!!.attr("href"))?.replace(
|
||||
Regex("(\\?ep=(\\d+)\$)"),
|
||||
""
|
||||
)
|
||||
?: return@mapNotNull null
|
||||
val image = it.selectFirst("a.poster img")!!.attr("src")
|
||||
AnimeSearchResponse(
|
||||
title,
|
||||
href,
|
||||
this.name,
|
||||
TvType.Anime,
|
||||
image,
|
||||
null,
|
||||
if (title.contains("(DUB)") || title.contains("(Dub)")) EnumSet.of(
|
||||
DubStatus.Dubbed
|
||||
) else EnumSet.of(DubStatus.Subbed),
|
||||
newAnimeSearchResponse(title.text() ?: return@mapNotNull null, link) {
|
||||
this.posterUrl = poster
|
||||
addDubStatus(
|
||||
dubbedEpisodes != null,
|
||||
subbedEpisodes != null,
|
||||
dubbedEpisodes,
|
||||
subbedEpisodes
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
HomePageList(name, home)
|
||||
}
|
||||
|
||||
return HomePageResponse(items)
|
||||
}
|
||||
|
||||
data class Response(
|
||||
@JsonProperty("html") val html: String
|
||||
@JsonProperty("result") val html: String
|
||||
)
|
||||
|
||||
override suspend fun load(url: String): LoadResponse? {
|
||||
data class QuickSearchResponse(
|
||||
//@JsonProperty("status") val status: Int? = null,
|
||||
@JsonProperty("result") val result: QuickSearchResult? = null,
|
||||
//@JsonProperty("message") val message: String? = null,
|
||||
//@JsonProperty("messages") val messages: ArrayList<String> = arrayListOf()
|
||||
)
|
||||
|
||||
data class QuickSearchResult(
|
||||
@JsonProperty("html") val html: String? = null,
|
||||
//@JsonProperty("linkMore") val linkMore: String? = null
|
||||
)
|
||||
|
||||
override suspend fun quickSearch(query: String): List<SearchResponse>? {
|
||||
val vrf = encodeVrf(query)
|
||||
val url =
|
||||
"$mainUrl/ajax/anime/search?keyword=$query&vrf=$vrf"
|
||||
val response = app.get(url).parsedSafe<QuickSearchResponse>()
|
||||
val document = Jsoup.parse(response?.result?.html ?: return null)
|
||||
return document.select(".items > a").mapNotNull { element ->
|
||||
val link = fixUrl(element?.attr("href") ?: return@mapNotNull null)
|
||||
val title = element.selectFirst(".info > .name")?.text() ?: return@mapNotNull null
|
||||
newAnimeSearchResponse(title, link) {
|
||||
posterUrl = element.selectFirst(".poster > span > img")?.attr("src")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<SearchResponse>? {
|
||||
val vrf = encodeVrf(query)
|
||||
//?language%5B%5D=${if (selectDub) "dubbed" else "subbed"}&
|
||||
val url =
|
||||
"$mainUrl/filter?keyword=${encode(query)}&vrf=${vrf}&page=1"
|
||||
return app.get(url).document.select("#list-items div.ani.poster.tip > a").mapNotNull {
|
||||
val link = fixUrl(it.attr("href") ?: return@mapNotNull null)
|
||||
val img = it.select("img")
|
||||
val title = img.attr("alt")
|
||||
newAnimeSearchResponse(title, link) {
|
||||
posterUrl = img.attr("src")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun load(url: String): LoadResponse {
|
||||
val validUrl = url.replace("https://9anime.to", mainUrl)
|
||||
val doc = app.get(validUrl).document
|
||||
val animeid =
|
||||
doc.selectFirst("div.player-wrapper.watchpage")!!.attr("data-id") ?: return null
|
||||
val animeidencoded = encode(getVrf(animeid) ?: return null)
|
||||
val poster = doc.selectFirst("aside.main div.thumb div img")!!.attr("src")
|
||||
val title = doc.selectFirst(".info .title")!!.text()
|
||||
val description = doc.selectFirst("div.info p")!!.text().replace("Ver menos", "").trim()
|
||||
val episodes = Jsoup.parse(
|
||||
app.get(
|
||||
"$mainUrl/ajax/anime/servers?ep=1&id=${animeid}&vrf=$animeidencoded&ep=8&episode=&token="
|
||||
).parsed<Response>().html
|
||||
).select("ul.episodes li a").mapNotNull {
|
||||
val link = it?.attr("href") ?: return@mapNotNull null
|
||||
val name = "Episode ${it.text()}"
|
||||
Episode(link, name)
|
||||
}
|
||||
|
||||
val recommendations =
|
||||
doc.select("div.container aside.main section div.body ul.anime-list li")
|
||||
.mapNotNull { element ->
|
||||
val recTitle = element.select("a.name").text() ?: return@mapNotNull null
|
||||
val image = element.select("a.poster img").attr("src")
|
||||
val recUrl = fixUrl(element.select("a").attr("href"))
|
||||
newAnimeSearchResponse(recTitle, recUrl) {
|
||||
this.posterUrl = image
|
||||
addDubStatus(getDubStatus(recTitle))
|
||||
val meta = doc.selectFirst("#w-info") ?: throw ErrorLoadingException("Could not find info")
|
||||
val ratingElement = meta.selectFirst(".brating > #w-rating")
|
||||
val id = ratingElement?.attr("data-id") ?: throw ErrorLoadingException("Could not find id")
|
||||
val binfo =
|
||||
meta.selectFirst(".binfo") ?: throw ErrorLoadingException("Could not find binfo")
|
||||
val info = binfo.selectFirst(".info") ?: throw ErrorLoadingException("Could not find info")
|
||||
|
||||
val title = (info.selectFirst(".title") ?: info.selectFirst(".d-title"))?.text()
|
||||
?: throw ErrorLoadingException("Could not find title")
|
||||
|
||||
val body =
|
||||
app.get("$mainUrl/ajax/episode/list/$id?vrf=${encodeVrf(id)}").parsed<Response>().html
|
||||
|
||||
val subEpisodes = ArrayList<Episode>()
|
||||
val dubEpisodes = ArrayList<Episode>()
|
||||
|
||||
//TODO RECOMMENDATIONS
|
||||
|
||||
Jsoup.parse(body).body().select(".episodes > ul > li > a").mapNotNull { element ->
|
||||
val ids = element.attr("data-ids").split(",", limit = 2)
|
||||
|
||||
val epNum = element.attr("data-num")
|
||||
.toIntOrNull() // might fuck up on 7.5 ect might use data-slug instead
|
||||
val epTitle = element.selectFirst("span.d-title")?.text()
|
||||
//val filler = element.hasClass("filler")
|
||||
ids.getOrNull(1)?.let { dub ->
|
||||
dubEpisodes.add(
|
||||
Episode(
|
||||
"$mainUrl/ajax/server/list/$dub?vrf=${encodeVrf(dub)}",
|
||||
epTitle,
|
||||
episode = epNum
|
||||
)
|
||||
)
|
||||
}
|
||||
ids.getOrNull(0)?.let { sub ->
|
||||
subEpisodes.add(
|
||||
Episode(
|
||||
"$mainUrl/ajax/server/list/$sub?vrf=${encodeVrf(sub)}",
|
||||
epTitle,
|
||||
episode = epNum
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val infodoc = doc.selectFirst("div.info .meta .col1")!!.text()
|
||||
val tvType = if (infodoc.contains("Movie")) TvType.AnimeMovie else TvType.Anime
|
||||
val status =
|
||||
if (infodoc.contains("Completed")) ShowStatus.Completed
|
||||
else if (infodoc.contains("Airing")) ShowStatus.Ongoing
|
||||
else null
|
||||
val tags = doc.select("div.info .meta .col1 div:contains(Genre) a").map { it.text() }
|
||||
return newAnimeLoadResponse(title, url, TvType.Anime) {
|
||||
addEpisodes(DubStatus.Dubbed, dubEpisodes)
|
||||
addEpisodes(DubStatus.Subbed, subEpisodes)
|
||||
|
||||
return newAnimeLoadResponse(title, validUrl, tvType) {
|
||||
this.posterUrl = poster
|
||||
this.plot = description
|
||||
this.recommendations = recommendations
|
||||
this.showStatus = status
|
||||
this.tags = tags
|
||||
addEpisodes(DubStatus.Subbed, episodes)
|
||||
plot = info.selectFirst(".synopsis > .shorting > .content")?.text()
|
||||
posterUrl = binfo.selectFirst(".poster > span > img")?.attr("src")
|
||||
rating = ratingElement.attr("data-score").toFloat().times(1000f).toInt()
|
||||
|
||||
info.select(".bmeta > .meta > div").forEach { element ->
|
||||
when (element.ownText()) {
|
||||
"Genre: " -> {
|
||||
tags = element.select("span > a").mapNotNull { it?.text() }
|
||||
}
|
||||
"Duration: " -> {
|
||||
duration = getDurationFromString(element.selectFirst("span")?.text())
|
||||
}
|
||||
"Type: " -> {
|
||||
type = when (element.selectFirst("span > a")?.text()) {
|
||||
"ONA" -> TvType.OVA
|
||||
else -> {
|
||||
type
|
||||
}
|
||||
}
|
||||
}
|
||||
"Status: " -> {
|
||||
showStatus = when (element.selectFirst("span")?.text()) {
|
||||
"Releasing" -> ShowStatus.Ongoing
|
||||
"Completed" -> ShowStatus.Completed
|
||||
else -> {
|
||||
showStatus
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class Result(
|
||||
@JsonProperty("url")
|
||||
val url: String? = null
|
||||
)
|
||||
|
||||
data class Links(
|
||||
@JsonProperty("url") val url: String
|
||||
@JsonProperty("result")
|
||||
val result: Result? = null
|
||||
)
|
||||
|
||||
data class Servers(
|
||||
@JsonProperty("28") val mcloud: String?,
|
||||
@JsonProperty("35") val mp4upload: String?,
|
||||
@JsonProperty("40") val streamtape: String?,
|
||||
@JsonProperty("41") val vidstream: String?,
|
||||
@JsonProperty("43") val videovard: String?
|
||||
)
|
||||
//TODO 9anime outro into {"status":200,"result":{"url":"","skip_data":{"intro_begin":67,"intro_end":154,"outro_begin":1337,"outro_end":1415,"count":3}},"message":"","messages":[]}
|
||||
private suspend fun getEpisodeLinks(id: String): Links? {
|
||||
return app.get("$mainUrl/ajax/server/$id?vrf=${encodeVrf(id)}").parsedSafe()
|
||||
}
|
||||
|
||||
override suspend fun loadLinks(
|
||||
data: String,
|
||||
|
@ -267,44 +330,29 @@ class NineAnimeProvider : MainAPI() {
|
|||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
): Boolean {
|
||||
val document = app.get(data).document
|
||||
val animeid =
|
||||
document.selectFirst("div.player-wrapper.watchpage")!!.attr("data-id") ?: return false
|
||||
val animeidencoded = encode(getVrf(animeid) ?: return false)
|
||||
val body = app.get(data).parsed<Response>().html
|
||||
val document = Jsoup.parse(body)
|
||||
|
||||
Jsoup.parse(
|
||||
app.get(
|
||||
"$mainUrl/ajax/anime/servers?&id=${animeid}&vrf=$animeidencoded&episode=&token="
|
||||
).parsed<Response>().html
|
||||
).select("div.body").map { element ->
|
||||
val jsonregex = Regex("(\\{.+\\}.*$data)")
|
||||
val servers = jsonregex.find(element.toString())?.value?.replace(
|
||||
Regex("(\".*data-base=.*href=\"$data)"),
|
||||
""
|
||||
)?.replace(""", "\"") ?: return@map
|
||||
|
||||
val jsonservers = parseJson<Servers?>(servers) ?: return@map
|
||||
listOfNotNull(
|
||||
jsonservers.vidstream,
|
||||
jsonservers.mcloud,
|
||||
jsonservers.mp4upload,
|
||||
jsonservers.streamtape,
|
||||
jsonservers.videovard
|
||||
).mapNotNull {
|
||||
document.select("li").apmap {
|
||||
try {
|
||||
val epserver = app.get("$mainUrl/ajax/anime/episode?id=$it").text
|
||||
(if (epserver.contains("url")) {
|
||||
parseJson<Links>(epserver)
|
||||
} else null)?.url?.let { it1 -> getLink(it1.replace("=", "")) }
|
||||
?.replace("/embed/", "/e/")
|
||||
val name = it.text()
|
||||
val encodedStreamUrl =
|
||||
getEpisodeLinks(it.attr("data-link-id"))?.result?.url ?: return@apmap
|
||||
val url = decodeVrf(encodedStreamUrl)
|
||||
if (!loadExtractor(url, callback = callback, referer = mainUrl)) {
|
||||
callback(
|
||||
ExtractorLink(
|
||||
this.name,
|
||||
name,
|
||||
url,
|
||||
mainUrl,
|
||||
Qualities.Unknown.value,
|
||||
url.contains(".m3u8")
|
||||
)
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logError(e)
|
||||
null
|
||||
}
|
||||
}.apmap { url ->
|
||||
loadExtractor(
|
||||
url, data, callback
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -228,12 +228,13 @@ abstract class AbstractPlayerFragment(
|
|||
|
||||
open fun playerError(exception: Exception) {
|
||||
fun showToast(message: String, gotoNext: Boolean = false) {
|
||||
if (!gotoNext || hasNextMirror()) {
|
||||
if (gotoNext && hasNextMirror()) {
|
||||
showToast(
|
||||
activity,
|
||||
message,
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
nextMirror()
|
||||
} else {
|
||||
showToast(
|
||||
activity,
|
||||
|
|
|
@ -214,7 +214,6 @@ class QuickSearchFragment : Fragment() {
|
|||
when (it) {
|
||||
is Resource.Success -> {
|
||||
it.value.let { data ->
|
||||
println("DATA: $data")
|
||||
(quick_search_autofit_results?.adapter as? SearchAdapter?)?.updateList(
|
||||
data
|
||||
)
|
||||
|
|
|
@ -169,7 +169,6 @@ suspend fun loadExtractor(
|
|||
for (extractor in extractorApis) {
|
||||
if (url.startsWith(extractor.mainUrl)) {
|
||||
return extractor.getSafeUrl(url, referer) ?: emptyList()
|
||||
|
||||
}
|
||||
}
|
||||
return emptyList()
|
||||
|
|
Loading…
Reference in a new issue