Skip to content

Commit

Permalink
Updated Zoro
Browse files Browse the repository at this point in the history
  • Loading branch information
kemuriXD committed Jul 4, 2023
1 parent 065da75 commit bc42749
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 40 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/ani/saikou/parsers/anime/Zoro.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Zoro : AnimeParser() {

override val name = "Zoro"
override val saveName = "zoro_to"
override val hostUrl = "https://zoro.to"
override val hostUrl = "https://aniwatch.to"
override val isDubAvailableSeparately = false

private val header = mapOf("X-Requested-With" to "XMLHttpRequest", "referer" to hostUrl)
Expand Down Expand Up @@ -53,7 +53,7 @@ class Zoro : AnimeParser() {
override suspend fun getVideoExtractor(server: VideoServer): VideoExtractor? {
val domain = Uri.parse(server.embed.url).host ?: return null
val extractor: VideoExtractor? = when {
"rapid" in domain -> RapidCloud(server)
"megacloud" in domain -> RapidCloud(server)
"sb" in domain -> StreamSB(server)
"streamta" in domain -> StreamTape(server)
else -> null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package ani.saikou.parsers.anime.extractors

import android.util.Base64
import android.net.Uri
import ani.saikou.*
import ani.saikou.parsers.*
import kotlinx.serialization.Serializable
import okhttp3.Request
import okhttp3.Response
import okhttp3.WebSocket
import okhttp3.WebSocketListener
import java.nio.charset.StandardCharsets
import java.security.MessageDigest
import java.util.*
Expand All @@ -20,17 +17,15 @@ import javax.crypto.spec.SecretKeySpec
class RapidCloud(override val server: VideoServer) : VideoExtractor() {

override suspend fun extract(): VideoContainer {
println(server.embed.url)
val videos = mutableListOf<Video>()
val subtitles = mutableListOf<Subtitle>()

val sId = wss()
val decryptKey = decryptKey()

if (sId.isNotEmpty() && decryptKey.isNotEmpty()) {
val jsonLink = "https://rapid-cloud.co/ajax/embed-6/getSources?id=${
server.embed.url.findBetween("/embed-6/", "?")!!
}&sId=$sId"
if (decryptKey.isNotEmpty()) {
val embedURL = Uri.parse(server.embed.url);
val id = embedURL.path?.substringAfterLast("/");
val jsonLink = "https://${embedURL.host}/embed-2/ajax/e-1/getSources?id=${id}"
val response = client.get(jsonLink)

val sourceObject = if (response.text.contains("encrypted")) {
Expand Down Expand Up @@ -66,34 +61,6 @@ class RapidCloud(override val server: VideoServer) : VideoExtractor() {
return client.get("https://raw.githubusercontent.com/enimax-anime/key/e6/key.txt").text
}

private suspend fun wss(): String {
var sId = client.get("https://api.enime.moe/tool/rapid-cloud/server-id", mapOf("User-Agent" to "Saikou")).text
if (sId.isEmpty()) {
val latch = CountDownLatch(1)
val listener = object : WebSocketListener() {
override fun onOpen(webSocket: WebSocket, response: Response) {
webSocket.send("40")
}

override fun onMessage(webSocket: WebSocket, text: String) {
when {
text.startsWith("40") -> {
sId = text.findBetween("40{\"sid\":\"", "\"}") ?: ""
latch.countDown()
}
text == "2" -> webSocket.send("3")
}
}
}
okHttpClient.newWebSocket(
Request.Builder().url("wss://ws1.rapid-cloud.co/socket.io/?EIO=4&transport=websocket").build(),
listener
)
latch.await(30, TimeUnit.SECONDS)
}
return sId
}

private fun md5(input: ByteArray): ByteArray {
return MessageDigest.getInstance("MD5").digest(input)
}
Expand Down

0 comments on commit bc42749

Please sign in to comment.