mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
sora: small fix in bilibili sub
This commit is contained in:
parent
1c717ee6dd
commit
b08c3a3204
1 changed files with 20 additions and 9 deletions
|
@ -895,7 +895,7 @@ object SoraExtractor : SoraStream() {
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
) {
|
) {
|
||||||
val res = app.get("$biliBiliAPI/anime/episodes?id=$aniId&source_id=bilibili", referer = kaguyaBaseUrl)
|
val res = app.get("$biliBiliAPI/anime/episodes?id=${aniId ?: return}&source_id=bilibili", referer = kaguyaBaseUrl)
|
||||||
.parsedSafe<BiliBiliDetails>()?.episodes?.find {
|
.parsedSafe<BiliBiliDetails>()?.episodes?.find {
|
||||||
it.episodeNumber == episode
|
it.episodeNumber == episode
|
||||||
} ?: return
|
} ?: return
|
||||||
|
@ -920,15 +920,16 @@ object SoraExtractor : SoraStream() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
sources?.subtitles?.map { sub ->
|
app.get("https://api.bilibili.tv/intl/gateway/web/v2/subtitle?s_locale=en_US&platform=web&episode_id=${res.sourceEpisodeId}&spm_id=bstar-web.pgc-video-detail.0.0&from_spm_id=bstar-web.homepage.anime.all")
|
||||||
subtitleCallback.invoke(
|
.parsedSafe<BiliBiliSubtitlesResponses>()?.data?.subtitles?.map { sub ->
|
||||||
SubtitleFile(
|
subtitleCallback.invoke(
|
||||||
SubtitleHelper.fromTwoLettersToLanguage(sub.lang ?: "") ?: sub.language
|
SubtitleFile(
|
||||||
?: return@map null,
|
SubtitleHelper.fromTwoLettersToLanguage(sub.lang_key ?: "") ?: sub.lang
|
||||||
sub.file ?: return@map null
|
?: return@map null,
|
||||||
|
sub.url ?: return@map null
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3155,7 +3156,9 @@ data class BiliBiliDetails(
|
||||||
|
|
||||||
data class BiliBiliSubtitles(
|
data class BiliBiliSubtitles(
|
||||||
@JsonProperty("file") val file: String? = null,
|
@JsonProperty("file") val file: String? = null,
|
||||||
|
@JsonProperty("url") val url: String? = null,
|
||||||
@JsonProperty("lang") val lang: String? = null,
|
@JsonProperty("lang") val lang: String? = null,
|
||||||
|
@JsonProperty("lang_key") val lang_key: String? = null,
|
||||||
@JsonProperty("language") val language: String? = null,
|
@JsonProperty("language") val language: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -3169,6 +3172,14 @@ data class BiliBiliSourcesResponse(
|
||||||
@JsonProperty("subtitles") val subtitles: ArrayList<BiliBiliSubtitles>? = arrayListOf(),
|
@JsonProperty("subtitles") val subtitles: ArrayList<BiliBiliSubtitles>? = arrayListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class BiliBiliSubtitlesData(
|
||||||
|
@JsonProperty("subtitles") val subtitles: ArrayList<BiliBiliSubtitles>? = arrayListOf(),
|
||||||
|
)
|
||||||
|
|
||||||
|
data class BiliBiliSubtitlesResponses(
|
||||||
|
@JsonProperty("data") val data: BiliBiliSubtitlesData? = BiliBiliSubtitlesData(),
|
||||||
|
)
|
||||||
|
|
||||||
data class WatchOnlineItems(
|
data class WatchOnlineItems(
|
||||||
@JsonProperty("slug") val slug: String? = null,
|
@JsonProperty("slug") val slug: String? = null,
|
||||||
@JsonProperty("tmdb_id") val tmdb_id: Int? = null,
|
@JsonProperty("tmdb_id") val tmdb_id: Int? = null,
|
||||||
|
|
Loading…
Reference in a new issue