fix missing anime in Crunchyroll

This commit is contained in:
hexated 2023-01-19 17:23:58 +07:00
parent 0f0f680047
commit 4905e8f868
3 changed files with 13 additions and 7 deletions

View File

@ -1665,17 +1665,17 @@ object SoraExtractor : SoraStream() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val res = app.get("$consumetCrunchyrollAPI/$title")
.parsedSafe<ConsumetSearchResponse>()?.results ?: return
val res = (searchCrunchyroll(title)
?: searchCrunchyroll(title?.substringBefore(" ")))?.results
val id = (if (res.size == 1) {
val id = (if (res?.size == 1) {
res.firstOrNull()
} else {
res.find {
it.title.equals(
res?.find {
(it.title.equals(
title,
true
) && it.type.equals("series")
) || it.title.fixTitle().equals(title.fixTitle(), true)) && it.type.equals("series")
}
})?.id ?: return

View File

@ -207,7 +207,7 @@ open class SoraStream : TmdbProvider() {
val year = (res.releaseDate ?: res.firstAirDate)?.split("-")?.first()?.toIntOrNull()
val rating = res.vote_average.toString().toRatingInt()
val genres = res.genres?.mapNotNull { it.name }
val isAnime = genres?.contains("Animation") == true && res.original_language == "ja"
val isAnime = genres?.contains("Animation") == true && (res.original_language == "zh" || res.original_language == "ja")
val keywords = res.keywords?.results?.mapNotNull { it.name }.orEmpty()
.ifEmpty { res.keywords?.keywords?.mapNotNull { it.name } }

View File

@ -1,5 +1,6 @@
package com.hexated
import com.hexated.SoraStream.Companion.consumetCrunchyrollAPI
import com.hexated.SoraStream.Companion.filmxyAPI
import com.hexated.SoraStream.Companion.gdbot
import com.hexated.SoraStream.Companion.tvMoviesAPI
@ -468,6 +469,11 @@ fun Document.findTvMoviesIframe(): String? {
?.substringBefore("'>")
}
suspend fun searchCrunchyroll(title: String?) : ConsumetSearchResponse? {
return app.get("${consumetCrunchyrollAPI}/$title")
.parsedSafe()
}
fun CrunchyrollDetails.findCrunchyrollId(
title: String?,
season: Int?,