fixed Zoro & AnimeKaizoku movie

This commit is contained in:
hexated 2023-01-11 15:08:53 +07:00
parent 7ce045ccd7
commit 521e8021d0
2 changed files with 42 additions and 14 deletions

View file

@ -1094,16 +1094,26 @@ object SoraExtractor : SoraStream() {
suspend fun invokeAnimes( suspend fun invokeAnimes(
id: Int? = null, id: Int? = null,
title: String? = null, title: String? = null,
year: Int? = 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 malId = if (season != null) app.get("$tmdb2mal/?id=$id&s=$season").text.trim() else null val malId =
if (season != null) app.get("$tmdb2mal/?id=$id&s=$season").text.trim()
else app.get("${jikanAPI}/anime?q=${title}&start_date=${year}&type=movie&limit=1")
.parsedSafe<JikanResponse>()?.data?.firstOrNull()?.mal_id
val aniId = app.post(
"https://graphql.anilist.co/", data = mapOf(
"query" to "{Media(idMal:$malId,type:ANIME){id}}",
)
).parsedSafe<DataAni>()?.data?.media?.id
argamap( argamap(
{ {
if (season != null) invokeZoro(malId, episode, subtitleCallback, callback) invokeZoro(aniId, episode, subtitleCallback, callback)
}, },
{ {
invokeAnimeKaizoku(title, malId, season, episode, callback) invokeAnimeKaizoku(title, malId, season, episode, callback)
@ -1112,14 +1122,14 @@ object SoraExtractor : SoraStream() {
} }
private suspend fun invokeZoro( private suspend fun invokeZoro(
malId: String? = null, aniId: String? = null,
episode: Int? = null, episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val episodeId = app.get("$consumetMalAPI/info/$malId?provider=zoro") val episodeId = app.get("$consumetAnilistAPI/info/$aniId?provider=zoro")
.parsedSafe<ConsumetDetails>()?.episodes?.find { .parsedSafe<ConsumetDetails>()?.episodes?.find {
it.number == episode it.number == (episode ?: 1)
}?.id?.substringBeforeLast("$") ?: return }?.id?.substringBeforeLast("$") ?: return
listOf( listOf(
@ -1161,15 +1171,12 @@ object SoraExtractor : SoraStream() {
episode: Int? = null, episode: Int? = null,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val fixTitle = title.fixTitle() val fixTitle = title.fixTitle()?.replace("-", " ")
val search = app.get("$animeKaizokuAPI/?s=${fixTitle?.replace("-", " ")}").document val search = app.get("$animeKaizokuAPI/?s=${fixTitle}").document
val detailHref = val detailHref =
search.select("ul#posts-container li").map { it.selectFirst("a")?.attr("href") } search.select("ul#posts-container li").map { it.selectFirst("a")?.attr("href") }
.find { .find {
if (season == null) it?.contains( it?.contains(malId ?: return) == true
fixTitle ?: return,
true
) == true else it?.contains(malId ?: return) == true
}?.let { fixUrl(it, animeKaizokuAPI) } }?.let { fixUrl(it, animeKaizokuAPI) }
val detail = app.get(detailHref ?: return).document val detail = app.get(detailHref ?: return).document
@ -1209,7 +1216,7 @@ object SoraExtractor : SoraStream() {
).text.substringAfter("openInNewTab(\"") ).text.substringAfter("openInNewTab(\"")
.substringBefore("\")").let { base64Decode(it) } .substringBefore("\")").let { base64Decode(it) }
if(!ouo.startsWith("https://ouo")) return@apmap null if (!ouo.startsWith("https://ouo")) return@apmap null
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
"AnimeKaizoku [${episodeData.third}]", "AnimeKaizoku [${episodeData.third}]",
@ -2125,4 +2132,24 @@ data class Safelink(
data class FDAds( data class FDAds(
@JsonProperty("linkr") val linkr: String? = null, @JsonProperty("linkr") val linkr: String? = null,
)
data class DataMal(
@JsonProperty("mal_id") val mal_id: String? = null,
)
data class JikanResponse(
@JsonProperty("data") val data: ArrayList<DataMal>? = arrayListOf(),
)
data class IdAni(
@JsonProperty("id") val id: String? = null,
)
data class MediaAni(
@JsonProperty("Media") val media: IdAni? = null,
)
data class DataAni(
@JsonProperty("data") val data: MediaAni? = null,
) )

View file

@ -58,8 +58,9 @@ open class SoraStream : TmdbProvider() {
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
const val tmdb2mal = "https://tmdb2mal.slidemovies.org" const val tmdb2mal = "https://tmdb2mal.slidemovies.org"
const val jikanAPI = "https://api.jikan.moe/v4"
const val gdbot = "https://gdbot.xyz" const val gdbot = "https://gdbot.xyz"
const val consumetMalAPI = "https://api.consumet.org/meta/mal" const val consumetAnilistAPI = "https://api.consumet.org/meta/anilist"
private val mainAPI = private val mainAPI =
base64DecodeAPI("cHA=LmE=ZWw=cmM=dmU=aC4=dGM=d2E=eHA=Ly8=czo=dHA=aHQ=") base64DecodeAPI("cHA=LmE=ZWw=cmM=dmU=aC4=dGM=d2E=eHA=Ly8=czo=dHA=aHQ=")
@ -354,7 +355,7 @@ open class SoraStream : TmdbProvider() {
// ) // )
// }, // },
{ {
if (res.isAnime) invokeAnimes(res.id, res.title, res.season, res.episode, subtitleCallback, callback) if (res.isAnime) invokeAnimes(res.id, res.title, res.year, res.season, res.episode, subtitleCallback, callback)
}, },
{ {
if (res.season != null && res.isAnime) invokeCrunchyroll( if (res.season != null && res.isAnime) invokeCrunchyroll(