pt/rinecloud: Fixed pt/RineCloud source (fix #327) (#337)

This commit is contained in:
WebDitto 2024-10-29 15:56:14 -03:00 committed by GitHub
parent 9c2cdd3729
commit 11ee82af81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 16 deletions

View file

@ -3,7 +3,7 @@ ext {
extClass = '.RineCloud' extClass = '.RineCloud'
themePkg = 'animestream' themePkg = 'animestream'
baseUrl = 'https://rine.cloud' baseUrl = 'https://rine.cloud'
overrideVersionCode = 9 overrideVersionCode = 10
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View file

@ -29,21 +29,19 @@ class RineCloudExtractor(private val client: OkHttpClient, private val headers:
?: return emptyList() ?: return emptyList()
} }
return if ("googlevideo" in script) { return script.substringAfter("sources:").substringBefore("]")
script.substringAfter("sources:").substringBefore("]") .split("{")
.split("{") .drop(1)
.drop(1) .flatMap {
.map { val videoUrl = it.substringAfter("\"file\"").substringAfter('"').substringBefore('"')
val videoUrl = it.substringAfter("file\":\"").substringBefore('"') val quality = it.substringAfter("\"label\"").substringAfter('"').substringBefore('"').ifBlank { "Unknown" }
val quality = it.substringAfter("label\":\"").substringBefore('"')
Video(videoUrl, "Rinecloud - $quality", videoUrl, headers)
}
} else {
val masterPlaylistUrl = script.substringAfter("sources:")
.substringAfter("file\":\"")
.substringBefore('"')
playlistUtils.extractFromHls(masterPlaylistUrl, videoNameGen = { "Rinecloud - $it" }) when {
} arrayOf("googlevideo", ".mp4").any(videoUrl) -> listOf(Video(videoUrl, "Rinecloud - $quality", videoUrl, headers))
else -> playlistUtils.extractFromHls(videoUrl, videoNameGen = { "Rinecloud - ${if (it == "Video") quality else it}" })
}
}
} }
private fun Array<String>.any(url: String): Boolean = this.any { url.contains(it, ignoreCase = true) }
} }