mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
[Sora] fixed missing anime in Sorastream
This commit is contained in:
parent
dbf8e12226
commit
b7b1f0ceee
3 changed files with 38 additions and 9 deletions
|
@ -800,6 +800,7 @@ object SoraExtractor : SoraStream() {
|
||||||
|
|
||||||
suspend fun invokeSoraStream(
|
suspend fun invokeSoraStream(
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
|
isAnime: Boolean = false,
|
||||||
year: Int? = null,
|
year: Int? = null,
|
||||||
season: Int? = null,
|
season: Int? = null,
|
||||||
episode: Int? = null,
|
episode: Int? = null,
|
||||||
|
@ -845,10 +846,9 @@ object SoraExtractor : SoraStream() {
|
||||||
) && (it.second == year || it.first.contains("Season $season", true))
|
) && (it.second == year || it.first.contains("Season $season", true))
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
it.first.contains(
|
(if (isAnime) it.first.contains(Regex("(?i)$title\\s?($season|${season.toRomanNumeral()})")) else it.first.contains(
|
||||||
"$title",
|
Regex("(?i)$title\\s?Season\\s$season")
|
||||||
true
|
)) && it.second == year
|
||||||
) && it.second == year && it.first.contains("Season $season", true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2034,7 +2034,6 @@ object SoraExtractor : SoraStream() {
|
||||||
episode: Int? = null,
|
episode: Int? = null,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
) {
|
) {
|
||||||
val watchSomuchAPI = "https://watchsomuch.tv"
|
|
||||||
val id = imdbId?.removePrefix("tt")
|
val id = imdbId?.removePrefix("tt")
|
||||||
val epsId = app.post(
|
val epsId = app.post(
|
||||||
"$watchSomuchAPI/Watch/ajMovieTorrents.aspx",
|
"$watchSomuchAPI/Watch/ajMovieTorrents.aspx",
|
||||||
|
@ -2089,7 +2088,10 @@ object SoraExtractor : SoraStream() {
|
||||||
"cf_cache_token" to "UKsVpQqBMxB56gBfhYKbfCVkRIXMh42pk6G4DdkXXoVh7j4BjV"
|
"cf_cache_token" to "UKsVpQqBMxB56gBfhYKbfCVkRIXMh42pk6G4DdkXXoVh7j4BjV"
|
||||||
)
|
)
|
||||||
val query = getIndexQuery(title, year, season, episode)
|
val query = getIndexQuery(title, year, season, episode)
|
||||||
val search = app.get("$baymoviesAPI/0:search?q=$query&page_token=&page_index=0", headers = headers).text
|
val search = app.get(
|
||||||
|
"$baymoviesAPI/0:search?q=$query&page_token=&page_index=0",
|
||||||
|
headers = headers
|
||||||
|
).text
|
||||||
val media = searchIndex(title, season, episode, year, search) ?: return
|
val media = searchIndex(title, season, episode, year, search) ?: return
|
||||||
|
|
||||||
media.apmap { file ->
|
media.apmap { file ->
|
||||||
|
@ -2101,7 +2103,8 @@ object SoraExtractor : SoraStream() {
|
||||||
val encryptedExpiry = base64Encode(CryptoAES.encrypt(key, expiry).toByteArray())
|
val encryptedExpiry = base64Encode(CryptoAES.encrypt(key, expiry).toByteArray())
|
||||||
val worker = getConfig().workers.randomOrNull() ?: return@apmap null
|
val worker = getConfig().workers.randomOrNull() ?: return@apmap null
|
||||||
|
|
||||||
val link = "https://api.$worker.workers.dev/download.aspx?file=$encryptedId&expiry=$encryptedExpiry&mac=$hmacSign"
|
val link =
|
||||||
|
"https://api.$worker.workers.dev/download.aspx?file=$encryptedId&expiry=$encryptedExpiry&mac=$hmacSign"
|
||||||
if (!app.get(link).isSuccessful) return@apmap null
|
if (!app.get(link).isSuccessful) return@apmap null
|
||||||
val size = file.size?.toDouble() ?: return@apmap null
|
val size = file.size?.toDouble() ?: return@apmap null
|
||||||
val sizeFile = "%.2f GB".format(bytesToGigaBytes(size))
|
val sizeFile = "%.2f GB".format(bytesToGigaBytes(size))
|
||||||
|
|
|
@ -116,6 +116,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
const val chillmovies0API = "https://chill.aicirou.workers.dev/0:"
|
const val chillmovies0API = "https://chill.aicirou.workers.dev/0:"
|
||||||
const val chillmovies1API = "https://chill.aicirou.workers.dev/1:"
|
const val chillmovies1API = "https://chill.aicirou.workers.dev/1:"
|
||||||
const val gamMoviesAPI = "https://drive.gamick.workers.dev/0:"
|
const val gamMoviesAPI = "https://drive.gamick.workers.dev/0:"
|
||||||
|
const val watchSomuchAPI = "https://watchsomuch.tv" // sub only
|
||||||
|
|
||||||
fun getType(t: String?): TvType {
|
fun getType(t: String?): TvType {
|
||||||
return when (t) {
|
return when (t) {
|
||||||
|
@ -331,6 +332,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
{
|
{
|
||||||
invokeSoraStream(
|
invokeSoraStream(
|
||||||
res.title,
|
res.title,
|
||||||
|
res.isAnime,
|
||||||
res.year,
|
res.year,
|
||||||
res.season,
|
res.season,
|
||||||
res.episode,
|
res.episode,
|
||||||
|
|
|
@ -848,3 +848,27 @@ suspend fun loadLinksWithWebView(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Int.toRomanNumeral(): String = Symbol.closestBelow(this)
|
||||||
|
.let { symbol ->
|
||||||
|
if (symbol != null) {
|
||||||
|
"$symbol${(this - symbol.decimalValue).toRomanNumeral()}"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum class Symbol(val decimalValue: Int) {
|
||||||
|
I(1),
|
||||||
|
IV(4),
|
||||||
|
V(5),
|
||||||
|
IX(9),
|
||||||
|
X(10);
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun closestBelow(value: Int) =
|
||||||
|
values()
|
||||||
|
.sortedByDescending { it.decimalValue }
|
||||||
|
.firstOrNull { value >= it.decimalValue }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue