f up kuramanime

This commit is contained in:
jack 2023-12-01 05:19:52 +07:00
parent e644456bc6
commit 3d6520cdef
4 changed files with 141 additions and 25 deletions

View File

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

View File

@ -1,7 +1,14 @@
package com.hexated package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.extractors.Filesim import com.lagradost.cloudstream3.extractors.Filesim
import com.lagradost.cloudstream3.extractors.StreamSB import com.lagradost.cloudstream3.extractors.StreamSB
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.getQualityFromName
class Nyomo : StreamSB() { class Nyomo : StreamSB() {
override var name: String = "Nyomo" override var name: String = "Nyomo"
@ -11,4 +18,101 @@ class Nyomo : StreamSB() {
class Streamhide : Filesim() { class Streamhide : Filesim() {
override var name: String = "Streamhide" override var name: String = "Streamhide"
override var mainUrl: String = "https://streamhide.to" override var mainUrl: String = "https://streamhide.to"
}
open class Lbx : ExtractorApi() {
override val name = "Linkbox"
override val mainUrl = "https://lbx.to"
private val realUrl = "https://www.linkbox.to"
override val requiresReferer = true
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val token = Regex("""(?:/f/|/file/|\?id=)(\w+)""").find(url)?.groupValues?.get(1)
val id = app.get("$realUrl/api/file/share_out_list/?sortField=utime&sortAsc=0&pageNo=1&pageSize=50&shareToken=$token").parsedSafe<Responses>()?.data?.itemId
app.get("$realUrl/api/file/detail?itemId=$id", referer = url)
.parsedSafe<Responses>()?.data?.itemInfo?.resolutionList?.map { link ->
callback.invoke(
ExtractorLink(
name,
name,
link.url ?: return@map null,
"$realUrl/",
getQualityFromName(link.resolution)
)
)
}
}
data class Resolutions(
@JsonProperty("url") val url: String? = null,
@JsonProperty("resolution") val resolution: String? = null,
)
data class ItemInfo(
@JsonProperty("resolutionList") val resolutionList: ArrayList<Resolutions>? = arrayListOf(),
)
data class Data(
@JsonProperty("itemInfo") val itemInfo: ItemInfo? = null,
@JsonProperty("itemId") val itemId: String? = null,
)
data class Responses(
@JsonProperty("data") val data: Data? = null,
)
}
open class Kuramadrive : ExtractorApi() {
override val name = "DriveKurama"
override val mainUrl = "https://kuramadrive.com"
override val requiresReferer = true
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val req = app.get(url, referer = referer)
val doc = req.document
val title = doc.select("title").text()
val token = doc.select("meta[name=csrf-token]").attr("content")
val routeCheckAvl = doc.select("input#routeCheckAvl").attr("value")
val json = app.post(
routeCheckAvl, headers = mapOf(
"X-Requested-With" to "XMLHttpRequest",
"X-CSRF-TOKEN" to token
),
referer = url,
cookies = req.cookies
).parsedSafe<Source>()
callback.invoke(
ExtractorLink(
name,
name,
json?.url ?: return,
"$mainUrl/",
getIndexQuality(title),
)
)
}
private fun getIndexQuality(str: String?): Int {
return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull()
?: Qualities.Unknown.value
}
private data class Source(
@JsonProperty("url") val url: String,
)
} }

View File

@ -200,32 +200,42 @@ class KuramanimeProvider : MainAPI() {
val req = app.get(data) val req = app.get(data)
val res = req.document val res = req.document
val token = res.select("meta[name=csrf-token]").attr("content")
val auth = getAuth(data) argamap(
headers = mapOf( {
"Accept" to "application/json, text/javascript, */*; q=0.01", val token = res.select("meta[name=csrf-token]").attr("content")
"Authorization" to "${auth.authHeader}", val auth = getAuth(data)
"X-Requested-With" to "XMLHttpRequest", headers = mapOf(
"X-CSRF-TOKEN" to token "Accept" to "application/json, text/javascript, */*; q=0.01",
) "Authorization" to "${auth.authHeader}",
cookies = req.cookies "X-Requested-With" to "XMLHttpRequest",
res.select("select#changeServer option").apmap { source -> "X-CSRF-TOKEN" to token
val server = source.attr("value") )
val query = auth.serverUrl?.queryParameterNames cookies = req.cookies
val link = "$data?${query?.first()}=${getMisc(auth.authUrl)}&${query?.last()}=$server" res.select("select#changeServer option").apmap { source ->
if (server.contains(Regex("(?i)kuramadrive|archive"))) { val server = source.attr("value")
invokeLocalSource(link, server, data, callback) val query = auth.serverUrl?.queryParameterNames
} else { val link = "$data?${query?.first()}=${getMisc(auth.authUrl)}&${query?.last()}=$server"
app.get( if (server.contains(Regex("(?i)kuramadrive|archive"))) {
link, invokeLocalSource(link, server, data, callback)
referer = data, } else {
headers = headers, app.get(
cookies = cookies link,
).document.select("div.iframe-container iframe").attr("src").let { videoUrl -> referer = data,
loadExtractor(fixUrl(videoUrl), "$mainUrl/", subtitleCallback, callback) headers = headers,
cookies = cookies
).document.select("div.iframe-container iframe").attr("src").let { videoUrl ->
loadExtractor(fixUrl(videoUrl), "$mainUrl/", subtitleCallback, callback)
}
}
}
},
{
res.select("div#animeDownloadLink a").apmap {
loadExtractor(it.attr("href"), "$mainUrl/", subtitleCallback, callback)
} }
} }
} )
return true return true
} }

View File

@ -12,5 +12,7 @@ class KuramanimeProviderPlugin: Plugin() {
registerMainAPI(KuramanimeProvider()) registerMainAPI(KuramanimeProvider())
registerExtractorAPI(Nyomo()) registerExtractorAPI(Nyomo())
registerExtractorAPI(Streamhide()) registerExtractorAPI(Streamhide())
registerExtractorAPI(Kuramadrive())
registerExtractorAPI(Lbx())
} }
} }