forked from recloudstream/cloudstream
quality stuff
This commit is contained in:
parent
96c074e87b
commit
b942e066ee
3 changed files with 43 additions and 49 deletions
|
@ -36,7 +36,7 @@ android {
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
|
|
||||||
versionCode 45
|
versionCode 45
|
||||||
versionName "2.9.19"
|
versionName "2.9.20"
|
||||||
|
|
||||||
resValue "string", "app_version",
|
resValue "string", "app_version",
|
||||||
"${defaultConfig.versionName}${versionNameSuffix ?: ""}"
|
"${defaultConfig.versionName}${versionNameSuffix ?: ""}"
|
||||||
|
|
|
@ -799,7 +799,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
|
||||||
val builder = AlertDialog.Builder(requireContext(), R.style.AlertDialogCustom)
|
val builder = AlertDialog.Builder(requireContext(), R.style.AlertDialogCustom)
|
||||||
|
|
||||||
builder.setTitle(title)
|
builder.setTitle(title)
|
||||||
builder.setItems(links.map { it.name }.toTypedArray()) { dia, which ->
|
builder.setItems(links.map { "${it.name} ${Qualities.getStringByInt(it.quality)}" }.toTypedArray()) { dia, which ->
|
||||||
callback.invoke(links[which])
|
callback.invoke(links[which])
|
||||||
dia?.dismiss()
|
dia?.dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,18 +22,18 @@ data class ExtractorLink(
|
||||||
) : VideoDownloadManager.IDownloadableMinimum
|
) : VideoDownloadManager.IDownloadableMinimum
|
||||||
|
|
||||||
data class ExtractorUri(
|
data class ExtractorUri(
|
||||||
val uri : Uri,
|
val uri: Uri,
|
||||||
val name : String,
|
val name: String,
|
||||||
|
|
||||||
val basePath: String? = null,
|
val basePath: String? = null,
|
||||||
val relativePath: String? = null,
|
val relativePath: String? = null,
|
||||||
val displayName: String? = null,
|
val displayName: String? = null,
|
||||||
|
|
||||||
val id : Int? = null,
|
val id: Int? = null,
|
||||||
val parentId : Int? = null,
|
val parentId: Int? = null,
|
||||||
val episode : Int? = null,
|
val episode: Int? = null,
|
||||||
val season : Int? = null,
|
val season: Int? = null,
|
||||||
val headerName : String? = null,
|
val headerName: String? = null,
|
||||||
val tvType: TvType? = null,
|
val tvType: TvType? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,44 +45,36 @@ data class ExtractorSubtitleLink(
|
||||||
) : VideoDownloadManager.IDownloadableMinimum
|
) : VideoDownloadManager.IDownloadableMinimum
|
||||||
|
|
||||||
enum class Qualities(var value: Int) {
|
enum class Qualities(var value: Int) {
|
||||||
Unknown(0),
|
Unknown(400),
|
||||||
P360(-2), // 360p
|
P144(144), // 144p
|
||||||
P480(-1), // 480p
|
P240(240), // 240p
|
||||||
P720(1), // 720p
|
P360(360), // 360p
|
||||||
P1080(2), // 1080p
|
P480(480), // 480p
|
||||||
P1440(3), // 1440p
|
P720(720), // 720p
|
||||||
P2160(4); // 4k or 2160p
|
P1080(1080), // 1080p
|
||||||
|
P1440(1440), // 1440p
|
||||||
|
P2160(2160); // 4k or 2160p
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getStringByInt(qual: Int?) : String {
|
fun getStringByInt(qual: Int?): String {
|
||||||
return when (qual) {
|
return when (qual) {
|
||||||
P360.value -> "360p"
|
Unknown.value -> ""
|
||||||
P480.value -> "480p"
|
P2160.value -> "4K"
|
||||||
P720.value -> "720p"
|
else -> "${qual}p"
|
||||||
P1080.value -> "1080p"
|
|
||||||
P1440.value -> "1440p"
|
|
||||||
P2160.value -> "2160p/4k"
|
|
||||||
else -> ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getQualityFromName(qualityName: String?): Int {
|
fun getQualityFromName(qualityName: String?): Int {
|
||||||
if (qualityName == null) {
|
if (qualityName == null)
|
||||||
return Qualities.Unknown.value
|
return Qualities.Unknown.value
|
||||||
}
|
|
||||||
return when (qualityName.replace("p", "").replace("P", "").trim()) {
|
val match = qualityName.lowercase().replace("p", "").trim()
|
||||||
"360" -> Qualities.P360
|
return when (match) {
|
||||||
"480" -> Qualities.P480
|
|
||||||
"720" -> Qualities.P720
|
|
||||||
"1080" -> Qualities.P1080
|
|
||||||
"1440" -> Qualities.P1440
|
|
||||||
"2160" -> Qualities.P2160
|
|
||||||
"4k" -> Qualities.P2160
|
"4k" -> Qualities.P2160
|
||||||
"4K" -> Qualities.P2160
|
else -> null
|
||||||
else -> Qualities.Unknown
|
}?.value ?: match.toIntOrNull() ?: Qualities.Unknown.value
|
||||||
}.value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val packedRegex = Regex("""eval\(function\(p,a,c,k,e,.*\)\)""")
|
private val packedRegex = Regex("""eval\(function\(p,a,c,k,e,.*\)\)""")
|
||||||
|
@ -98,7 +90,11 @@ fun getAndUnpack(string: String): String {
|
||||||
/**
|
/**
|
||||||
* Tries to load the appropriate extractor based on link, returns true if any extractor is loaded.
|
* Tries to load the appropriate extractor based on link, returns true if any extractor is loaded.
|
||||||
* */
|
* */
|
||||||
suspend fun loadExtractor(url: String, referer: String? = null, callback: (ExtractorLink) -> Unit) : Boolean {
|
suspend fun loadExtractor(
|
||||||
|
url: String,
|
||||||
|
referer: String? = null,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
): Boolean {
|
||||||
for (extractor in extractorApis) {
|
for (extractor in extractorApis) {
|
||||||
if (url.startsWith(extractor.mainUrl)) {
|
if (url.startsWith(extractor.mainUrl)) {
|
||||||
extractor.getSafeUrl(url, referer)?.forEach(callback)
|
extractor.getSafeUrl(url, referer)?.forEach(callback)
|
||||||
|
@ -136,19 +132,19 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
|
||||||
StreamSB8(),
|
StreamSB8(),
|
||||||
StreamSB9(),
|
StreamSB9(),
|
||||||
StreamSB10(),
|
StreamSB10(),
|
||||||
// Streamhub(), cause Streamhub2() works
|
// Streamhub(), cause Streamhub2() works
|
||||||
Streamhub2(),
|
Streamhub2(),
|
||||||
|
|
||||||
FEmbed(),
|
FEmbed(),
|
||||||
FeHD(),
|
FeHD(),
|
||||||
Fplayer(),
|
Fplayer(),
|
||||||
// WatchSB(), 'cause StreamSB.kt works
|
// WatchSB(), 'cause StreamSB.kt works
|
||||||
Uqload(),
|
Uqload(),
|
||||||
Uqload1(),
|
Uqload1(),
|
||||||
Evoload(),
|
Evoload(),
|
||||||
Evoload1(),
|
Evoload1(),
|
||||||
VoeExtractor(),
|
VoeExtractor(),
|
||||||
// UpstreamExtractor(), GenericM3U8.kt works
|
// UpstreamExtractor(), GenericM3U8.kt works
|
||||||
|
|
||||||
Tomatomatela(),
|
Tomatomatela(),
|
||||||
Cinestart(),
|
Cinestart(),
|
||||||
|
@ -162,17 +158,17 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
|
||||||
|
|
||||||
AsianLoad(),
|
AsianLoad(),
|
||||||
|
|
||||||
// GenericM3U8(),
|
// GenericM3U8(),
|
||||||
Jawcloud(),
|
Jawcloud(),
|
||||||
Zplayer(),
|
Zplayer(),
|
||||||
ZplayerV2(),
|
ZplayerV2(),
|
||||||
Upstream(),
|
Upstream(),
|
||||||
|
|
||||||
|
|
||||||
// StreamSB.kt works
|
// StreamSB.kt works
|
||||||
// SBPlay(),
|
// SBPlay(),
|
||||||
// SBPlay1(),
|
// SBPlay1(),
|
||||||
// SBPlay2(),
|
// SBPlay2(),
|
||||||
|
|
||||||
PlayerVoxzer(),
|
PlayerVoxzer(),
|
||||||
)
|
)
|
||||||
|
@ -192,7 +188,7 @@ fun httpsify(url: String): String {
|
||||||
return if (url.startsWith("//")) "https:$url" else url
|
return if (url.startsWith("//")) "https:$url" else url
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getPostForm(requestUrl : String, html : String) : String? {
|
suspend fun getPostForm(requestUrl: String, html: String): String? {
|
||||||
val document = Jsoup.parse(html)
|
val document = Jsoup.parse(html)
|
||||||
val inputs = document.select("Form > input")
|
val inputs = document.select("Form > input")
|
||||||
if (inputs.size < 4) return null
|
if (inputs.size < 4) return null
|
||||||
|
@ -216,7 +212,7 @@ suspend fun getPostForm(requestUrl : String, html : String) : String? {
|
||||||
}
|
}
|
||||||
delay(5000) // ye this is needed, wont work with 0 delay
|
delay(5000) // ye this is needed, wont work with 0 delay
|
||||||
|
|
||||||
val postResponse = app.post(
|
return app.post(
|
||||||
requestUrl,
|
requestUrl,
|
||||||
headers = mapOf(
|
headers = mapOf(
|
||||||
"content-type" to "application/x-www-form-urlencoded",
|
"content-type" to "application/x-www-form-urlencoded",
|
||||||
|
@ -226,8 +222,6 @@ suspend fun getPostForm(requestUrl : String, html : String) : String? {
|
||||||
),
|
),
|
||||||
data = mapOf("op" to op, "id" to id, "mode" to mode, "hash" to hash)
|
data = mapOf("op" to op, "id" to id, "mode" to mode, "hash" to hash)
|
||||||
).text
|
).text
|
||||||
|
|
||||||
return postResponse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class ExtractorApi {
|
abstract class ExtractorApi {
|
||||||
|
|
Loading…
Reference in a new issue