From 796c67c7ef5cbffdd7ae124d1e4efcac97b18b64 Mon Sep 17 00:00:00 2001 From: hexated Date: Sat, 11 Feb 2023 17:50:38 +0700 Subject: [PATCH] sora: fixed Movie123Net --- .../main/kotlin/com/hexated/SoraExtractor.kt | 9 +++---- .../src/main/kotlin/com/hexated/SoraStream.kt | 2 +- .../src/main/kotlin/com/hexated/SoraUtils.kt | 27 +++++++++++++------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index bfb2646f..725f9b4f 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -1838,7 +1838,7 @@ object SoraExtractor : SoraStream() { it.t?.equals( "$title - Season $season", true - ) == true || it.s?.contains("$fixTitle-season-$season", true) == true + ) == true || it.s?.contains("$fixTitle-season-$season-", true) == true } }?.s?.substringAfterLast("-") ?: return @@ -2348,15 +2348,14 @@ object SoraExtractor : SoraStream() { // removed due to rate limit // if (!app.get(path).isSuccessful) return@apmap null - val size = file.size?.toDouble() ?: return@apmap null - val sizeFile = "%.2f GB".format(bytesToGigaBytes(size)) + val size = "%.2f GB".format(bytesToGigaBytes(file.size?.toDouble() ?: return@apmap null)) val quality = getIndexQuality(file.name) val tags = getIndexQualityTags(file.name) callback.invoke( ExtractorLink( - "$api $tags [$sizeFile]", - "$api $tags [$sizeFile]", + "$api $tags [$size]", + "$api $tags [$size]", path, "", quality, diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 4f79edec..bca3feb7 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -85,7 +85,7 @@ open class SoraStream : TmdbProvider() { const val series9API = "https://series9.la" const val idlixAPI = "https://idlixian.com" const val noverseAPI = "https://www.nollyverse.com" - const val olgplyAPI = "https://olgply.xyz" + const val olgplyAPI = "https://olgply.xyz" // dead const val uniqueStreamAPI = "https://uniquestreaming.net" const val filmxyAPI = "https://www.filmxy.vip" const val kimcartoonAPI = "https://kimcartoon.li" diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt index 628012f4..3bdc1b9e 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt @@ -82,7 +82,10 @@ fun String.filterIframe(seasonNum: Int?, lastSeason: Int?, year: Int?, title: St ) } } else { - this.contains(Regex("(?i)($year)|($dotSlug)|($spaceSlug)")) && !this.contains("Download", true) + this.contains(Regex("(?i)($year)|($dotSlug)|($spaceSlug)")) && !this.contains( + "Download", + true + ) } } @@ -116,13 +119,13 @@ suspend fun extractMirrorUHD(url: String, ref: String): String? { var downLink = baseDoc.getMirrorLink() run lit@{ (1..2).forEach { - if(downLink != null) return@lit + if (downLink != null) return@lit val server = baseDoc.getMirrorServer(it.plus(1)) baseDoc = app.get(fixUrl(server, ref)).document downLink = baseDoc.getMirrorLink() } } - if(downLink?.contains(".mkv") == true || downLink?.contains(".mp4") == true) return downLink + if (downLink?.contains(".mkv") == true || downLink?.contains(".mp4") == true) return downLink val downPage = app.get(downLink ?: return null).document return downPage.selectFirst("form[method=post] a.btn.btn-success") ?.attr("onclick")?.substringAfter("Openblank('")?.substringBefore("')") ?: run { @@ -270,7 +273,12 @@ suspend fun getDrivebotLink(url: String?): String? { referer = url ).parsedSafe()?.url ?: return null - return app.get(fixUrl(file, baseUrl)).document.selectFirst("script:containsData(window.open)") + return if (file.startsWith("http")) file else app.get( + fixUrl( + file, + baseUrl + ) + ).document.selectFirst("script:containsData(window.open)") ?.data()?.substringAfter("window.open('")?.substringBefore("')") } @@ -641,6 +649,7 @@ fun decodeIndexJson(json: String): String { val slug = json.reversed().substring(24) return base64Decode(slug.substring(0, slug.length - 20)) } + fun String?.createSlug(): String? { return this?.replace(Regex("[!%:'?,]|( &)"), "")?.replace(" ", "-")?.lowercase() ?.replace("-–-", "-") @@ -650,18 +659,20 @@ fun getLanguage(str: String): String { return if (str.contains("(in_ID)")) "Indonesian" else str } -fun bytesToGigaBytes( number: Double ): Double = number / 1024000000 +fun bytesToGigaBytes(number: Double): Double = number / 1024000000 fun getKisskhTitle(str: String?): String? { return str?.replace(Regex("[^a-zA-Z\\d]"), "-") } fun getIndexQualityTags(str: String?): String { - return Regex("\\d{3,4}[pP]\\.?(.*?)\\.(mkv|mp4|avi)").find(str ?: "")?.groupValues?.getOrNull(1)?.replace(".", " ")?.trim() ?: "" + return Regex("\\d{3,4}[pP]\\.?(.*?)\\.(mkv|mp4|avi)").find(str ?: "")?.groupValues?.getOrNull(1) + ?.replace(".", " ")?.trim() ?: "" } fun getIndexQuality(str: String?): Int { - return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull() ?: Qualities.Unknown.value + return Regex("(\\d{3,4})[pP]").find(str ?: "")?.groupValues?.getOrNull(1)?.toIntOrNull() + ?: Qualities.Unknown.value } fun getQuality(str: String): Int { @@ -711,7 +722,7 @@ fun getDbgoLanguage(str: String): String { } } -fun String.encodeUrl() : String { +fun String.encodeUrl(): String { val url = URL(this) val uri = URI(url.protocol, url.userInfo, url.host, url.port, url.path, url.query, url.ref) return uri.toURL().toString()