sora: using consumet again for crunchyroll

This commit is contained in:
hexated 2023-03-06 08:27:16 +07:00
parent b2fa3608f3
commit 70b5e3a6d9
4 changed files with 12 additions and 11 deletions

View file

@ -1524,7 +1524,7 @@ object SoraExtractor : SoraStream() {
callback: (ExtractorLink) -> Unit
) {
val id = searchCrunchyrollAnimeId(title ?: return) ?: return
val detail = app.get("$consumetCrunchyrollAPI/info?id=$id&mediaType=series").text
val detail = app.get("$consumetCrunchyrollAPI/info/$id?fetchAllSeasons=true").text
val epsId = tryParseJson<CrunchyrollDetails>(detail)?.findCrunchyrollId(
title,
season,
@ -1534,13 +1534,13 @@ object SoraExtractor : SoraStream() {
epsId.apmap {
val json =
app.get("$consumetCrunchyrollAPI/watch?episodeId=${it?.first ?: return@apmap null}")
app.get("$consumetCrunchyrollAPI/watch/${it?.first ?: return@apmap null}")
.parsedSafe<ConsumetSourcesResponse>()
json?.sources?.map source@{ source ->
callback.invoke(
ExtractorLink(
"Crunchyroll [${it.second ?: ""}]",
"Crunchyroll",
"Crunchyroll [${it.second ?: ""}]",
source.url ?: return@source null,
"https://static.crunchyroll.com/",
@ -1553,7 +1553,7 @@ object SoraExtractor : SoraStream() {
json?.subtitles?.map subtitle@{ sub ->
subtitleCallback.invoke(
SubtitleFile(
sub.lang ?: "",
fixCrunchyrollLang(sub.lang ?: return@subtitle null) ?: sub.lang,
sub.url ?: return@subtitle null
)
)

View file

@ -6,6 +6,7 @@ import com.hexated.SoraExtractor.invokeAnimes
import com.hexated.SoraExtractor.invokeBlackmovies
import com.hexated.SoraExtractor.invokeBollyMaza
import com.hexated.SoraExtractor.invokeCodexmovies
import com.hexated.SoraExtractor.invokeCrunchyroll
import com.hexated.SoraExtractor.invokeDbgo
import com.hexated.SoraExtractor.invokeFilmxy
import com.hexated.SoraExtractor.invokeFlixhq
@ -98,8 +99,8 @@ open class SoraStream : TmdbProvider() {
const val xMovieAPI = "https://xemovies.to"
const val haikeiFlixhqAPI = "https://api.haikei.xyz/movies/flixhq" // disabled
const val consumetZoroAPI = "https://api.consumet.org/anime/zoro"
const val consumetCrunchyrollAPI = "https://api.consumet.org/anime/crunchyroll" // dead
const val kickassanimeAPI = "https://www2.kickassanime.ro"
const val consumetCrunchyrollAPI = "https://cronchy.consumet.stream"
const val kickassanimeAPI = "https://www2.kickassanime.ro" // disabled due to consumet
const val kissKhAPI = "https://kisskh.me"
const val lingAPI = "https://ling-online.net"
const val uhdmoviesAPI = "https://uhdmovies.world"
@ -411,7 +412,7 @@ open class SoraStream : TmdbProvider() {
)
},
{
if (res.season != null && res.isAnime) invokeKickassanime(
if (res.season != null && res.isAnime) invokeCrunchyroll(
res.title,
res.epsTitle,
res.season,

View file

@ -108,7 +108,7 @@ class SoraStreamLite : SoraStream() {
)
},
{
if (res.season != null && res.isAnime) invokeKickassanime(
if (res.season != null && res.isAnime) invokeCrunchyroll(
res.title,
res.epsTitle,
res.season,

View file

@ -539,7 +539,7 @@ suspend fun invokeSapphire(
res?.subtitles?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
getKaaLanguage(sub.language ?: return@map null) ?: sub.language,
fixCrunchyrollLang(sub.language ?: return@map null) ?: sub.language,
sub.url ?: return@map null
)
)
@ -729,7 +729,7 @@ fun Document.findTvMoviesIframe(): String? {
}
suspend fun searchCrunchyrollAnimeId(title: String): String? {
val res = app.get("${consumetCrunchyrollAPI}/$title")
val res = app.get("${consumetCrunchyrollAPI}/search/$title")
.parsedSafe<ConsumetSearchResponse>()?.results
return (if (res?.size == 1) {
res.firstOrNull()
@ -991,7 +991,7 @@ fun getDbgoLanguage(str: String): String {
}
}
fun getKaaLanguage(language: String?): String? {
fun fixCrunchyrollLang(language: String?): String? {
return SubtitleHelper.fromTwoLettersToLanguage(language ?: return null)
?: SubtitleHelper.fromTwoLettersToLanguage(language.substringBefore("-"))
}