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 // use an integer for version numbers
version = 21 version = 22
cloudstream { cloudstream {

View file

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

View file

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

View file

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

View file

@ -162,7 +162,21 @@ data class WatchOnlineResponse(
@JsonProperty("subtitles") val subtitles: ArrayList<WatchOnlineSubtitles>? = arrayListOf(), @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("label") val label: String? = null,
@JsonProperty("file") val file: 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.invokeSmashyStream
import com.hexated.SoraExtractor.invokeDumpStream import com.hexated.SoraExtractor.invokeDumpStream
import com.hexated.SoraExtractor.invokeEmovies import com.hexated.SoraExtractor.invokeEmovies
import com.hexated.SoraExtractor.invokeGomovies
import com.hexated.SoraExtractor.invokeHdmovies4u import com.hexated.SoraExtractor.invokeHdmovies4u
import com.hexated.SoraExtractor.invokeMoment import com.hexated.SoraExtractor.invokeMoment
import com.hexated.SoraExtractor.invokeMultimovies import com.hexated.SoraExtractor.invokeMultimovies
@ -682,9 +681,6 @@ open class SoraStream : TmdbProvider() {
callback callback
) )
}, },
{
if (!res.isAnime) invokeGomovies(res.title, res.year, res.season, res.episode, callback)
},
{ {
if (!res.isAnime) invokeShowflix( if (!res.isAnime) invokeShowflix(
res.title, res.title,

View file

@ -22,7 +22,6 @@ import com.hexated.SoraExtractor.invokeRidomovies
import com.hexated.SoraExtractor.invokeSmashyStream import com.hexated.SoraExtractor.invokeSmashyStream
import com.hexated.SoraExtractor.invokeDumpStream import com.hexated.SoraExtractor.invokeDumpStream
import com.hexated.SoraExtractor.invokeEmovies import com.hexated.SoraExtractor.invokeEmovies
import com.hexated.SoraExtractor.invokeGomovies
import com.hexated.SoraExtractor.invokeMoment import com.hexated.SoraExtractor.invokeMoment
import com.hexated.SoraExtractor.invokeMultimovies import com.hexated.SoraExtractor.invokeMultimovies
import com.hexated.SoraExtractor.invokeNetmovies import com.hexated.SoraExtractor.invokeNetmovies
@ -245,15 +244,6 @@ class SoraStreamLite : SoraStream() {
callback callback
) )
}, },
{
if (!res.isAnime) invokeGomovies(
res.title,
res.year,
res.season,
res.episode,
callback
)
},
{ {
invokeMoment(res.imdbId, 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() 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? { fun String?.createSlug(): String? {
return this?.replace(Regex("[^\\w\\s-]"), "") return this?.replace(Regex("[^\\w\\s-]"), "")
?.replace(" ", "-") ?.replace(" ", "-")