[Sora] filter low quality from index site

This commit is contained in:
hexated 2023-02-02 12:17:58 +07:00
parent 315b6b3cdb
commit fcdccf9155
3 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 81
version = 82
cloudstream {

View file

@ -2102,6 +2102,7 @@ object SoraExtractor : SoraStream() {
val worker = getConfig().workers.randomOrNull() ?: return@apmap null
val link = "https://api.$worker.workers.dev/download.aspx?file=$encryptedId&expiry=$encryptedExpiry&mac=$hmacSign"
if(!app.get(link).isSuccessful) return@apmap null
val size = file.size?.toDouble() ?: return@apmap null
val sizeFile = "%.2f GB".format(bytesToGigaBytes(size))
val tags = Regex("\\d{3,4}[pP]\\.?(.*?)\\.(mkv|mp4)").find(
@ -2228,6 +2229,7 @@ object SoraExtractor : SoraStream() {
}).text.let {
fixUrl(it, apiUrl)
}.encodeUrl()
if(!app.get(path).isSuccessful) return@apmap null
val size = file.size?.toDouble() ?: return@apmap null
val sizeFile = "%.2f GB".format(bytesToGigaBytes(size))
val quality =

View file

@ -642,7 +642,7 @@ fun searchIndex(
"video/mp4",
"video/x-msvideo"
)
return tryParseJson<IndexSearch>(response)?.data?.files?.filter { media ->
val files = tryParseJson<IndexSearch>(response)?.data?.files?.filter { media ->
(if (season == null) {
media.name?.contains("$year") == true
} else {
@ -659,7 +659,14 @@ fun searchIndex(
"-",
" "
).contains("$spaceSlug", true))
}?.distinctBy { it.name }
}?.distinctBy { it.name }?.sortedByDescending { it.size?.toLongOrNull() ?: 0 } ?: return null
return files.let { file ->
listOfNotNull(
file.find { it.name?.contains("2160p", true) == true },
file.find { it.name?.contains("1080p", true) == true }
)
}
}
suspend fun getConfig(): BaymoviesConfig {