mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
sora: small fix in crunchy
This commit is contained in:
parent
52d49fdaec
commit
aa25976a1b
2 changed files with 10 additions and 8 deletions
|
@ -1474,14 +1474,14 @@ object SoraExtractor : SoraStream() {
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
) {
|
) {
|
||||||
val id = getCrunchyrollId(aniId) ?: return
|
val id = getCrunchyrollId(aniId)
|
||||||
val audioLocal = listOf(
|
val audioLocal = listOf(
|
||||||
"ja-JP",
|
"ja-JP",
|
||||||
"en-US",
|
"en-US",
|
||||||
"zh-CN",
|
"zh-CN",
|
||||||
)
|
)
|
||||||
val headers = getCrunchyrollToken()
|
val headers = getCrunchyrollToken()
|
||||||
val seasonIdData = app.get("$crunchyrollAPI/content/v2/cms/series/$id/seasons", headers = headers)
|
val seasonIdData = app.get("$crunchyrollAPI/content/v2/cms/series/${id ?: return}/seasons", headers = headers)
|
||||||
.parsedSafe<CrunchyrollResponses>()?.data?.let { s ->
|
.parsedSafe<CrunchyrollResponses>()?.data?.let { s ->
|
||||||
if (s.size == 1) {
|
if (s.size == 1) {
|
||||||
s.firstOrNull()
|
s.firstOrNull()
|
||||||
|
@ -1496,9 +1496,9 @@ object SoraExtractor : SoraStream() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val seasonId = seasonIdData?.versions?.filter { it.audio_locale in audioLocal }
|
val seasonId = seasonIdData?.versions?.filter { it.audio_locale in audioLocal }
|
||||||
?.map { it.guid to it.audio_locale }
|
?.map { it.guid to it.audio_locale } ?: listOf(seasonIdData?.id to "ja-JP")
|
||||||
|
|
||||||
seasonId?.apmap { (sId, audioL) ->
|
seasonId.apmap { (sId, audioL) ->
|
||||||
val streamsLink =
|
val streamsLink =
|
||||||
app.get(
|
app.get(
|
||||||
"$crunchyrollAPI/content/v2/cms/seasons/${sId ?: return@apmap}/episodes",
|
"$crunchyrollAPI/content/v2/cms/seasons/${sId ?: return@apmap}/episodes",
|
||||||
|
|
|
@ -957,10 +957,12 @@ suspend fun getCrunchyrollId(aniId: String?): String? {
|
||||||
"variables" to variables
|
"variables" to variables
|
||||||
).toJson().toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
|
).toJson().toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
|
||||||
|
|
||||||
return app.post("https://graphql.anilist.co", requestBody = data)
|
val externalLinks = app.post("https://graphql.anilist.co", requestBody = data)
|
||||||
.parsedSafe<AnilistResponses>()?.data?.Media?.externalLinks?.find { it.site == "VRV" }?.url?.let {
|
.parsedSafe<AnilistResponses>()?.data?.Media?.externalLinks
|
||||||
Regex("series/(\\w+)/?").find(it)?.groupValues?.get(1)
|
|
||||||
}
|
return (externalLinks?.find { it.site == "VRV" } ?: externalLinks?.find { it.site == "Crunchyroll" })?.url?.let {
|
||||||
|
Regex("series/(\\w+)/?").find(it)?.groupValues?.get(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun extractPutlockerSources(url: String?): NiceResponse? {
|
suspend fun extractPutlockerSources(url: String?): NiceResponse? {
|
||||||
|
|
Loading…
Reference in a new issue