[Sora] added oiya into FDMovies

This commit is contained in:
hexated 2022-12-12 20:24:46 +07:00
parent d9772ce517
commit a2c0a1a5ec
3 changed files with 53 additions and 16 deletions

View file

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

View file

@ -1388,21 +1388,37 @@ object SoraExtractor : SoraStream() {
} }
val request = app.get(url) val request = app.get(url)
if(!request.isSuccessful) return if (!request.isSuccessful) return
val iframe = request.document.select("div#download tbody tr").map { it } val iframe = request.document.select("div#download tbody tr").map {
.filter { it.select("img").attr("src").contains("gdtot") }.map { FDMovieIFrame(
Triple(
it.select("a").attr("href"), it.select("a").attr("href"),
it.select("strong.quality").text(), it.select("strong.quality").text(),
it.select("td:nth-child(4)").text() it.select("td:nth-child(4)").text(),
it.select("img").attr("src")
) )
}.filter { it.second.contains("1080p", true) || it.second.contains("4k", true) } }.filter {
Log.i("fdMoviesAPI", "$iframe") (it.quality.contains("1080p", true) || it.quality.contains(
iframe.apmap { (link, quality, size) -> "4k",
true
)) && (it.type.contains("gdtot") || it.type.contains("oiya"))
}
Log.i("hexated", "$iframe")
iframe.apmap { (link, quality, size, type) ->
val qualities = getFDoviesQuality(quality)
val fdLink = bypassFdAds(link) val fdLink = bypassFdAds(link)
val videoLink = when {
type.contains("gdtot") -> {
val gdBotLink = extractGdbot(fdLink ?: return@apmap null) val gdBotLink = extractGdbot(fdLink ?: return@apmap null)
val videoLink = extractDrivebot(gdBotLink ?: return@apmap null) extractDrivebot(gdBotLink ?: return@apmap null)
}
type.contains("oiya") -> {
extractOiya(fdLink ?: return@apmap null, qualities)
}
else -> {
return@apmap null
}
}
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
@ -1410,7 +1426,7 @@ object SoraExtractor : SoraStream() {
"FDMovies [$size]", "FDMovies [$size]",
videoLink ?: return@apmap null, videoLink ?: return@apmap null,
"", "",
getGMoviesQuality(quality) getQualityFromName(qualities)
) )
) )
} }
@ -1588,6 +1604,13 @@ class StreamM4u: XStreamCdn() {
override val mainUrl: String = "https://streamm4u.club" override val mainUrl: String = "https://streamm4u.club"
} }
data class FDMovieIFrame(
val link: String,
val quality: String,
val size: String,
val type: String,
)
data class UHDBackupUrl( data class UHDBackupUrl(
@JsonProperty("url") val url: String? = null, @JsonProperty("url") val url: String? = null,
) )

View file

@ -195,6 +195,12 @@ suspend fun extractDrivebot(url: String): String? {
return tryParseJson<DriveBotLink>(result)?.url return tryParseJson<DriveBotLink>(result)?.url
} }
suspend fun extractOiya(url: String, quality: String): String? {
val doc = app.get(url).document
return doc.selectFirst("div.wp-block-button a:matches((?i)$quality)")?.attr("href")
?: doc.selectFirst("div.wp-block-button a")?.attr("href")
}
suspend fun bypassFdAds(url: String): String? { suspend fun bypassFdAds(url: String): String? {
val res = app.get(url).document val res = app.get(url).document
val freeRedirect = res.selectFirst("a#link")?.attr("href") val freeRedirect = res.selectFirst("a#link")?.attr("href")
@ -333,7 +339,7 @@ fun getGMoviesQuality(str: String): Int {
return when { return when {
str.contains("480P", true) -> Qualities.P480.value str.contains("480P", true) -> Qualities.P480.value
str.contains("720P", true) -> Qualities.P720.value str.contains("720P", true) -> Qualities.P720.value
str.contains("1080", true) -> Qualities.P1080.value str.contains("1080P", true) -> Qualities.P1080.value
str.contains("4K", true) -> Qualities.P2160.value str.contains("4K", true) -> Qualities.P2160.value
else -> Qualities.Unknown.value else -> Qualities.Unknown.value
} }
@ -349,6 +355,14 @@ fun getSoraQuality(quality: String): Int {
} }
} }
fun getFDoviesQuality(str: String): String {
return when {
str.contains("1080P", true) -> "1080P"
str.contains("4K", true) -> "4K"
else -> ""
}
}
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}"