mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Merge branch 'master' of github.com:recloudstream/cloudstream
This commit is contained in:
commit
6e0ecfa1fb
7 changed files with 67 additions and 24 deletions
|
@ -18,31 +18,36 @@ open class Linkbox : ExtractorApi() {
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
) {
|
) {
|
||||||
val id = Regex("""(/file/|id=)(\S+)[&/?]""").find(url)?.groupValues?.get(2)
|
val id = Regex("""(?:/f/|/file/|\?id=)(\w+)""").find(url)?.groupValues?.get(1)
|
||||||
app.get("$mainUrl/api/open/get_url?itemId=$id", referer=url).parsedSafe<Responses>()?.data?.rList?.map { link ->
|
app.get("$mainUrl/api/file/detail?itemId=$id", referer = url)
|
||||||
callback.invoke(
|
.parsedSafe<Responses>()?.data?.itemInfo?.resolutionList?.map { link ->
|
||||||
ExtractorLink(
|
callback.invoke(
|
||||||
name,
|
ExtractorLink(
|
||||||
name,
|
name,
|
||||||
link.url,
|
name,
|
||||||
url,
|
link.url ?: return@map null,
|
||||||
getQualityFromName(link.resolution)
|
url,
|
||||||
|
getQualityFromName(link.resolution)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data class RList(
|
data class Resolutions(
|
||||||
@JsonProperty("url") val url: String,
|
@JsonProperty("url") val url: String? = null,
|
||||||
@JsonProperty("resolution") val resolution: String?,
|
@JsonProperty("resolution") val resolution: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class ItemInfo(
|
||||||
|
@JsonProperty("resolutionList") val resolutionList: ArrayList<Resolutions>? = arrayListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
data class Data(
|
data class Data(
|
||||||
@JsonProperty("rList") val rList: List<RList>?,
|
@JsonProperty("itemInfo") val itemInfo: ItemInfo? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class Responses(
|
data class Responses(
|
||||||
@JsonProperty("data") val data: Data?,
|
@JsonProperty("data") val data: Data? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,11 +35,13 @@ import com.lagradost.cloudstream3.mvvm.logError
|
||||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||||
import com.lagradost.cloudstream3.ui.subtitles.SaveCaptionStyle
|
import com.lagradost.cloudstream3.ui.subtitles.SaveCaptionStyle
|
||||||
import com.lagradost.cloudstream3.utils.EpisodeSkip
|
import com.lagradost.cloudstream3.utils.EpisodeSkip
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.isUsingMobileData
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLinkPlayList
|
import com.lagradost.cloudstream3.utils.ExtractorLinkPlayList
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorUri
|
import com.lagradost.cloudstream3.utils.ExtractorUri
|
||||||
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTwoLettersToLanguage
|
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromTwoLettersToLanguage
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.time.Duration
|
||||||
import javax.net.ssl.HttpsURLConnection
|
import javax.net.ssl.HttpsURLConnection
|
||||||
import javax.net.ssl.SSLContext
|
import javax.net.ssl.SSLContext
|
||||||
import javax.net.ssl.SSLSession
|
import javax.net.ssl.SSLSession
|
||||||
|
@ -535,15 +537,16 @@ class CS3IPlayer : IPlayer {
|
||||||
OkHttpDataSource.Factory(client).setUserAgent(USER_AGENT)
|
OkHttpDataSource.Factory(client).setUserAgent(USER_AGENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do no include empty referer, if the provider wants those they can use the header map.
|
||||||
|
val refererMap = if (link.referer.isBlank()) emptyMap() else mapOf("referer" to link.referer)
|
||||||
val headers = mapOf(
|
val headers = mapOf(
|
||||||
"referer" to link.referer,
|
|
||||||
"accept" to "*/*",
|
"accept" to "*/*",
|
||||||
"sec-ch-ua" to "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"",
|
"sec-ch-ua" to "\"Chromium\";v=\"91\", \" Not;A Brand\";v=\"99\"",
|
||||||
"sec-ch-ua-mobile" to "?0",
|
"sec-ch-ua-mobile" to "?0",
|
||||||
"sec-fetch-user" to "?1",
|
"sec-fetch-user" to "?1",
|
||||||
"sec-fetch-mode" to "navigate",
|
"sec-fetch-mode" to "navigate",
|
||||||
"sec-fetch-dest" to "video"
|
"sec-fetch-dest" to "video"
|
||||||
) + link.headers // Adds the headers from the provider, e.g Authorization
|
) + refererMap + link.headers // Adds the headers from the provider, e.g Authorization
|
||||||
|
|
||||||
return source.apply {
|
return source.apply {
|
||||||
setDefaultRequestProperties(headers)
|
setDefaultRequestProperties(headers)
|
||||||
|
@ -847,7 +850,7 @@ class CS3IPlayer : IPlayer {
|
||||||
Log.i(TAG, "loadExo")
|
Log.i(TAG, "loadExo")
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
val maxVideoHeight = settingsManager.getInt(
|
val maxVideoHeight = settingsManager.getInt(
|
||||||
context.getString(com.lagradost.cloudstream3.R.string.quality_pref_key),
|
context.getString(if (context.isUsingMobileData()) com.lagradost.cloudstream3.R.string.quality_pref_mobile_data_key else com.lagradost.cloudstream3.R.string.quality_pref_key),
|
||||||
Int.MAX_VALUE
|
Int.MAX_VALUE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.lagradost.cloudstream3.R
|
||||||
import com.lagradost.cloudstream3.mvvm.logError
|
import com.lagradost.cloudstream3.mvvm.logError
|
||||||
import com.lagradost.cloudstream3.ui.player.GeneratorPlayer.Companion.subsProvidersIsActive
|
import com.lagradost.cloudstream3.ui.player.GeneratorPlayer.Companion.subsProvidersIsActive
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.isUsingMobileData
|
||||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||||
|
@ -1246,9 +1247,8 @@ open class FullScreenPlayer : AbstractPlayerFragment() {
|
||||||
ctx.getString(R.string.double_tap_pause_enabled_key),
|
ctx.getString(R.string.double_tap_pause_enabled_key),
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
currentPrefQuality = settingsManager.getInt(
|
currentPrefQuality = settingsManager.getInt(
|
||||||
ctx.getString(R.string.quality_pref_key),
|
ctx.getString(if (ctx.isUsingMobileData()) R.string.quality_pref_mobile_data_key else R.string.quality_pref_key),
|
||||||
currentPrefQuality
|
currentPrefQuality
|
||||||
)
|
)
|
||||||
// useSystemBrightness =
|
// useSystemBrightness =
|
||||||
|
|
|
@ -113,6 +113,30 @@ class SettingsPlayer : PreferenceFragmentCompat() {
|
||||||
return@setOnPreferenceClickListener true
|
return@setOnPreferenceClickListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPref(R.string.quality_pref_mobile_data_key)?.setOnPreferenceClickListener {
|
||||||
|
val prefValues = Qualities.values().map { it.value }.reversed().toMutableList()
|
||||||
|
prefValues.remove(Qualities.Unknown.value)
|
||||||
|
|
||||||
|
val prefNames = prefValues.map { Qualities.getStringByInt(it) }
|
||||||
|
|
||||||
|
val currentQuality =
|
||||||
|
settingsManager.getInt(
|
||||||
|
getString(R.string.quality_pref_mobile_data_key),
|
||||||
|
Qualities.values().last().value
|
||||||
|
)
|
||||||
|
|
||||||
|
activity?.showBottomDialog(
|
||||||
|
prefNames.toList(),
|
||||||
|
prefValues.indexOf(currentQuality),
|
||||||
|
getString(R.string.watch_quality_pref_data),
|
||||||
|
true,
|
||||||
|
{}) {
|
||||||
|
settingsManager.edit().putInt(getString(R.string.quality_pref_mobile_data_key), prefValues[it])
|
||||||
|
.apply()
|
||||||
|
}
|
||||||
|
return@setOnPreferenceClickListener true
|
||||||
|
}
|
||||||
|
|
||||||
getPref(R.string.player_pref_key)?.setOnPreferenceClickListener {
|
getPref(R.string.player_pref_key)?.setOnPreferenceClickListener {
|
||||||
val prefNames = resources.getStringArray(R.array.player_pref_names)
|
val prefNames = resources.getStringArray(R.array.player_pref_names)
|
||||||
val prefValues = resources.getIntArray(R.array.player_pref_values)
|
val prefValues = resources.getIntArray(R.array.player_pref_values)
|
||||||
|
|
|
@ -776,8 +776,13 @@ object AppUtils {
|
||||||
return networkInfo.any {
|
return networkInfo.any {
|
||||||
conManager.getNetworkCapabilities(it)
|
conManager.getNetworkCapabilities(it)
|
||||||
?.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) == true
|
?.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) == true
|
||||||
|
} &&
|
||||||
|
!networkInfo.any {
|
||||||
|
conManager.getNetworkCapabilities(it)
|
||||||
|
?.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) == true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun Activity?.cacheClass(clazz: String?) {
|
private fun Activity?.cacheClass(clazz: String?) {
|
||||||
clazz?.let { c ->
|
clazz?.let { c ->
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<string name="test_providers_key" translatable="false">test_providers_key</string>
|
<string name="test_providers_key" translatable="false">test_providers_key</string>
|
||||||
<string name="subtitle_settings_chromecast_key" translatable="false">subtitle_settings_chromecast_key</string>
|
<string name="subtitle_settings_chromecast_key" translatable="false">subtitle_settings_chromecast_key</string>
|
||||||
<string name="quality_pref_key" translatable="false">quality_pref_key</string>
|
<string name="quality_pref_key" translatable="false">quality_pref_key</string>
|
||||||
|
<string name="quality_pref_mobile_data_key" translatable="false">quality_pref_mobile_data_key</string>
|
||||||
<string name="player_pref_key" translatable="false">player_pref_key</string>
|
<string name="player_pref_key" translatable="false">player_pref_key</string>
|
||||||
<string name="prefer_limit_title_key" translatable="false">prefer_limit_title_key</string>
|
<string name="prefer_limit_title_key" translatable="false">prefer_limit_title_key</string>
|
||||||
<string name="prefer_limit_title_rez_key" translatable="false">prefer_limit_title_rez_key</string>
|
<string name="prefer_limit_title_rez_key" translatable="false">prefer_limit_title_rez_key</string>
|
||||||
|
@ -364,7 +365,8 @@
|
||||||
<string name="dont_show_again">Don\'t show again</string>
|
<string name="dont_show_again">Don\'t show again</string>
|
||||||
<string name="skip_update">Skip this Update</string>
|
<string name="skip_update">Skip this Update</string>
|
||||||
<string name="update">Update</string>
|
<string name="update">Update</string>
|
||||||
<string name="watch_quality_pref">Preferred watch quality</string>
|
<string name="watch_quality_pref">Preferred watch quality (WiFi)</string>
|
||||||
|
<string name="watch_quality_pref_data">Preferred watch quality (Mobile Data)</string>
|
||||||
<string name="limit_title">Video player title max chars</string>
|
<string name="limit_title">Video player title max chars</string>
|
||||||
<string name="limit_title_rez">Video player resolution</string>
|
<string name="limit_title_rez">Video player resolution</string>
|
||||||
<string name="video_buffer_size_settings">Video buffer size</string>
|
<string name="video_buffer_size_settings">Video buffer size</string>
|
||||||
|
@ -655,4 +657,4 @@
|
||||||
<string name="subscription_new">Subscribed to %s</string>
|
<string name="subscription_new">Subscribed to %s</string>
|
||||||
<string name="subscription_deleted">Unsubscribed from %s</string>
|
<string name="subscription_deleted">Unsubscribed from %s</string>
|
||||||
<string name="subscription_episode_released">Episode %d released!</string>
|
<string name="subscription_episode_released">Episode %d released!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
android:icon="@drawable/ic_baseline_hd_24"
|
android:icon="@drawable/ic_baseline_hd_24"
|
||||||
android:key="@string/quality_pref_key"
|
android:key="@string/quality_pref_key"
|
||||||
android:title="@string/watch_quality_pref" />
|
android:title="@string/watch_quality_pref" />
|
||||||
|
<Preference
|
||||||
|
android:icon="@drawable/ic_baseline_hd_24"
|
||||||
|
android:key="@string/quality_pref_mobile_data_key"
|
||||||
|
android:title="@string/watch_quality_pref_data" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:icon="@drawable/netflix_play"
|
android:icon="@drawable/netflix_play"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue