sora[crunchy]: fix missing anime

This commit is contained in:
hexated 2023-05-29 10:34:57 +07:00
parent 9d0131cf07
commit 8a60fee389
3 changed files with 16 additions and 2 deletions

View file

@ -884,7 +884,7 @@ object SoraExtractor : SoraStream() {
invokeBiliBili(aniId, episode, subtitleCallback, callback) invokeBiliBili(aniId, episode, subtitleCallback, callback)
}, },
{ {
if (season != null) invokeCrunchyroll(aniId, epsTitle, season, episode, subtitleCallback, callback) if (season != null) invokeCrunchyroll(aniId, malId, epsTitle, season, episode, subtitleCallback, callback)
} }
) )
} }
@ -1499,13 +1499,14 @@ object SoraExtractor : SoraStream() {
suspend fun invokeCrunchyroll( suspend fun invokeCrunchyroll(
aniId: Int? = null, aniId: Int? = null,
malId: Int? = null,
epsTitle: String? = null, epsTitle: String? = null,
season: Int? = null, season: Int? = null,
episode: Int? = null, episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val id = getCrunchyrollId("${aniId ?: return}") val id = getCrunchyrollId("${aniId ?: return}") ?: getCrunchyrollIdFromMalSync("${malId ?: return}") ?: return
val audioLocal = listOf( val audioLocal = listOf(
"ja-JP", "ja-JP",
"en-US", "en-US",
@ -3329,3 +3330,7 @@ data class ZoroResponses(
@JsonProperty("html") val html: String? = null, @JsonProperty("html") val html: String? = null,
@JsonProperty("link") val link: String? = null, @JsonProperty("link") val link: String? = null,
) )
data class MalSyncRes(
@JsonProperty("Sites") val Sites: Map<String,Map<String,Map<String,String>>>? = null,
)

View file

@ -77,6 +77,7 @@ open class SoraStream : TmdbProvider() {
private const val tmdbAPI = "https://api.themoviedb.org/3" private const val tmdbAPI = "https://api.themoviedb.org/3"
const val gdbot = "https://gdtot.pro" const val gdbot = "https://gdtot.pro"
const val anilistAPI = "https://graphql.anilist.co" const val anilistAPI = "https://graphql.anilist.co"
const val malsyncAPI = "https://api.malsync.moe"
private val apiKey = private val apiKey =
base64DecodeAPI("ZTM=NTg=MjM=MjM=ODc=MzI=OGQ=MmE=Nzk=Nzk=ZjI=NTA=NDY=NDA=MzA=YjA=") // PLEASE DON'T STEAL base64DecodeAPI("ZTM=NTg=MjM=MjM=ODc=MzI=OGQ=MmE=Nzk=Nzk=ZjI=NTA=NDY=NDA=MzA=YjA=") // PLEASE DON'T STEAL

View file

@ -969,6 +969,14 @@ suspend fun getCrunchyrollId(aniId: String?): String? {
} }
} }
suspend fun getCrunchyrollIdFromMalSync(aniId: String?): String? {
val res = app.get("$malsyncAPI/mal/anime/$aniId").parsedSafe<MalSyncRes>()?.Sites
val vrv = res?.get("Vrv")?.map { it.value }?.firstOrNull()?.get("url")
val crunchyroll = res?.get("Vrv")?.map { it.value }?.firstOrNull()?.get("url")
val regex = Regex("series/(\\w+)/?")
return regex.find("$vrv")?.groupValues?.getOrNull(1) ?: regex.find("$crunchyroll")?.groupValues?.getOrNull(1)
}
suspend fun extractPutlockerSources(url: String?): NiceResponse? { suspend fun extractPutlockerSources(url: String?): NiceResponse? {
val embedHost = url?.substringBefore("/embed-player") val embedHost = url?.substringBefore("/embed-player")
val player = app.get( val player = app.get(