AnimeIndo: added new source

This commit is contained in:
hexated 2023-02-27 16:49:35 +07:00
parent b980ed0678
commit 07f3a57857
5 changed files with 94 additions and 54 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 8
version = 9
cloudstream {

View File

@ -0,0 +1,91 @@
package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.*
open class Vicloud : ExtractorApi() {
override val name: String = "Vicloud"
override val mainUrl: String = "https://vicloud.sbs"
override val requiresReferer = false
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val id = Regex("\"apiQuery\":\"(.*?)\"").find(app.get(url).text)?.groupValues?.getOrNull(1)
app.get(
"$mainUrl/api/?$id=&_=${System.currentTimeMillis()}",
headers = mapOf(
"X-Requested-With" to "XMLHttpRequest"
),
referer = url
).parsedSafe<Responses>()?.sources?.map { source ->
callback.invoke(
ExtractorLink(
name,
name,
source.file ?: return@map null,
url,
getQualityFromName(source.label),
)
)
}
}
private data class Sources(
@JsonProperty("file") val file: String? = null,
@JsonProperty("label") val label: String? = null,
)
private data class Responses(
@JsonProperty("sources") val sources: List<Sources>? = arrayListOf(),
)
}
open class Uservideo : ExtractorApi() {
override val name: String = "Uservideo"
override val mainUrl: String = "https://uservideo.xyz"
override val requiresReferer = false
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val script = app.get(url).document.selectFirst("script:containsData(hosts =)")?.data()
val host = script?.substringAfter("hosts = [\"")?.substringBefore("\"];")
val servers = script?.substringAfter("servers = \"")?.substringBefore("\";")
val sources = app.get("$host/s/$servers").text.substringAfter("\"sources\":[").substringBefore("],").let {
AppUtils.tryParseJson<List<Sources>>("[$it]")
}
val quality = Regex("(\\d{3,4})[Pp]").find(url)?.groupValues?.getOrNull(1)?.toIntOrNull()
sources?.map { source ->
callback.invoke(
ExtractorLink(
name,
name,
source.src ?: return@map null,
url,
quality ?: Qualities.Unknown.value,
)
)
}
}
data class Sources(
@JsonProperty("src") val src: String? = null,
@JsonProperty("type") val type: String? = null,
@JsonProperty("label") val label: String? = null,
)
}

View File

@ -12,7 +12,6 @@ import com.lagradost.cloudstream3.utils.loadExtractor
import com.lagradost.nicehttp.NiceResponse
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
class AnimeIndoProvider : MainAPI() {
override var mainUrl = "https://animeindo.cfd"
override var name = "AnimeIndo"
@ -184,7 +183,7 @@ class AnimeIndoProvider : MainAPI() {
document.select("div.itemleft > .mirror > option").mapNotNull {
fixUrl(Jsoup.parse(base64Decode(it.attr("value"))).select("iframe").attr("src"))
}.apmap {
if (it.startsWith("https://uservideo.xyz") || it.startsWith(mainUrl)) {
if (it.startsWith(mainUrl)) {
app.get(it, referer = "$mainUrl/").document.select("iframe").attr("src")
} else {
it

View File

@ -11,5 +11,6 @@ class AnimeIndoProviderPlugin: Plugin() {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(AnimeIndoProvider())
registerExtractorAPI(Vicloud())
registerExtractorAPI(Uservideo())
}
}

View File

@ -1,51 +0,0 @@
package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.getQualityFromName
open class Vicloud : ExtractorApi() {
override val name: String = "Vicloud"
override val mainUrl: String = "https://vicloud.sbs"
override val requiresReferer = false
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val id = Regex("\"apiQuery\":\"(.*?)\"").find(app.get(url).text)?.groupValues?.getOrNull(1)
app.get(
"$mainUrl/api/?$id=&_=${System.currentTimeMillis()}",
headers = mapOf(
"X-Requested-With" to "XMLHttpRequest"
),
referer = url
).parsedSafe<Responses>()?.sources?.map { source ->
callback.invoke(
ExtractorLink(
name,
name,
source.file ?: return@map null,
url,
getQualityFromName(source.label),
)
)
}
}
private data class Sources(
@JsonProperty("file") val file: String? = null,
@JsonProperty("label") val label: String? = null,
)
private data class Responses(
@JsonProperty("sources") val sources: List<Sources>? = arrayListOf(),
)
}