mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
AnimeIndo: added new source
This commit is contained in:
parent
b980ed0678
commit
07f3a57857
5 changed files with 94 additions and 54 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 8
|
||||
version = 9
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
}
|
|
@ -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(),
|
||||
)
|
||||
|
||||
}
|
Loading…
Reference in a new issue