mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
[Sora] fixed Sorastream subtitle
This commit is contained in:
parent
f6aa675ff4
commit
c6c247e238
3 changed files with 37 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 68
|
version = 69
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -625,8 +625,10 @@ object SoraExtractor : SoraStream() {
|
||||||
val doc = request.document
|
val doc = request.document
|
||||||
val script = doc.selectFirst("script:containsData(var isSingle)")?.data().toString()
|
val script = doc.selectFirst("script:containsData(var isSingle)")?.data().toString()
|
||||||
val sourcesData = Regex("listSE\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1)
|
val sourcesData = Regex("listSE\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1)
|
||||||
val sourcesDetail = Regex("linkDetails\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1)
|
val sourcesDetail =
|
||||||
val subSources = Regex("dSubtitles\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1)
|
Regex("linkDetails\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1)
|
||||||
|
val subSources =
|
||||||
|
Regex("dSubtitles\\s*=\\s?(.*?),[\\n|\\s]").find(script)?.groupValues?.get(1)
|
||||||
|
|
||||||
//Gson is shit, but i don't care
|
//Gson is shit, but i don't care
|
||||||
val sourcesJson = JsonParser().parse(sourcesData).asJsonObject
|
val sourcesJson = JsonParser().parse(sourcesData).asJsonObject
|
||||||
|
@ -824,7 +826,8 @@ object SoraExtractor : SoraStream() {
|
||||||
json?.subtitlingList?.map { sub ->
|
json?.subtitlingList?.map { sub ->
|
||||||
subtitleCallback.invoke(
|
subtitleCallback.invoke(
|
||||||
SubtitleFile(
|
SubtitleFile(
|
||||||
sub.language ?: "", sub.subtitlingUrl ?: return@map
|
getVipLanguage(sub.languageAbbr ?: return@map),
|
||||||
|
sub.subtitlingUrl ?: return@map
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -871,7 +874,8 @@ object SoraExtractor : SoraStream() {
|
||||||
|
|
||||||
val doc = app.get(url).document
|
val doc = app.get(url).document
|
||||||
val script = doc.selectFirst("script:containsData(const player =)")?.data() ?: return
|
val script = doc.selectFirst("script:containsData(const player =)")?.data() ?: return
|
||||||
val link = Regex("[\"|']file[\"|']:\\s?[\"|'](http.*?.(mp4|m3u8))[\"|'],").find(script)?.groupValues?.getOrNull(
|
val link =
|
||||||
|
Regex("[\"|']file[\"|']:\\s?[\"|'](http.*?.(mp4|m3u8))[\"|'],").find(script)?.groupValues?.getOrNull(
|
||||||
1
|
1
|
||||||
) ?: return
|
) ?: return
|
||||||
|
|
||||||
|
@ -893,7 +897,8 @@ object SoraExtractor : SoraStream() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Regex(""""file":\s+?"(\S+\.(vtt|srt))""").find(script)?.groupValues?.getOrNull(1)?.let { sub ->
|
Regex(""""file":\s+?"(\S+\.(vtt|srt))""").find(script)?.groupValues?.getOrNull(1)
|
||||||
|
?.let { sub ->
|
||||||
subtitleCallback.invoke(
|
subtitleCallback.invoke(
|
||||||
SubtitleFile(
|
SubtitleFile(
|
||||||
"English",
|
"English",
|
||||||
|
@ -1624,7 +1629,8 @@ object SoraExtractor : SoraStream() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val mediaLink = app.get(matchMedia?.first ?: return).document.selectFirst("a#jake1")?.attr("href")
|
val mediaLink =
|
||||||
|
app.get(matchMedia?.first ?: return).document.selectFirst("a#jake1")?.attr("href")
|
||||||
val detailDoc = app.get(mediaLink ?: return).document
|
val detailDoc = app.get(mediaLink ?: return).document
|
||||||
val media = detailDoc.selectFirst("div.entry-content pre span")?.text()
|
val media = detailDoc.selectFirst("div.entry-content pre span")?.text()
|
||||||
?.split("|")
|
?.split("|")
|
||||||
|
@ -1658,7 +1664,8 @@ object SoraExtractor : SoraStream() {
|
||||||
).document.selectFirst("a[rel=nofollow]")?.attr("href")
|
).document.selectFirst("a[rel=nofollow]")?.attr("href")
|
||||||
|
|
||||||
// val videoUrl = extractRebrandly(shortLink ?: return@apmapIndexed null )
|
// val videoUrl = extractRebrandly(shortLink ?: return@apmapIndexed null )
|
||||||
val quality = Regex("([0-9]{3,4})p").find(it.second)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
val quality =
|
||||||
|
Regex("([0-9]{3,4})p").find(it.second)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||||
val qualityName = it.second.replace("${quality}p", "").trim()
|
val qualityName = it.second.replace("${quality}p", "").trim()
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.lagradost.cloudstream3.network.WebViewResolver
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
import com.lagradost.cloudstream3.utils.SubtitleHelper
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import com.lagradost.nicehttp.RequestBodyTypes
|
import com.lagradost.nicehttp.RequestBodyTypes
|
||||||
import com.lagradost.nicehttp.requestCreator
|
import com.lagradost.nicehttp.requestCreator
|
||||||
|
@ -273,8 +274,8 @@ suspend fun bypassFdAds(url: String?): String? {
|
||||||
verify = false
|
verify = false
|
||||||
).document
|
).document
|
||||||
val json = lastDoc.select("form#landing input[name=newwpsafelink]").attr("value").let { base64Decode(it) }
|
val json = lastDoc.select("form#landing input[name=newwpsafelink]").attr("value").let { base64Decode(it) }
|
||||||
val finaJson = tryParseJson<FDAds>(json)?.linkr?.substringAfter("redirect=")?.let { base64Decode(it) }
|
val finalJson = tryParseJson<FDAds>(json)?.linkr?.substringAfter("redirect=")?.let { base64Decode(it) }
|
||||||
return tryParseJson<Safelink>(finaJson)?.safelink
|
return tryParseJson<Safelink>(finalJson)?.safelink
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun bypassHrefli(url: String): String? {
|
suspend fun bypassHrefli(url: String): String? {
|
||||||
|
@ -449,6 +450,16 @@ fun getFDoviesQuality(str: String): String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getVipLanguage(str: String): String {
|
||||||
|
return when (str) {
|
||||||
|
"in_ID" -> "Indonesian"
|
||||||
|
"pt" -> "Portuguese"
|
||||||
|
else -> str.split("_").first().let {
|
||||||
|
SubtitleHelper.fromTwoLettersToLanguage(it).toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun getBaseUrl(url: String): String {
|
fun getBaseUrl(url: String): String {
|
||||||
return URI(url).let {
|
return URI(url).let {
|
||||||
"${it.scheme}://${it.host}"
|
"${it.scheme}://${it.host}"
|
||||||
|
|
Loading…
Reference in a new issue