mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fixed sources in Animeindo & Kuronime
This commit is contained in:
parent
c48e778d1e
commit
12f0f4147e
5 changed files with 55 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 7
|
||||
version = 8
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
}
|
51
AnimeIndoProvider/src/main/kotlin/com/hexated/Vicloud.kt
Normal file
51
AnimeIndoProvider/src/main/kotlin/com/hexated/Vicloud.kt
Normal 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(),
|
||||
)
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue