fixed sources in Animeindo & Kuronime

This commit is contained in:
hexated 2023-02-26 15:51:34 +07:00
parent c48e778d1e
commit 12f0f4147e
5 changed files with 55 additions and 3 deletions

View file

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

View file

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

View file

@ -0,0 +1,51 @@
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(),
)
}

View file

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

View file

@ -194,7 +194,7 @@ class KuronimeProvider : MainAPI() {
safeApiCall {
when {
it.startsWith("https://animeku.org") -> invokeKuroSource(it, callback)
else -> loadExtractor("$it/", mainUrl, subtitleCallback, callback)
else -> loadExtractor(it, mainUrl, subtitleCallback, callback)
}
}
}