mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
added new sources in LayarKaca
This commit is contained in:
parent
1a80c14c94
commit
563c4f633d
3 changed files with 44 additions and 4 deletions
33
LayarKacaProvider/src/main/kotlin/com/hexated/Filemoon.kt
Normal file
33
LayarKacaProvider/src/main/kotlin/com/hexated/Filemoon.kt
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
package com.hexated
|
||||||
|
|
||||||
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
|
import com.lagradost.cloudstream3.app
|
||||||
|
import com.lagradost.cloudstream3.utils.*
|
||||||
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
|
open class Filemoon : ExtractorApi() {
|
||||||
|
override val name = "Filemoon"
|
||||||
|
override val mainUrl = "https://filemoon.sx"
|
||||||
|
override val requiresReferer = true
|
||||||
|
|
||||||
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val doc = app.get(url).document
|
||||||
|
val link = unpackJs(doc)?.substringAfter("file:\"")?.substringBefore("\"")
|
||||||
|
M3u8Helper.generateM3u8(
|
||||||
|
name,
|
||||||
|
link ?: return,
|
||||||
|
"$mainUrl/",
|
||||||
|
).forEach(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun unpackJs(script: Element): String? {
|
||||||
|
return script.select("script").find { it.data().contains("eval(function(p,a,c,k,e,d)") }
|
||||||
|
?.data()?.let { getAndUnpack(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import java.net.URLDecoder
|
||||||
|
|
||||||
class LayarKacaProvider : MainAPI() {
|
class LayarKacaProvider : MainAPI() {
|
||||||
override var mainUrl = "https://lk21official.vip"
|
override var mainUrl = "https://lk21official.vip"
|
||||||
|
@ -196,16 +197,21 @@ class LayarKacaProvider : MainAPI() {
|
||||||
document.select("ul#loadProviders > li").map {
|
document.select("ul#loadProviders > li").map {
|
||||||
fixUrl(it.select("a").attr("href"))
|
fixUrl(it.select("a").attr("href"))
|
||||||
}.apmap {
|
}.apmap {
|
||||||
val link = if (it.startsWith("https://layarkacaxxi.icu")) {
|
val link = when {
|
||||||
|
it.startsWith("https://layarkacaxxi.icu") -> {
|
||||||
it.substringBeforeLast("/")
|
it.substringBeforeLast("/")
|
||||||
} else {
|
}
|
||||||
|
it.startsWith("https://bananalicious.xyz") -> decode(it.substringAfter("url="))
|
||||||
|
else -> {
|
||||||
it
|
it
|
||||||
}
|
}
|
||||||
|
}
|
||||||
loadExtractor(link, data, subtitleCallback, callback)
|
loadExtractor(link, data, subtitleCallback, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun decode(input: String): String = URLDecoder.decode(input, "utf-8").replace(" ", "%20")
|
||||||
|
|
||||||
}
|
}
|
|
@ -10,5 +10,6 @@ class LayarKacaProviderPlugin: Plugin() {
|
||||||
override fun load(context: Context) {
|
override fun load(context: Context) {
|
||||||
// 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(LayarKacaProvider())
|
registerMainAPI(LayarKacaProvider())
|
||||||
|
registerExtractorAPI(Filemoon())
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue