mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
fix Nimegami
This commit is contained in:
parent
ee89e90282
commit
f79dc0209d
3 changed files with 31 additions and 24 deletions
|
@ -51,3 +51,32 @@ open class Mitedrive : ExtractorApi() {
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open class Berkasdrive : ExtractorApi() {
|
||||||
|
override val name = "Berkasdrive"
|
||||||
|
override val mainUrl = "https://dl.berkasdrive.com"
|
||||||
|
override val requiresReferer = true
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val res = app.get(url, referer = referer).document
|
||||||
|
val video = res.select("video#player source").attr("src")
|
||||||
|
|
||||||
|
callback.invoke(
|
||||||
|
ExtractorLink(
|
||||||
|
this.name,
|
||||||
|
this.name,
|
||||||
|
video,
|
||||||
|
"$mainUrl/",
|
||||||
|
Qualities.Unknown.value,
|
||||||
|
INFER_TYPE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,7 +9,6 @@ import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import org.jsoup.select.Elements
|
import org.jsoup.select.Elements
|
||||||
import java.net.URI
|
|
||||||
|
|
||||||
class Nimegami : MainAPI() {
|
class Nimegami : MainAPI() {
|
||||||
override var mainUrl = "https://nimegami.id"
|
override var mainUrl = "https://nimegami.id"
|
||||||
|
@ -150,7 +149,7 @@ class Nimegami : MainAPI() {
|
||||||
tryParseJson<ArrayList<Sources>>(base64Decode(data))?.map { sources ->
|
tryParseJson<ArrayList<Sources>>(base64Decode(data))?.map { sources ->
|
||||||
sources.url?.apmap { url ->
|
sources.url?.apmap { url ->
|
||||||
loadFixedExtractor(
|
loadFixedExtractor(
|
||||||
url.fixIframe(),
|
url,
|
||||||
sources.format,
|
sources.format,
|
||||||
"$mainUrl/",
|
"$mainUrl/",
|
||||||
subtitleCallback,
|
subtitleCallback,
|
||||||
|
@ -185,32 +184,10 @@ class Nimegami : MainAPI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getBaseUrl(url: String): String {
|
|
||||||
return URI(url).let {
|
|
||||||
"${it.scheme}://${it.host}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Elements.getContent(css: String): Elements {
|
private fun Elements.getContent(css: String): Elements {
|
||||||
return this.select("tr:contains($css) td:last-child")
|
return this.select("tr:contains($css) td:last-child")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String.fixIframe(): String {
|
|
||||||
val url = base64Decode(this.substringAfter("url=").substringAfter("id="))
|
|
||||||
return when {
|
|
||||||
url.contains("hxfile") -> {
|
|
||||||
val host = getBaseUrl(url)
|
|
||||||
val id = url.substringAfterLast("/")
|
|
||||||
"$host/embed-$id.html"
|
|
||||||
}
|
|
||||||
url.startsWith("https://mitedrive.my.id") -> url.replace(
|
|
||||||
"https://mitedrive.my.id",
|
|
||||||
"https://mitedrive.com"
|
|
||||||
)
|
|
||||||
else -> fixUrl(url)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class Sources(
|
data class Sources(
|
||||||
@JsonProperty("format") val format: String? = null,
|
@JsonProperty("format") val format: String? = null,
|
||||||
@JsonProperty("url") val url: ArrayList<String>? = arrayListOf(),
|
@JsonProperty("url") val url: ArrayList<String>? = arrayListOf(),
|
||||||
|
|
|
@ -11,5 +11,6 @@ class NimegamiPlugin: Plugin() {
|
||||||
// All providers should be added in this manner. Please don't edit the providers list directly.
|
// All providers should be added in this manner. Please don't edit the providers list directly.
|
||||||
registerMainAPI(Nimegami())
|
registerMainAPI(Nimegami())
|
||||||
registerExtractorAPI(Mitedrive())
|
registerExtractorAPI(Mitedrive())
|
||||||
|
registerExtractorAPI(Berkasdrive())
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue