diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 443288a6..fe0ea9bb 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -884,7 +884,7 @@ object SoraExtractor : SoraStream() { 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( aniId: Int? = null, + malId: Int? = null, epsTitle: String? = null, season: Int? = null, episode: Int? = null, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ) { - val id = getCrunchyrollId("${aniId ?: return}") + val id = getCrunchyrollId("${aniId ?: return}") ?: getCrunchyrollIdFromMalSync("${malId ?: return}") ?: return val audioLocal = listOf( "ja-JP", "en-US", @@ -3328,4 +3329,8 @@ data class MALSyncResponses( data class ZoroResponses( @JsonProperty("html") val html: String? = null, @JsonProperty("link") val link: String? = null, +) + +data class MalSyncRes( + @JsonProperty("Sites") val Sites: Map>>? = null, ) \ No newline at end of file diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 1c813172..d61c3ad1 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -77,6 +77,7 @@ open class SoraStream : TmdbProvider() { private const val tmdbAPI = "https://api.themoviedb.org/3" const val gdbot = "https://gdtot.pro" const val anilistAPI = "https://graphql.anilist.co" + const val malsyncAPI = "https://api.malsync.moe" private val apiKey = base64DecodeAPI("ZTM=NTg=MjM=MjM=ODc=MzI=OGQ=MmE=Nzk=Nzk=ZjI=NTA=NDY=NDA=MzA=YjA=") // PLEASE DON'T STEAL diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt index c6858410..833b35ff 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt @@ -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()?.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? { val embedHost = url?.substringBefore("/embed-player") val player = app.get(