mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
[Sora] removed Dub from Crunchy
This commit is contained in:
parent
64af3927d0
commit
afa6956717
3 changed files with 27 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 61
|
version = 62
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -1461,44 +1461,45 @@ object SoraExtractor : SoraStream() {
|
||||||
suspend fun invokeCrunchyroll(
|
suspend fun invokeCrunchyroll(
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
epsTitle: String? = null,
|
epsTitle: String? = null,
|
||||||
|
season: Int? = null,
|
||||||
|
episode: Int? = null,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
) {
|
) {
|
||||||
val id = app.get("$consumetCrunchyrollAPI/$title")
|
val id = app.get("$consumetCrunchyrollAPI/$title")
|
||||||
.parsedSafe<ConsumetSearchResponse>()?.results?.find {
|
.parsedSafe<ConsumetSearchResponse>()?.results?.find {
|
||||||
it.title.equals(
|
it.title.equals(
|
||||||
title, true
|
title,
|
||||||
|
true
|
||||||
) && it.type.equals("series")
|
) && it.type.equals("series")
|
||||||
} ?: return
|
} ?: return
|
||||||
|
|
||||||
val detail = app.get("$consumetCrunchyrollAPI/info?id=${id.id}&mediaType=series").text
|
val detail = app.get("$consumetCrunchyrollAPI/info?id=${id.id}&mediaType=series").text
|
||||||
val episodeId = tryParseJson<ConsumetDetails>(detail)?.episodes?.filter {
|
val episodeId = tryParseJson<ConsumetDetails>(detail)?.episodes?.filter {
|
||||||
it.title.equals(epsTitle, true) && (it.type == "Subbed" || it.type == "English Dub")
|
(it.number == episode || it.title.equals(epsTitle, true)) && it.type == "Subbed"
|
||||||
}?.map { it.id to it.type } ?: return
|
}?.map { it.id }?.getOrNull(season?.minus(1) ?: 0) ?: return
|
||||||
|
|
||||||
episodeId.apmap { (id, type) ->
|
val json = app.get("$consumetCrunchyrollAPI/watch?episodeId=$episodeId&format=srt")
|
||||||
val json = app.get("$consumetCrunchyrollAPI/watch?episodeId=$id&format=srt")
|
.parsedSafe<ConsumetSourcesResponse>()
|
||||||
.parsedSafe<ConsumetSourcesResponse>()
|
|
||||||
|
|
||||||
json?.sources?.map source@{ source ->
|
|
||||||
M3u8Helper.generateM3u8(
|
|
||||||
"Crunchyroll [$type]",
|
|
||||||
source.url ?: return@source null,
|
|
||||||
"",
|
|
||||||
).forEach(callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
json?.subtitles?.map subtitle@{ sub ->
|
|
||||||
subtitleCallback.invoke(
|
|
||||||
SubtitleFile(
|
|
||||||
sub.lang?.replace(Regex("\\[\\S+]"), "")?.trim() ?: "",
|
|
||||||
sub.url ?: return@subtitle null
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
json?.sources?.map source@{ source ->
|
||||||
|
M3u8Helper.generateM3u8(
|
||||||
|
"Crunchyroll",
|
||||||
|
source.url ?: return@source null,
|
||||||
|
"",
|
||||||
|
).forEach(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json?.subtitles?.map subtitle@{ sub ->
|
||||||
|
subtitleCallback.invoke(
|
||||||
|
SubtitleFile(
|
||||||
|
sub.lang?.replace(Regex("\\[\\S+]"), "")?.trim() ?: "",
|
||||||
|
sub.url ?: return@subtitle null
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,6 +351,8 @@ open class SoraStream : TmdbProvider() {
|
||||||
if (res.season != null && res.isAnime) invokeCrunchyroll(
|
if (res.season != null && res.isAnime) invokeCrunchyroll(
|
||||||
res.title,
|
res.title,
|
||||||
res.epsTitle,
|
res.epsTitle,
|
||||||
|
res.season,
|
||||||
|
res.episode,
|
||||||
subtitleCallback,
|
subtitleCallback,
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue