sora: fixed few sources

This commit is contained in:
jack 2023-11-27 10:33:23 +07:00
parent fabb6c3217
commit 81b044fcbf
8 changed files with 50 additions and 37 deletions

View File

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

View File

@ -199,7 +199,7 @@ class KuramanimeProvider : MainAPI() {
val token = res.select("meta[name=csrf-token]").attr("content")
headers = mapOf(
"Accept" to "application/json, text/javascript, */*; q=0.01",
"Authorization" to "Bearer YTNWeVlXMWhibWx0WlRwaVMwNUNTWFk1U1d4NVFsbDBObE5KWW10a1JWVXpkWFIzTTA5c05rcFJPSFJ6T2pFM01EQTFOemN5TnpBd01EQT0%3D",
"Authorization" to "Bearer ${getAuth()}",
"X-Requested-With" to "XMLHttpRequest",
"X-CSRF-TOKEN" to token
)
@ -224,6 +224,11 @@ class KuramanimeProvider : MainAPI() {
return true
}
private fun getAuth() : String {
val key = "kuramanime2:LEcXGYdOGcMCV8jM5fhRdM2mneSj6kaNts:${APIHolder.unixTimeMS};"
return base64Encode(base64Encode(key.toByteArray()).toByteArray())
}
private suspend fun getMisc(): String {
val misc = app.get(
"$mainUrl/misc/post/EVhcpMNbO77acNZcHr2XVjaG8WAdNC1u",

View File

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties
// use an integer for version numbers
version = 196
version = 197
android {
defaultConfig {

View File

@ -686,13 +686,19 @@ object SoraExtractor : SoraStream() {
"$vidsrctoAPI/embed/tv/$imdbId/$season/$episode"
}
val id = app.get(url).document.selectFirst("ul.episodes li a")?.attr("data-id") ?: return
val mediaId = app.get(url).document.selectFirst("ul.episodes li a")?.attr("data-id") ?: return
val subtitles = app.get("$vidsrctoAPI/ajax/embed/episode/$id/subtitles").text
tryParseJson<List<FmoviesSubtitles>>(subtitles)?.map {
app.get("$vidsrctoAPI/ajax/embed/episode/$mediaId/sources").parsedSafe<VidsrctoSources>()?.result?.apmap {
val encUrl = app.get("$vidsrctoAPI/ajax/embed/source/${it.id}").parsedSafe<VidsrctoResponse>()?.result?.url
loadExtractor(vidsrctoDecrypt(encUrl ?: return@apmap), "$vidsrctoAPI/", subtitleCallback, callback)
}
val subtitles = app.get("$vidsrctoAPI/ajax/embed/episode/$mediaId/subtitles").text
tryParseJson<List<VidsrctoSubtitles>>(subtitles)?.map {
subtitleCallback.invoke(
SubtitleFile(
it.label ?: "", it.file ?: return@map
it.label ?: "",
it.file ?: return@map
)
)
}
@ -1497,18 +1503,19 @@ object SoraExtractor : SoraStream() {
val mediaLink =
app.get(matchMedia?.first ?: return).document.selectFirst("a#jake1")?.attr("href")
val detailDoc = app.get(mediaLink ?: return).document
val media = detailDoc.selectFirst("div.entry-content pre span")?.text()?.split("|")
val media = detailDoc.selectFirst("div.entry-content pre span")?.text()
?.split("|")
?.map { it.trim() }
val iframe = (if (season == null) {
media?.mapIndexed { index, name ->
detailDoc.select("div.entry-content > pre")[index.plus(1)].selectFirst("a")
detailDoc.select("div.entry-content > h2")[index].selectFirst("a")
?.attr("href") to name
}
} else {
media?.mapIndexed { index, name ->
val linkMedia =
detailDoc.select("div.entry-content > pre")[index.plus(1)].selectFirst("a")
detailDoc.select("div.entry-content > h2")[index].selectFirst("a")
?.attr("href")
app.get(
linkMedia ?: return@mapIndexed null
@ -1518,25 +1525,19 @@ object SoraExtractor : SoraStream() {
})?.filter { it?.first?.startsWith("http") == true }
iframe?.apmap {
val token = app.get(
it?.first ?: return@apmap null
).document.select("input[name=_csrf_token_645a83a41868941e4692aa31e7235f2]")
.attr("value")
val shortLink = app.post(
it.first ?: return@apmap null,
data = mapOf("_csrf_token_645a83a41868941e4692aa31e7235f2" to token)
).document.selectFirst("a[rel=nofollow]")?.attr("href")
val iframeDoc = app.get(it?.first ?: return@apmap).document
val formUrl = iframeDoc.select("form").attr("action")
val formData = iframeDoc.select("form button").associate { v -> v.attr("name") to v.attr("value") }
// val videoUrl = extractRebrandly(shortLink ?: return@apmapIndexed null )
val quality =
Regex("(\\d{3,4})p").find(it.second)?.groupValues?.getOrNull(1)?.toIntOrNull()
val videoUrl = app.post(formUrl, data = formData, referer = it.first).document.selectFirst("div.d-flex.justify-content-center.flex-wrap a")?.attr("href")
val quality = Regex("(\\d{3,4})p").find(it.second)?.groupValues?.getOrNull(1)?.toIntOrNull()
val qualityName = it.second.replace("${quality}p", "").trim()
callback.invoke(
ExtractorLink(
"$api",
"$api $qualityName",
shortLink ?: return@apmap null,
videoUrl ?: return@apmap,
"",
quality ?: Qualities.Unknown.value
)

View File

@ -162,7 +162,21 @@ data class WatchOnlineResponse(
@JsonProperty("subtitles") val subtitles: ArrayList<WatchOnlineSubtitles>? = arrayListOf(),
)
data class FmoviesSubtitles(
data class VidsrctoResult(
@JsonProperty("id") val id: String? = null,
@JsonProperty("title") val title: String? = null,
@JsonProperty("url") val url: String? = null,
)
data class VidsrctoResponse(
@JsonProperty("result") val result: VidsrctoResult? = null,
)
data class VidsrctoSources(
@JsonProperty("result") val result: ArrayList<VidsrctoResult>? = arrayListOf(),
)
data class VidsrctoSubtitles(
@JsonProperty("label") val label: String? = null,
@JsonProperty("file") val file: String? = null,
)

View File

@ -33,7 +33,6 @@ import com.hexated.SoraExtractor.invokeRidomovies
import com.hexated.SoraExtractor.invokeSmashyStream
import com.hexated.SoraExtractor.invokeDumpStream
import com.hexated.SoraExtractor.invokeEmovies
import com.hexated.SoraExtractor.invokeGomovies
import com.hexated.SoraExtractor.invokeHdmovies4u
import com.hexated.SoraExtractor.invokeMoment
import com.hexated.SoraExtractor.invokeMultimovies
@ -682,9 +681,6 @@ open class SoraStream : TmdbProvider() {
callback
)
},
{
if (!res.isAnime) invokeGomovies(res.title, res.year, res.season, res.episode, callback)
},
{
if (!res.isAnime) invokeShowflix(
res.title,

View File

@ -22,7 +22,6 @@ import com.hexated.SoraExtractor.invokeRidomovies
import com.hexated.SoraExtractor.invokeSmashyStream
import com.hexated.SoraExtractor.invokeDumpStream
import com.hexated.SoraExtractor.invokeEmovies
import com.hexated.SoraExtractor.invokeGomovies
import com.hexated.SoraExtractor.invokeMoment
import com.hexated.SoraExtractor.invokeMultimovies
import com.hexated.SoraExtractor.invokeNetmovies
@ -245,15 +244,6 @@ class SoraStreamLite : SoraStream() {
callback
)
},
{
if (!res.isAnime) invokeGomovies(
res.title,
res.year,
res.season,
res.episode,
callback
)
},
{
invokeMoment(res.imdbId, res.season, res.episode, callback)
},

View File

@ -1145,6 +1145,13 @@ fun String.decodePrimewireXor(key: String): String {
return sb.toString()
}
fun vidsrctoDecrypt(text: String): String {
val parse = Base64.decode(text.toByteArray(), Base64.URL_SAFE)
val cipher = Cipher.getInstance("RC4")
cipher.init(Cipher.DECRYPT_MODE, SecretKeySpec("8z5Ag5wgagfsOuhz".toByteArray(), "RC4"), cipher.parameters)
return decode(cipher.doFinal(parse).toString(Charsets.UTF_8))
}
fun String?.createSlug(): String? {
return this?.replace(Regex("[^\\w\\s-]"), "")
?.replace(" ", "-")