mirror of
https://github.com/recloudstream/cloudstream.git
synced 2026-07-15 00:45:58 +00:00
Compare commits
56 commits
fix-sync-l
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb8bcb4ac7 |
||
|
|
c09c06820d |
||
|
|
3650221334 |
||
|
|
c66b0eadd6 |
||
|
|
804b3c279c |
||
|
|
feddcccf0d |
||
|
|
15fea0c7ca |
||
|
|
d778befe19 |
||
|
|
076e7a5116 |
||
|
|
ecf5650bbd |
||
|
|
b245a2d9d7 |
||
|
|
b1ce67dbf3 |
||
|
|
eef67fa699 |
||
|
|
86d713c33c |
||
|
|
45a795f25f |
||
|
|
e2d49567b6 |
||
|
|
105f168b2d |
||
|
|
0859285e43 |
||
|
|
2a75b8cb08 |
||
|
|
737135fcb7 |
||
|
|
7b3c938ba7 |
||
|
|
07dbc848ee |
||
|
|
15632b864a |
||
|
|
8f1317c82c |
||
|
|
505722c1b5 |
||
|
|
024d2a5c7f |
||
|
|
70469f55db |
||
|
|
9f64b6da29 |
||
|
|
c265d630ac |
||
|
|
11792dd65c |
||
|
|
4a79ca1c9f |
||
|
|
3496e5f8d2 |
||
|
|
5cd1cb3433 |
||
|
|
f03b18ff95 |
||
|
|
0af9b7f569 |
||
|
|
1463cf40cd |
||
|
|
3e17b3a5a0 |
||
|
|
8c3dbdc5b6 |
||
|
|
5b0c5afeba |
||
|
|
e75b5e64a7 |
||
|
|
c36652d265 |
||
|
|
b681d443e4 |
||
|
|
189162fac9 |
||
|
|
3796406e63 |
||
|
|
8bdc599996 |
||
|
|
0e3191e28b |
||
|
|
11202d269d |
||
|
|
07b4d2d576 |
||
|
|
66afc3b1ee |
||
|
|
e428d422eb |
||
|
|
59eaed0c82 |
||
|
|
694c9c4413 |
||
|
|
480d48bea4 |
||
|
|
a123c5935c |
||
|
|
5cb939df69 |
||
|
|
60cfeba735 |
128 changed files with 15849 additions and 2246 deletions
5
.github/workflows/pull_request.yml
vendored
5
.github/workflows/pull_request.yml
vendored
|
|
@ -26,6 +26,11 @@ jobs:
|
||||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||||
cache-read-only: false
|
cache-read-only: false
|
||||||
|
|
||||||
|
- name: Ensure binary compatibility
|
||||||
|
# This is to ensure that your code is backwards compatible.
|
||||||
|
# If this fails you need to add a @Prerelease annotation to new code.
|
||||||
|
run: ./gradlew library:checkKotlinAbi
|
||||||
|
|
||||||
- name: Run Gradle
|
- name: Run Gradle
|
||||||
run: ./gradlew assemblePrereleaseDebug lint check
|
run: ./gradlew assemblePrereleaseDebug lint check
|
||||||
|
|
||||||
|
|
|
||||||
21
COMPOSE.md
Normal file
21
COMPOSE.md
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Migration guide to Compose
|
||||||
|
|
||||||
|
### 1. MVI instead of MVVM
|
||||||
|
|
||||||
|
The current design of CloudStream loosely uses the MVVM architecture.
|
||||||
|
|
||||||
|
This means that the UI invokes the viewmodel with function calls, and it responds with LiveData fields that are observed. While this has worked, it generates a lot of boilerplate and has created some friction.
|
||||||
|
|
||||||
|
To make it easier to work with Compose, the new architecture will be based on MVI. In short this means that the viewmodel exposes a singular immutable class that is observed, and receives all UI events with a singular event that is a sealed class. All the UI should be able to be recreated based on this singular state class, and all interactions should be able to be replayed using only the event callback.
|
||||||
|
|
||||||
|
For a more detailed overview, see: https://www.youtube.com/watch?v=b2z1jvD4VMQ
|
||||||
|
|
||||||
|
This is part of the effort to make CloudStream cross platform, as it allows us to decouple UI and logic.
|
||||||
|
|
||||||
|
### 2. KMP-compatible libraries
|
||||||
|
|
||||||
|
We plan to leverage Kotlin's KMP project to compile our code to different architectures. However, this requires us to only use KMP-compatible libraries, no Java. Therefore any pull requests must ensure that they use KMP-compatible libraries only.
|
||||||
|
|
||||||
|
### 3. UI Changes
|
||||||
|
|
||||||
|
While migrating to the new compose UI, you also have the opportunity to change the UI. However, this should only be to freshen up the UI, not completely redesign it. It is also important to stress that this process should not lose any features of the old UI, and be very conservative with adding new features.
|
||||||
|
|
@ -323,11 +323,9 @@ tasks.withType<KotlinJvmCompile> {
|
||||||
compilerOptions {
|
compilerOptions {
|
||||||
jvmTarget.set(javaTarget)
|
jvmTarget.set(javaTarget)
|
||||||
jvmDefault.set(JvmDefaultMode.ENABLE)
|
jvmDefault.set(JvmDefaultMode.ENABLE)
|
||||||
freeCompilerArgs.add("-Xannotation-default-target=param-property")
|
|
||||||
optIn.addAll(
|
optIn.addAll(
|
||||||
"com.lagradost.cloudstream3.InternalAPI",
|
"com.lagradost.cloudstream3.InternalAPI",
|
||||||
"com.lagradost.cloudstream3.Prerelease",
|
"com.lagradost.cloudstream3.Prerelease",
|
||||||
"kotlin.uuid.ExperimentalUuidApi",
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,157 +0,0 @@
|
||||||
package com.lagradost.cloudstream3.utils.serializers
|
|
||||||
|
|
||||||
import android.net.Uri
|
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
|
||||||
import kotlinx.serialization.KeepGeneratedSerializer
|
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
import org.junit.Assert.assertEquals
|
|
||||||
import org.junit.Assert.assertFalse
|
|
||||||
import org.junit.Assert.assertNull
|
|
||||||
import org.junit.Assert.assertTrue
|
|
||||||
import org.junit.Test
|
|
||||||
|
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
|
||||||
@KeepGeneratedSerializer
|
|
||||||
@Serializable(with = NonEmptyData.Serializer::class)
|
|
||||||
data class NonEmptyData(
|
|
||||||
val title: String = "",
|
|
||||||
val tags: List<String> = emptyList(),
|
|
||||||
val meta: Map<String, String> = emptyMap(),
|
|
||||||
val name: String = "hello",
|
|
||||||
) {
|
|
||||||
object Serializer : NonEmptySerializer<NonEmptyData>(NonEmptyData.generatedSerializer())
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
|
||||||
@KeepGeneratedSerializer
|
|
||||||
@Serializable(with = WriteOnlyData.Serializer::class)
|
|
||||||
data class WriteOnlyData(
|
|
||||||
val fieldA: String = "",
|
|
||||||
val fieldB: String = "",
|
|
||||||
) {
|
|
||||||
object Serializer : WriteOnlySerializer<WriteOnlyData>(
|
|
||||||
WriteOnlyData.generatedSerializer(),
|
|
||||||
setOf("fieldB"),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
|
||||||
@KeepGeneratedSerializer
|
|
||||||
@Serializable(with = MultiWriteOnly.Serializer::class)
|
|
||||||
data class MultiWriteOnly(
|
|
||||||
val fieldA: String = "",
|
|
||||||
val fieldB: String = "",
|
|
||||||
val fieldC: String = "",
|
|
||||||
) {
|
|
||||||
object Serializer : WriteOnlySerializer<MultiWriteOnly>(
|
|
||||||
MultiWriteOnly.generatedSerializer(),
|
|
||||||
setOf("fieldB", "fieldC"),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class UriData(
|
|
||||||
@Serializable(with = UriSerializer::class)
|
|
||||||
val uri: Uri = Uri.EMPTY,
|
|
||||||
)
|
|
||||||
|
|
||||||
class SerializerTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun nonEmptySerializerOmitsEmptyStrings() {
|
|
||||||
val data = NonEmptyData(title = "", name = "hello")
|
|
||||||
val result = data.toJson()
|
|
||||||
assertFalse(result.contains("title"))
|
|
||||||
assertTrue(result.contains("name"))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun nonEmptySerializerOmitsEmptyLists() {
|
|
||||||
val data = NonEmptyData(tags = emptyList(), name = "hello")
|
|
||||||
val result = data.toJson()
|
|
||||||
assertFalse(result.contains("tags"))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun nonEmptySerializerOmitsEmptyMaps() {
|
|
||||||
val data = NonEmptyData(meta = emptyMap(), name = "hello")
|
|
||||||
val result = data.toJson()
|
|
||||||
assertFalse(result.contains("meta"))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun nonEmptySerializerKeepsNonEmptyFields() {
|
|
||||||
val data = NonEmptyData(title = "hello", tags = listOf("a"), meta = mapOf("k" to "v"))
|
|
||||||
val result = data.toJson()
|
|
||||||
assertTrue(result.contains("title"))
|
|
||||||
assertTrue(result.contains("tags"))
|
|
||||||
assertTrue(result.contains("meta"))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun nonEmptySerializerDoesNotAffectDeserialization() {
|
|
||||||
val input = """{"title":"hello","tags":["a"],"meta":{"k":"v"},"name":"world"}"""
|
|
||||||
val result = parseJson<NonEmptyData>(input)
|
|
||||||
assertEquals("hello", result.title)
|
|
||||||
assertEquals(listOf("a"), result.tags)
|
|
||||||
assertEquals(mapOf("k" to "v"), result.meta)
|
|
||||||
assertEquals("world", result.name)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun writeOnlySerializerOmitsFieldOnSerialize() {
|
|
||||||
val data = WriteOnlyData(fieldA = "hello", fieldB = "secret")
|
|
||||||
val result = data.toJson()
|
|
||||||
assertTrue(result.contains("fieldA"))
|
|
||||||
assertFalse(result.contains("fieldB"))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun writeOnlySerializerDeserializesNormally() {
|
|
||||||
val input = """{"fieldA":"hello","fieldB":"secret"}"""
|
|
||||||
val result = parseJson<WriteOnlyData>(input)
|
|
||||||
assertEquals("hello", result.fieldA)
|
|
||||||
assertEquals("secret", result.fieldB)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun writeOnlySerializerDeserializesMissingAsDefault() {
|
|
||||||
val input = """{"fieldA":"hello"}"""
|
|
||||||
val result = parseJson<WriteOnlyData>(input)
|
|
||||||
assertEquals("hello", result.fieldA)
|
|
||||||
assertEquals("", result.fieldB)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun writeOnlySerializerHandlesMultipleKeys() {
|
|
||||||
val data = MultiWriteOnly(fieldA = "hello", fieldB = "secret1", fieldC = "secret2")
|
|
||||||
val result = data.toJson()
|
|
||||||
assertTrue(result.contains("fieldA"))
|
|
||||||
assertFalse(result.contains("fieldB"))
|
|
||||||
assertFalse(result.contains("fieldC"))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun uriSerializerSerializesUriToString() {
|
|
||||||
val data = UriData(uri = Uri.parse("https://example.com/path?query=1"))
|
|
||||||
val result = data.toJson()
|
|
||||||
assertTrue(result.contains("https://example.com/path?query=1"))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun uriSerializerDeserializesStringToUri() {
|
|
||||||
val input = """{"uri":"https://example.com/path?query=1"}"""
|
|
||||||
val result = parseJson<UriData>(input)
|
|
||||||
assertEquals(Uri.parse("https://example.com/path?query=1"), result.uri)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun uriSerializerRoundtripsCorrectly() {
|
|
||||||
val data = UriData(uri = Uri.parse("https://example.com/path?query=1"))
|
|
||||||
val encoded = data.toJson()
|
|
||||||
val decoded = parseJson<UriData>(encoded)
|
|
||||||
assertEquals(data.uri, decoded.uri)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.lagradost.cloudstream3.utils.serializers
|
||||||
|
|
||||||
|
import android.net.Uri
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class UriData(
|
||||||
|
@Serializable(with = UriSerializer::class)
|
||||||
|
@SerialName("uri") val uri: Uri = Uri.EMPTY,
|
||||||
|
)
|
||||||
|
|
||||||
|
class UriSerializerTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun uriSerializerSerializesUriToString() {
|
||||||
|
val data = UriData(uri = Uri.parse("https://example.com/path?query=1"))
|
||||||
|
val result = data.toJson()
|
||||||
|
assertTrue(result.contains("https://example.com/path?query=1"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun uriSerializerDeserializesStringToUri() {
|
||||||
|
val input = """{"uri":"https://example.com/path?query=1"}"""
|
||||||
|
val result = parseJson<UriData>(input)
|
||||||
|
assertEquals(Uri.parse("https://example.com/path?query=1"), result.uri)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun uriSerializerRoundtripsCorrectly() {
|
||||||
|
val data = UriData(uri = Uri.parse("https://example.com/path?query=1"))
|
||||||
|
val encoded = data.toJson()
|
||||||
|
val decoded = parseJson<UriData>(encoded)
|
||||||
|
assertEquals(data.uri, decoded.uri)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -113,7 +113,7 @@ class CloudStreamApp : Application(), SingletonImageLoader.Factory {
|
||||||
get() = _context?.get()
|
get() = _context?.get()
|
||||||
private set(value) {
|
private set(value) {
|
||||||
_context = WeakReference(value)
|
_context = WeakReference(value)
|
||||||
setContext(WeakReference(value))
|
setContext(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T : Any> getKeyClass(path: String, valueType: Class<T>): T? {
|
fun <T : Any> getKeyClass(path: String, valueType: Class<T>): T? {
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,7 @@ import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.requestRW
|
import com.lagradost.cloudstream3.utils.UIHelper.requestRW
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.setNavigationBarColorCompat
|
import com.lagradost.cloudstream3.utils.UIHelper.setNavigationBarColorCompat
|
||||||
|
import com.lagradost.cloudstream3.utils.UIHelper.showProgress
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
||||||
import com.lagradost.cloudstream3.utils.USER_PROVIDER_API
|
import com.lagradost.cloudstream3.utils.USER_PROVIDER_API
|
||||||
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
|
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
|
||||||
|
|
@ -1214,7 +1215,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
||||||
// backup when we update the app, I don't trust myself to not boot lock users, might want to make this a setting?
|
// backup when we update the app, I don't trust myself to not boot lock users, might want to make this a setting?
|
||||||
safe {
|
safe {
|
||||||
val appVer = BuildConfig.VERSION_NAME
|
val appVer = BuildConfig.VERSION_NAME
|
||||||
val lastAppAutoBackup: String = getKey("VERSION_NAME") ?: ""
|
val lastAppAutoBackup: String = getKey<String>("VERSION_NAME") ?: ""
|
||||||
if (appVer != lastAppAutoBackup) {
|
if (appVer != lastAppAutoBackup) {
|
||||||
setKey("VERSION_NAME", BuildConfig.VERSION_NAME)
|
setKey("VERSION_NAME", BuildConfig.VERSION_NAME)
|
||||||
if (lastAppAutoBackup.isEmpty()) return@safe
|
if (lastAppAutoBackup.isEmpty()) return@safe
|
||||||
|
|
@ -1428,8 +1429,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
resultviewPreviewBookmark.isEnabled = false
|
resultviewPreviewBookmark.isEnabled = false
|
||||||
resultviewPreviewBookmark.setIconResource(R.drawable.ic_baseline_bookmark_border_24)
|
resultviewPreviewBookmark.showProgress()
|
||||||
resultviewPreviewBookmark.setText(R.string.loading)
|
//resultviewPreviewBookmark.setIconResource(R.drawable.ic_baseline_bookmark_border_24)
|
||||||
|
//resultviewPreviewBookmark.setText(R.string.loading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2016,7 +2018,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (getKey(HAS_DONE_SETUP_KEY, false) != true) {
|
if (getKey<Boolean>(HAS_DONE_SETUP_KEY, false) != true) {
|
||||||
navController.navigate(R.id.navigation_setup_language)
|
navController.navigate(R.id.navigation_setup_language)
|
||||||
// If no plugins bring up extensions screen
|
// If no plugins bring up extensions screen
|
||||||
} else if (PluginManager.getPluginsOnline().isEmpty()
|
} else if (PluginManager.getPluginsOnline().isEmpty()
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ open class VlcPackage: OpenInAppAction(
|
||||||
intent.putExtra("secure_uri", true)
|
intent.putExtra("secure_uri", true)
|
||||||
intent.putExtra("title", video.name)
|
intent.putExtra("title", video.name)
|
||||||
|
|
||||||
val subsLang = getKey(SUBTITLE_AUTO_SELECT_KEY) ?: "en"
|
val subsLang = getKey<String>(SUBTITLE_AUTO_SELECT_KEY) ?: "en"
|
||||||
result.subs.firstOrNull {
|
result.subs.firstOrNull {
|
||||||
subsLang == it.languageCode
|
subsLang == it.languageCode
|
||||||
}?.let {
|
}?.let {
|
||||||
|
|
@ -74,4 +74,4 @@ open class VlcPackage: OpenInAppAction(
|
||||||
Log.d("VLC", "Position: $position, Duration: $duration")
|
Log.d("VLC", "Position: $position, Duration: $duration")
|
||||||
updateDurationAndPosition(position, duration)
|
updateDurationAndPosition(position, duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ fun Requests.initClient(context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Only use ignoreSSL if you know what you are doing*/
|
/** Only use ignoreSSL if you know what you are doing*/
|
||||||
@Prerelease
|
|
||||||
fun Requests.initClient(context: Context, ignoreSSL: Boolean = false) {
|
fun Requests.initClient(context: Context, ignoreSSL: Boolean = false) {
|
||||||
this.baseClient = buildDefaultClient(context, ignoreSSL)
|
this.baseClient = buildDefaultClient(context, ignoreSSL)
|
||||||
}
|
}
|
||||||
|
|
@ -34,7 +33,6 @@ fun buildDefaultClient(context: Context): OkHttpClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Only use ignoreSSL if you know what you are doing*/
|
/** Only use ignoreSSL if you know what you are doing*/
|
||||||
@Prerelease
|
|
||||||
fun buildDefaultClient(context: Context, ignoreSSL: Boolean = false): OkHttpClient {
|
fun buildDefaultClient(context: Context, ignoreSSL: Boolean = false): OkHttpClient {
|
||||||
safe { Security.insertProviderAt(Conscrypt.newProvider(), 1) }
|
safe { Security.insertProviderAt(Conscrypt.newProvider(), 1) }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,11 +176,11 @@ object PluginManager {
|
||||||
|
|
||||||
|
|
||||||
fun getPluginsOnline(): Array<PluginData> {
|
fun getPluginsOnline(): Array<PluginData> {
|
||||||
return getKey(PLUGINS_KEY) ?: emptyArray()
|
return getKey<Array<PluginData>>(PLUGINS_KEY) ?: emptyArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPluginsLocal(): Array<PluginData> {
|
fun getPluginsLocal(): Array<PluginData> {
|
||||||
return getKey(PLUGINS_KEY_LOCAL) ?: emptyArray()
|
return getKey<Array<PluginData>>(PLUGINS_KEY_LOCAL) ?: emptyArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val CLOUD_STREAM_FOLDER =
|
private val CLOUD_STREAM_FOLDER =
|
||||||
|
|
@ -512,6 +512,9 @@ object PluginManager {
|
||||||
val res = dir.mkdirs()
|
val res = dir.mkdirs()
|
||||||
if (!res) {
|
if (!res) {
|
||||||
Log.w(TAG, "Failed to create local directories")
|
Log.w(TAG, "Failed to create local directories")
|
||||||
|
// We have tried to load local plugins, but exit early.
|
||||||
|
// This needs to be true to prevent the downloader waiting for plugins.
|
||||||
|
loadedLocalPlugins = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ data class PluginWrapper(
|
||||||
object RepositoryManager {
|
object RepositoryManager {
|
||||||
const val ONLINE_PLUGINS_FOLDER = "Extensions"
|
const val ONLINE_PLUGINS_FOLDER = "Extensions"
|
||||||
val PREBUILT_REPOSITORIES: Array<RepositoryData> by lazy {
|
val PREBUILT_REPOSITORIES: Array<RepositoryData> by lazy {
|
||||||
getKey("PREBUILT_REPOSITORIES") ?: emptyArray()
|
getKey<Array<RepositoryData>>("PREBUILT_REPOSITORIES") ?: emptyArray()
|
||||||
}
|
}
|
||||||
private val GH_REGEX =
|
private val GH_REGEX =
|
||||||
Regex("^https://raw.githubusercontent.com/([A-Za-z0-9-]+)/([A-Za-z0-9_.-]+)/(.*)$")
|
Regex("^https://raw.githubusercontent.com/([A-Za-z0-9-]+)/([A-Za-z0-9_.-]+)/(.*)$")
|
||||||
|
|
@ -141,11 +141,19 @@ object RepositoryManager {
|
||||||
}
|
}
|
||||||
} else if (fixedUrl.matches("^[a-zA-Z0-9!_-]+$".toRegex())) {
|
} else if (fixedUrl.matches("^[a-zA-Z0-9!_-]+$".toRegex())) {
|
||||||
safeAsync {
|
safeAsync {
|
||||||
val response = app.get("https://cutt.ly/${fixedUrl}", allowRedirects = false)
|
if (fixedUrl.startsWith("!")) {
|
||||||
val url = response.headers["Location"] ?: return@safeAsync null
|
val response = app.get("https://py.md/${fixedUrl.removePrefix("!")}", allowRedirects = false)
|
||||||
if (url.startsWith("https://cutt.ly/404")) return@safeAsync null
|
val url = response.headers["Location"] ?: return@safeAsync null
|
||||||
if (url.removeSuffix("/") == "https://cutt.ly") return@safeAsync null
|
if (url.startsWith("https://py.md/404")) return@safeAsync null
|
||||||
return@safeAsync url
|
if (url.removeSuffix("/") == "https://py.md") return@safeAsync null
|
||||||
|
return@safeAsync url
|
||||||
|
} else {
|
||||||
|
val response = app.get("https://cutt.ly/${fixedUrl}", allowRedirects = false)
|
||||||
|
val url = response.headers["Location"] ?: return@safeAsync null
|
||||||
|
if (url.startsWith("https://cutt.ly/404")) return@safeAsync null
|
||||||
|
if (url.removeSuffix("/") == "https://cutt.ly") return@safeAsync null
|
||||||
|
return@safeAsync url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else null
|
} else null
|
||||||
}
|
}
|
||||||
|
|
@ -232,7 +240,7 @@ object RepositoryManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRepositories(): Array<RepositoryData> {
|
fun getRepositories(): Array<RepositoryData> {
|
||||||
return getKey(REPOSITORIES_KEY) ?: emptyArray()
|
return getKey<Array<RepositoryData>>(REPOSITORIES_KEY) ?: emptyArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't want to read before we write in another thread
|
// Don't want to read before we write in another thread
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ abstract class AccountManager {
|
||||||
SubtitleRepo(openSubtitlesApi),
|
SubtitleRepo(openSubtitlesApi),
|
||||||
SubtitleRepo(addic7ed),
|
SubtitleRepo(addic7ed),
|
||||||
SubtitleRepo(subDlApi),
|
SubtitleRepo(subDlApi),
|
||||||
PlainAuthRepo(animeSkipApi)
|
PlainAuthRepo(animeSkipApi),
|
||||||
|
SubtitleRepo(subSourceApi)
|
||||||
)
|
)
|
||||||
|
|
||||||
fun updateAccountIds() {
|
fun updateAccountIds() {
|
||||||
|
|
@ -120,7 +121,8 @@ abstract class AccountManager {
|
||||||
val subtitleProviders = arrayOf(
|
val subtitleProviders = arrayOf(
|
||||||
SubtitleRepo(openSubtitlesApi),
|
SubtitleRepo(openSubtitlesApi),
|
||||||
SubtitleRepo(addic7ed),
|
SubtitleRepo(addic7ed),
|
||||||
SubtitleRepo(subDlApi)
|
SubtitleRepo(subDlApi),
|
||||||
|
SubtitleRepo(subSourceApi)
|
||||||
)
|
)
|
||||||
val syncApis = arrayOf(
|
val syncApis = arrayOf(
|
||||||
SyncRepo(malApi),
|
SyncRepo(malApi),
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,12 @@ import com.lagradost.cloudstream3.APIHolder
|
||||||
import com.lagradost.cloudstream3.APIHolder.unixTime
|
import com.lagradost.cloudstream3.APIHolder.unixTime
|
||||||
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||||
import com.lagradost.cloudstream3.base64Encode
|
import com.lagradost.cloudstream3.base64Encode
|
||||||
|
import com.lagradost.cloudstream3.splitUrlParameters
|
||||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.APP_STRING
|
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.APP_STRING
|
||||||
import com.lagradost.cloudstream3.utils.AppContextUtils.splitQuery
|
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.JsonNames
|
import kotlinx.serialization.json.JsonNames
|
||||||
import java.net.URI
|
|
||||||
import java.security.SecureRandom
|
import java.security.SecureRandom
|
||||||
|
|
||||||
data class AuthLoginPage(
|
data class AuthLoginPage(
|
||||||
|
|
@ -172,10 +171,8 @@ abstract class AuthAPI {
|
||||||
get() = unixTimeMS
|
get() = unixTimeMS
|
||||||
|
|
||||||
fun splitRedirectUrl(redirectUrl: String): Map<String, String> {
|
fun splitRedirectUrl(redirectUrl: String): Map<String, String> {
|
||||||
return splitQuery(
|
return splitUrlParameters(
|
||||||
URI(
|
redirectUrl.replace(APP_STRING, "https").replace("/#", "?")
|
||||||
redirectUrl.replace(APP_STRING, "https").replace("/#", "?")
|
|
||||||
).toURL()
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.syncproviders
|
||||||
|
|
||||||
import androidx.annotation.WorkerThread
|
import androidx.annotation.WorkerThread
|
||||||
import com.lagradost.cloudstream3.APIHolder.unixTime
|
import com.lagradost.cloudstream3.APIHolder.unixTime
|
||||||
import com.lagradost.cloudstream3.ErrorLoadingException
|
|
||||||
import com.lagradost.cloudstream3.subtitles.AbstractSubtitleEntities.SubtitleEntity
|
import com.lagradost.cloudstream3.subtitles.AbstractSubtitleEntities.SubtitleEntity
|
||||||
import com.lagradost.cloudstream3.subtitles.AbstractSubtitleEntities.SubtitleSearch
|
import com.lagradost.cloudstream3.subtitles.AbstractSubtitleEntities.SubtitleSearch
|
||||||
import com.lagradost.cloudstream3.subtitles.SubtitleResource
|
import com.lagradost.cloudstream3.subtitles.SubtitleResource
|
||||||
|
|
@ -14,7 +13,8 @@ class SubtitleRepo(override val api: SubtitleAPI) : AuthRepo(api) {
|
||||||
data class SavedSearchResponse(
|
data class SavedSearchResponse(
|
||||||
val unixTime: Long,
|
val unixTime: Long,
|
||||||
val response: List<SubtitleEntity>,
|
val response: List<SubtitleEntity>,
|
||||||
val query: SubtitleSearch
|
val query: SubtitleSearch,
|
||||||
|
val idPrefix: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class SavedResourceResponse(
|
data class SavedResourceResponse(
|
||||||
|
|
@ -66,7 +66,7 @@ class SubtitleRepo(override val api: SubtitleAPI) : AuthRepo(api) {
|
||||||
var found: List<SubtitleEntity>? = null
|
var found: List<SubtitleEntity>? = null
|
||||||
for (item in searchCache) {
|
for (item in searchCache) {
|
||||||
// 120 min save
|
// 120 min save
|
||||||
if (item.query == query && (unixTime - item.unixTime) < 60 * 120) {
|
if (item.idPrefix == idPrefix && item.query == query && (unixTime - item.unixTime) < 60 * 120) {
|
||||||
found = item.response
|
found = item.response
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ class SubtitleRepo(override val api: SubtitleAPI) : AuthRepo(api) {
|
||||||
|
|
||||||
// only cache valid return values
|
// only cache valid return values
|
||||||
if (returnValue.isNotEmpty()) {
|
if (returnValue.isNotEmpty()) {
|
||||||
val add = SavedSearchResponse(unixTime, returnValue, query)
|
val add = SavedSearchResponse(unixTime, returnValue, query, idPrefix)
|
||||||
searchCache.withLock {
|
searchCache.withLock {
|
||||||
if (searchCache.size > CACHE_SIZE) {
|
if (searchCache.size > CACHE_SIZE) {
|
||||||
searchCache[searchCacheIndex] = add // rolling cache
|
searchCache[searchCacheIndex] = add // rolling cache
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -7,11 +7,10 @@ import com.lagradost.cloudstream3.subtitles.AbstractSubtitleEntities
|
||||||
import com.lagradost.cloudstream3.subtitles.SubtitleResource
|
import com.lagradost.cloudstream3.subtitles.SubtitleResource
|
||||||
import com.lagradost.cloudstream3.syncproviders.AuthData
|
import com.lagradost.cloudstream3.syncproviders.AuthData
|
||||||
import com.lagradost.cloudstream3.syncproviders.SubtitleAPI
|
import com.lagradost.cloudstream3.syncproviders.SubtitleAPI
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
|
||||||
import com.lagradost.cloudstream3.utils.SubtitleHelper
|
import com.lagradost.cloudstream3.utils.SubtitleHelper
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
class SubSourceApi : SubtitleAPI() {
|
class SubSourceApi : SubtitleAPI() {
|
||||||
override val name = "SubSource"
|
override val name = "SubSource"
|
||||||
|
|
@ -20,77 +19,70 @@ class SubSourceApi : SubtitleAPI() {
|
||||||
override val requiresLogin = false
|
override val requiresLogin = false
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val APIURL = "https://api.subsource.net/api"
|
const val APIURL = "https://api.subsource.net/v1"
|
||||||
const val DOWNLOADENDPOINT = "https://api.subsource.net/api/downloadSub"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun search(
|
override suspend fun search(
|
||||||
auth: AuthData?,
|
auth: AuthData?,
|
||||||
query: AbstractSubtitleEntities.SubtitleSearch
|
query: AbstractSubtitleEntities.SubtitleSearch
|
||||||
): List<AbstractSubtitleEntities.SubtitleEntity>? {
|
): List<AbstractSubtitleEntities.SubtitleEntity>? {
|
||||||
|
|
||||||
//Only supports Imdb Id search for now
|
//Only supports Imdb Id search for now
|
||||||
if (query.imdbId == null) return null
|
if (query.imdbId == null) return null
|
||||||
val queryLang = SubtitleHelper.fromTagToEnglishLanguageName(query.lang)
|
val queryLang = SubtitleHelper.fromTagToEnglishLanguageName(query.lang)
|
||||||
val type = if ((query.seasonNumber ?: 0) > 0) TvType.TvSeries else TvType.Movie
|
val type = if ((query.seasonNumber ?: 0) > 0) TvType.TvSeries else TvType.Movie
|
||||||
|
|
||||||
val searchRes = app.post(
|
val searchResponse = app.post(
|
||||||
url = "$APIURL/searchMovie",
|
url = "$APIURL/movie/search",
|
||||||
data = mapOf(
|
json = mapOf(
|
||||||
"query" to query.imdbId!!
|
"includeSeasons" to false,
|
||||||
)
|
"limit" to 15,
|
||||||
).parsedSafe<ApiSearch>() ?: return null
|
"query" to query.imdbId!!,
|
||||||
|
"signal" to "{}"
|
||||||
|
),
|
||||||
|
cacheTime = 120,
|
||||||
|
cacheUnit = TimeUnit.MINUTES,
|
||||||
|
).parsedSafe<SearchRoot>() ?: return null
|
||||||
|
|
||||||
val postData = if (type == TvType.TvSeries) {
|
val firstResult = searchResponse.results.firstOrNull() ?: return null
|
||||||
mapOf(
|
|
||||||
"langs" to "[]",
|
val apiResponse = app.get(
|
||||||
"movieName" to searchRes.found.first().linkName,
|
url = "$APIURL${firstResult.link.replace("series", "subtitles")}",
|
||||||
"season" to "season-${query.seasonNumber}"
|
cacheTime = 120,
|
||||||
)
|
cacheUnit = TimeUnit.MINUTES,
|
||||||
} else {
|
).parsedSafe<ItemRoot>() ?: return null
|
||||||
mapOf(
|
|
||||||
"langs" to "[]",
|
val filteredSubtitles = apiResponse.subtitles.filter { sub ->
|
||||||
"movieName" to searchRes.found.first().linkName,
|
sub.releaseType != "trailer" &&
|
||||||
)
|
sub.language.equals(queryLang, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
val getMovieRes = app.post(
|
// api doesn't has episode number or lang filtering
|
||||||
url = "$APIURL/getMovie",
|
val subtitles = if (type == TvType.Movie) {
|
||||||
data = postData
|
filteredSubtitles
|
||||||
).parsedSafe<ApiResponse>().let {
|
} else {
|
||||||
// api doesn't has episode number or lang filtering
|
val shouldContain = String.format(
|
||||||
if (type == TvType.Movie) {
|
null,
|
||||||
it?.subs?.filter { sub ->
|
"E%02d",
|
||||||
sub.lang == queryLang
|
query.epNumber
|
||||||
}
|
)
|
||||||
} else {
|
filteredSubtitles.filter { sub ->
|
||||||
it?.subs?.filter { sub ->
|
sub.releaseInfo.contains(
|
||||||
sub.releaseName!!.contains(
|
shouldContain
|
||||||
String.format(
|
)
|
||||||
null,
|
|
||||||
"E%02d",
|
|
||||||
query.epNumber
|
|
||||||
)
|
|
||||||
) && sub.lang == queryLang
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} ?: return null
|
}
|
||||||
|
|
||||||
return getMovieRes.map { subtitle ->
|
return subtitles.map { subtitle ->
|
||||||
AbstractSubtitleEntities.SubtitleEntity(
|
AbstractSubtitleEntities.SubtitleEntity(
|
||||||
idPrefix = this.idPrefix,
|
idPrefix = this.idPrefix,
|
||||||
name = subtitle.releaseName!!,
|
name = subtitle.releaseInfo,
|
||||||
lang = subtitle.lang!!,
|
lang = subtitle.language,
|
||||||
data = SubData(
|
data = subtitle.link,
|
||||||
movie = subtitle.linkName!!,
|
|
||||||
lang = subtitle.lang,
|
|
||||||
id = subtitle.subId.toString(),
|
|
||||||
).toJson(),
|
|
||||||
type = type,
|
type = type,
|
||||||
source = this.name,
|
source = this.name,
|
||||||
epNumber = query.epNumber,
|
epNumber = query.epNumber,
|
||||||
seasonNumber = query.seasonNumber,
|
seasonNumber = query.seasonNumber,
|
||||||
isHearingImpaired = subtitle.hi == 1,
|
isHearingImpaired = subtitle.hearingImpaired == 1,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,79 +91,114 @@ class SubSourceApi : SubtitleAPI() {
|
||||||
auth: AuthData?,
|
auth: AuthData?,
|
||||||
subtitle: AbstractSubtitleEntities.SubtitleEntity
|
subtitle: AbstractSubtitleEntities.SubtitleEntity
|
||||||
) {
|
) {
|
||||||
val parsedSub = parseJson<SubData>(subtitle.data)
|
val data = app.get("$APIURL/subtitle/${subtitle.data}")
|
||||||
|
.parsedSafe<DownloadRoot>()
|
||||||
val subRes = app.post(
|
?: return
|
||||||
url = "$APIURL/getSub",
|
|
||||||
data = mapOf(
|
|
||||||
"movie" to parsedSub.movie,
|
|
||||||
"lang" to subtitle.lang,
|
|
||||||
"id" to parsedSub.id
|
|
||||||
)
|
|
||||||
).parsedSafe<SubTitleLink>() ?: return
|
|
||||||
|
|
||||||
this.addZipUrl(
|
this.addZipUrl(
|
||||||
"$DOWNLOADENDPOINT/${subRes.sub.downloadToken}"
|
"$APIURL/subtitle/download/${data.subtitle.downloadToken}"
|
||||||
) { name, _ ->
|
) { name, _ ->
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class ApiSearch(
|
data class SearchRoot(
|
||||||
@JsonProperty("success") @SerialName("success") val success: Boolean,
|
@JsonProperty("success") @SerialName("success") var success: Boolean? = null,
|
||||||
@JsonProperty("found") @SerialName("found") val found: List<Found>,
|
@JsonProperty("results") @SerialName("results") var results: ArrayList<Results> = arrayListOf(),
|
||||||
|
@JsonProperty("users") @SerialName("users") var users: ArrayList<Users> = arrayListOf()
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Found(
|
data class Users(
|
||||||
@JsonProperty("id") @SerialName("id") val id: Long,
|
|
||||||
@JsonProperty("title") @SerialName("title") val title: String,
|
@JsonProperty("id") @SerialName("id") var id: Int? = null,
|
||||||
@JsonProperty("seasons") @SerialName("seasons") val seasons: Long,
|
@JsonProperty("displayname") @SerialName("displayname") var displayname: String? = null,
|
||||||
@JsonProperty("type") @SerialName("type") val type: String,
|
@JsonProperty("avatar") @SerialName("avatar") var avatar: String? = null,
|
||||||
@JsonProperty("releaseYear") @SerialName("releaseYear") val releaseYear: Long,
|
@JsonProperty("badges") @SerialName("badges") var badges: ArrayList<String> = arrayListOf()
|
||||||
@JsonProperty("linkName") @SerialName("linkName") val linkName: String,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class ApiResponse(
|
data class Results(
|
||||||
@JsonProperty("success") @SerialName("success") val success: Boolean,
|
@JsonProperty("id") @SerialName("id") var id: Int? = null,
|
||||||
@JsonProperty("movie") @SerialName("movie") val movie: Movie,
|
@JsonProperty("title") @SerialName("title") var title: String? = null,
|
||||||
@JsonProperty("subs") @SerialName("subs") val subs: List<Sub>,
|
@JsonProperty("type") @SerialName("type") var type: String? = null,
|
||||||
|
@JsonProperty("link") @SerialName("link") var link: String,
|
||||||
|
@JsonProperty("releaseYear") @SerialName("releaseYear") var releaseYear: Int? = null,
|
||||||
|
@JsonProperty("poster") @SerialName("poster") var poster: String? = null,
|
||||||
|
@JsonProperty("subtitleCount") @SerialName("subtitleCount") var subtitleCount: String? = null,
|
||||||
|
@JsonProperty("rating") @SerialName("rating") var rating: Double? = null,
|
||||||
|
@JsonProperty("cast") @SerialName("cast") var cast: ArrayList<String> = arrayListOf(),
|
||||||
|
@JsonProperty("genres") @SerialName("genres") var genres: ArrayList<String> = arrayListOf(),
|
||||||
|
@JsonProperty("score") @SerialName("score") var score: Double? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Movie(
|
|
||||||
@JsonProperty("id") @SerialName("id") val id: Long? = null,
|
data class ItemRoot(
|
||||||
@JsonProperty("type") @SerialName("type") val type: String? = null,
|
|
||||||
@JsonProperty("year") @SerialName("year") val year: Long? = null,
|
// @SerialName("media_type" ) var mediaType : String? = null,
|
||||||
@JsonProperty("fullName") @SerialName("fullName") val fullName: String? = null,
|
@JsonProperty("subtitles") @SerialName("subtitles") var subtitles: ArrayList<Subtitles>,
|
||||||
|
//@SerialName("movie" ) var movie : Movie? = Movie()
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Sub(
|
data class Subtitles(
|
||||||
@JsonProperty("hi") @SerialName("hi") val hi: Int? = null,
|
|
||||||
@JsonProperty("fullLink") @SerialName("fullLink") val fullLink: String? = null,
|
@JsonProperty("id") @SerialName("id") var id: Int? = null,
|
||||||
@JsonProperty("linkName") @SerialName("linkName") val linkName: String? = null,
|
@JsonProperty("language") @SerialName("language") var language: String,
|
||||||
@JsonProperty("lang") @SerialName("lang") val lang: String? = null,
|
@JsonProperty("release_type") @SerialName("release_type") var releaseType: String? = null,
|
||||||
@JsonProperty("releaseName") @SerialName("releaseName") val releaseName: String? = null,
|
@JsonProperty("release_info") @SerialName("release_info") var releaseInfo: String,
|
||||||
@JsonProperty("subId") @SerialName("subId") val subId: Long? = null,
|
@JsonProperty("upload_date") @SerialName("upload_date") var uploadDate: String? = null,
|
||||||
|
@JsonProperty("hearing_impaired") @SerialName("hearing_impaired") var hearingImpaired: Int? = null,
|
||||||
|
@JsonProperty("caption") @SerialName("caption") var caption: String? = null,
|
||||||
|
@JsonProperty("rating") @SerialName("rating") var rating: String? = null,
|
||||||
|
@JsonProperty("uploader_id") @SerialName("uploader_id") var uploaderId: Int? = null,
|
||||||
|
@JsonProperty("uploader_displayname") @SerialName("uploader_displayname") var uploaderDisplayname: String? = null,
|
||||||
|
@JsonProperty("uploader_badges") @SerialName("uploader_badges") var uploaderBadges: ArrayList<String> = arrayListOf(),
|
||||||
|
@JsonProperty("link") @SerialName("link") var link: String,
|
||||||
|
@JsonProperty("production_type") @SerialName("production_type") var productionType: String? = null,
|
||||||
|
@JsonProperty("last_subtitle") @SerialName("last_subtitle") var lastSubtitle: Boolean? = null
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SubData(
|
data class DownloadRoot(
|
||||||
@JsonProperty("movie") @SerialName("movie") val movie: String,
|
@JsonProperty("subtitle") @SerialName("subtitle") var subtitle: Subtitle,
|
||||||
@JsonProperty("lang") @SerialName("lang") val lang: String,
|
//@SerializedName("movie" ) var movie : Movie? = Movie(),
|
||||||
@JsonProperty("id") @SerialName("id") val id: String,
|
//@SerializedName("donationLinks" ) var donationLinks : DonationLinks? = DonationLinks(),
|
||||||
|
//@SerializedName("isDownloaded" ) var isDownloaded : Boolean? = null,
|
||||||
|
//@SerializedName("user_rated" ) var userRated : String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SubTitleLink(
|
data class Subtitle(
|
||||||
@JsonProperty("sub") @SerialName("sub") val sub: SubToken,
|
|
||||||
)
|
@JsonProperty("id") @SerialName("id") var id: Int? = null,
|
||||||
|
@JsonProperty("uploaded_at") @SerialName("uploaded_at") var uploadedAt: String? = null,
|
||||||
|
@JsonProperty("language") @SerialName("language") var language: String? = null,
|
||||||
|
@JsonProperty("rating") @SerialName("rating") var rating: String? = null,
|
||||||
|
//SerialName("rates" ) var rates : Rates? = Rates(),
|
||||||
|
@JsonProperty("uploaded_by") @SerialName("uploaded_by") var uploadedBy: Int? = null,
|
||||||
|
//@SerialName("contribs" ) var contribs : ArrayList<Contribs> = arrayListOf(),
|
||||||
|
@JsonProperty("release_info") @SerialName("release_info") var releaseInfo: ArrayList<String> = arrayListOf(),
|
||||||
|
@JsonProperty("commentary") @SerialName("commentary") var commentary: String? = null,
|
||||||
|
@JsonProperty("files") @SerialName("files") var files: String? = null,
|
||||||
|
@JsonProperty("size") @SerialName("size") var size: String? = null,
|
||||||
|
@JsonProperty("downloads") @SerialName("downloads") var downloads: Int? = null,
|
||||||
|
@JsonProperty("comments") @SerialName("comments") var comments: Int? = null,
|
||||||
|
@JsonProperty("production_type") @SerialName("production_type") var productionType: String? = null,
|
||||||
|
@JsonProperty("release_type") @SerialName("release_type") var releaseType: String? = null,
|
||||||
|
@JsonProperty("episode") @SerialName("episode") var episode: String? = null,
|
||||||
|
@JsonProperty("hearing_impaired") @SerialName("hearing_impaired") var hearingImpaired: Int? = null,
|
||||||
|
@JsonProperty("foreign_parts") @SerialName("foreign_parts") var foreignParts: String? = null,
|
||||||
|
@JsonProperty("framerate") @SerialName("framerate") var framerate: String? = null,
|
||||||
|
@JsonProperty("preview") @SerialName("preview") var preview: String? = null,
|
||||||
|
@JsonProperty("user_uploaded") @SerialName("user_uploaded") var userUploaded: Boolean? = null,
|
||||||
|
@JsonProperty("download_token") @SerialName("download_token") var downloadToken: String
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class SubToken(
|
|
||||||
@JsonProperty("downloadToken") @SerialName("downloadToken") val downloadToken: String,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.ListView
|
import android.widget.ListView
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.google.android.gms.cast.MediaLoadOptions
|
import com.google.android.gms.cast.MediaLoadOptions
|
||||||
import com.google.android.gms.cast.MediaQueueItem
|
import com.google.android.gms.cast.MediaQueueItem
|
||||||
import com.google.android.gms.cast.MediaSeekOptions
|
import com.google.android.gms.cast.MediaSeekOptions
|
||||||
|
|
@ -34,35 +35,24 @@ import com.lagradost.cloudstream3.ui.player.SubtitleData
|
||||||
import com.lagradost.cloudstream3.ui.result.ResultEpisode
|
import com.lagradost.cloudstream3.ui.result.ResultEpisode
|
||||||
import com.lagradost.cloudstream3.ui.subtitles.ChromecastSubtitlesFragment
|
import com.lagradost.cloudstream3.ui.subtitles.ChromecastSubtitlesFragment
|
||||||
import com.lagradost.cloudstream3.utils.AppContextUtils.sortSubs
|
import com.lagradost.cloudstream3.utils.AppContextUtils.sortSubs
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||||
import com.lagradost.cloudstream3.utils.CastHelper.awaitLinks
|
import com.lagradost.cloudstream3.utils.CastHelper.awaitLinks
|
||||||
import com.lagradost.cloudstream3.utils.CastHelper.getMediaInfo
|
import com.lagradost.cloudstream3.utils.CastHelper.getMediaInfo
|
||||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||||
import com.lagradost.cloudstream3.utils.DataStore.toKotlinObject
|
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
||||||
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.UIHelper.dismissSafe
|
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
/*class SkipOpController(val view: ImageView) : UIController() {
|
|
||||||
init {
|
|
||||||
view.setImageResource(R.drawable.exo_controls_fastforward)
|
|
||||||
view.setOnClickListener {
|
|
||||||
remoteMediaClient?.let {
|
|
||||||
val options = MediaSeekOptions.Builder()
|
|
||||||
.setPosition(it.approximateStreamPosition + 85000)
|
|
||||||
it.seek(options.build())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private fun RemoteMediaClient.getItemIndex(): Int? {
|
private fun RemoteMediaClient.getItemIndex(): Int? {
|
||||||
return try {
|
return try {
|
||||||
val index = this.mediaQueue.itemIds.indexOf(this.currentItem?.itemId ?: 0)
|
val index = this.mediaQueue.itemIds.indexOf(this.currentItem?.itemId ?: 0)
|
||||||
if (index < 0) null else index
|
if (index < 0) null else index
|
||||||
} catch (e: Exception) {
|
} catch (_: Exception) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -89,48 +79,41 @@ class SkipNextEpisodeController(val view: ImageView) : UIController() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class MetadataHolder(
|
data class MetadataHolder(
|
||||||
val apiName: String,
|
@JsonProperty("apiName") @SerialName("apiName") val apiName: String,
|
||||||
val isMovie: Boolean,
|
@JsonProperty("isMovie") @SerialName("isMovie") val isMovie: Boolean,
|
||||||
val title: String?,
|
@JsonProperty("title") @SerialName("title") val title: String?,
|
||||||
val poster: String?,
|
@JsonProperty("poster") @SerialName("poster") val poster: String?,
|
||||||
val currentEpisodeIndex: Int,
|
@JsonProperty("currentEpisodeIndex") @SerialName("currentEpisodeIndex") val currentEpisodeIndex: Int,
|
||||||
val episodes: List<ResultEpisode>,
|
@JsonProperty("episodes") @SerialName("episodes") val episodes: List<ResultEpisode>,
|
||||||
val currentLinks: List<ExtractorLink>,
|
@JsonProperty("currentLinks") @SerialName("currentLinks") val currentLinks: List<ExtractorLink>,
|
||||||
val currentSubtitles: List<SubtitleData>
|
@JsonProperty("currentSubtitles") @SerialName("currentSubtitles") val currentSubtitles: List<SubtitleData>,
|
||||||
)
|
)
|
||||||
|
|
||||||
class SelectSourceController(val view: ImageView, val activity: ControllerActivity) :
|
class SelectSourceController(val view: ImageView, val activity: ControllerActivity) : UIController() {
|
||||||
UIController() {
|
|
||||||
init {
|
init {
|
||||||
view.setImageResource(R.drawable.ic_baseline_playlist_play_24)
|
view.setImageResource(R.drawable.ic_baseline_playlist_play_24)
|
||||||
view.setOnClickListener {
|
view.setOnClickListener {
|
||||||
// lateinit var dialog: AlertDialog
|
|
||||||
val holder = getCurrentMetaData()
|
val holder = getCurrentMetaData()
|
||||||
|
|
||||||
if (holder != null) {
|
if (holder != null) {
|
||||||
val items = holder.currentLinks
|
val items = holder.currentLinks
|
||||||
if (items.isNotEmpty() && remoteMediaClient?.currentItem != null) {
|
if (items.isNotEmpty() && remoteMediaClient?.currentItem != null) {
|
||||||
val subTracks =
|
val subTracks = remoteMediaClient?.mediaInfo?.mediaTracks?.filter { it.type == MediaTrack.TYPE_TEXT }
|
||||||
remoteMediaClient?.mediaInfo?.mediaTracks?.filter { it.type == MediaTrack.TYPE_TEXT }
|
?: ArrayList()
|
||||||
?: ArrayList()
|
|
||||||
|
|
||||||
val bottomSheetDialogBuilder =
|
val bottomSheetDialogBuilder = AlertDialog.Builder(view.context, R.style.AlertDialogCustomBlack)
|
||||||
AlertDialog.Builder(view.context, R.style.AlertDialogCustomBlack)
|
|
||||||
bottomSheetDialogBuilder.setView(R.layout.sort_bottom_sheet)
|
bottomSheetDialogBuilder.setView(R.layout.sort_bottom_sheet)
|
||||||
|
|
||||||
val bottomSheetDialog = bottomSheetDialogBuilder.create()
|
val bottomSheetDialog = bottomSheetDialogBuilder.create()
|
||||||
bottomSheetDialog.show()
|
bottomSheetDialog.show()
|
||||||
// bottomSheetDialog.setContentView(R.layout.sort_bottom_sheet)
|
|
||||||
val providerList =
|
val providerList = bottomSheetDialog.findViewById<ListView>(R.id.sort_providers)!!
|
||||||
bottomSheetDialog.findViewById<ListView>(R.id.sort_providers)!!
|
val subtitleList = bottomSheetDialog.findViewById<ListView>(R.id.sort_subtitles)!!
|
||||||
val subtitleList =
|
|
||||||
bottomSheetDialog.findViewById<ListView>(R.id.sort_subtitles)!!
|
|
||||||
if (subTracks.isEmpty()) {
|
if (subTracks.isEmpty()) {
|
||||||
bottomSheetDialog.findViewById<LinearLayout>(R.id.sort_subtitles_holder)?.visibility =
|
bottomSheetDialog.findViewById<LinearLayout>(R.id.sort_subtitles_holder)?.visibility = GONE
|
||||||
GONE
|
|
||||||
} else {
|
} else {
|
||||||
val arrayAdapter =
|
val arrayAdapter = ArrayAdapter<String>(view.context, R.layout.sort_bottom_single_choice)
|
||||||
ArrayAdapter<String>(view.context, R.layout.sort_bottom_single_choice)
|
|
||||||
arrayAdapter.add(view.context.getString(R.string.no_subtitles))
|
arrayAdapter.add(view.context.getString(R.string.no_subtitles))
|
||||||
arrayAdapter.addAll(subTracks.mapNotNull { it.name })
|
arrayAdapter.addAll(subTracks.mapNotNull { it.name })
|
||||||
|
|
||||||
|
|
@ -138,10 +121,8 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
subtitleList.adapter = arrayAdapter
|
subtitleList.adapter = arrayAdapter
|
||||||
|
|
||||||
val currentTracks = remoteMediaClient?.mediaStatus?.activeTrackIds
|
val currentTracks = remoteMediaClient?.mediaStatus?.activeTrackIds
|
||||||
|
val subtitleIndex = if (currentTracks == null) 0 else subTracks.map { it.id }
|
||||||
val subtitleIndex =
|
.indexOfFirst { currentTracks.contains(it) } + 1
|
||||||
if (currentTracks == null) 0 else subTracks.map { it.id }
|
|
||||||
.indexOfFirst { currentTracks.contains(it) } + 1
|
|
||||||
|
|
||||||
subtitleList.setSelection(subtitleIndex)
|
subtitleList.setSelection(subtitleIndex)
|
||||||
subtitleList.setItemChecked(subtitleIndex, true)
|
subtitleList.setItemChecked(subtitleIndex, true)
|
||||||
|
|
@ -153,9 +134,7 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
ChromecastSubtitlesFragment.getCurrentSavedStyle().apply {
|
ChromecastSubtitlesFragment.getCurrentSavedStyle().apply {
|
||||||
val font = TextTrackStyle()
|
val font = TextTrackStyle()
|
||||||
font.setFontFamily(fontFamily ?: "Google Sans")
|
font.setFontFamily(fontFamily ?: "Google Sans")
|
||||||
fontGenericFamily?.let {
|
fontGenericFamily?.let { font.fontGenericFamily = it }
|
||||||
font.fontGenericFamily = it
|
|
||||||
}
|
|
||||||
font.windowColor = windowColor
|
font.windowColor = windowColor
|
||||||
font.backgroundColor = backgroundColor
|
font.backgroundColor = backgroundColor
|
||||||
|
|
||||||
|
|
@ -172,7 +151,7 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
if (!it.status.isSuccess) {
|
if (!it.status.isSuccess) {
|
||||||
Log.e(
|
Log.e(
|
||||||
"CHROMECAST", "Failed with status code:" +
|
"CHROMECAST", "Failed with status code:" +
|
||||||
it.status.statusCode + " > " + it.status.statusMessage
|
it.status.statusCode + " > " + it.status.statusMessage
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -181,17 +160,15 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.messages.MediaInformation
|
// https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.messages.MediaInformation
|
||||||
val contentUrl = (remoteMediaClient?.currentItem?.media?.contentUrl
|
val contentUrl = (remoteMediaClient?.currentItem?.media?.contentUrl
|
||||||
?: remoteMediaClient?.currentItem?.media?.contentId)
|
?: remoteMediaClient?.currentItem?.media?.contentId)
|
||||||
|
|
||||||
val sortingMethods =
|
val sortingMethods = items.map { "${it.name} ${Qualities.getStringByInt(it.quality)}" }
|
||||||
items.map { "${it.name} ${Qualities.getStringByInt(it.quality)}" }
|
.toTypedArray()
|
||||||
.toTypedArray()
|
|
||||||
val sotringIndex = items.indexOfFirst { it.url == contentUrl }
|
val sotringIndex = items.indexOfFirst { it.url == contentUrl }
|
||||||
|
|
||||||
val arrayAdapter =
|
val arrayAdapter = ArrayAdapter<String>(view.context, R.layout.sort_bottom_single_choice)
|
||||||
ArrayAdapter<String>(view.context, R.layout.sort_bottom_single_choice)
|
|
||||||
arrayAdapter.addAll(sortingMethods.toMutableList())
|
arrayAdapter.addAll(sortingMethods.toMutableList())
|
||||||
|
|
||||||
providerList.choiceMode = AbsListView.CHOICE_MODE_SINGLE
|
providerList.choiceMode = AbsListView.CHOICE_MODE_SINGLE
|
||||||
|
|
@ -201,10 +178,8 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
|
|
||||||
providerList.setOnItemClickListener { _, _, which, _ ->
|
providerList.setOnItemClickListener { _, _, which, _ ->
|
||||||
val epData = holder.episodes[holder.currentEpisodeIndex]
|
val epData = holder.episodes[holder.currentEpisodeIndex]
|
||||||
|
|
||||||
fun loadMirror(index: Int) {
|
fun loadMirror(index: Int) {
|
||||||
if (holder.currentLinks.size <= index) return
|
if (holder.currentLinks.size <= index) return
|
||||||
|
|
||||||
val mediaItem = getMediaInfo(
|
val mediaItem = getMediaInfo(
|
||||||
epData,
|
epData,
|
||||||
holder,
|
holder,
|
||||||
|
|
@ -214,25 +189,21 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
)
|
)
|
||||||
|
|
||||||
val startAt = remoteMediaClient?.approximateStreamPosition ?: 0
|
val startAt = remoteMediaClient?.approximateStreamPosition ?: 0
|
||||||
|
|
||||||
//remoteMediaClient.load(mediaItem, true, startAt)
|
|
||||||
try { // THIS IS VERY IMPORTANT BECAUSE WE NEVER WANT TO AUTOLOAD THE NEXT EPISODE
|
try { // THIS IS VERY IMPORTANT BECAUSE WE NEVER WANT TO AUTOLOAD THE NEXT EPISODE
|
||||||
val currentIdIndex = remoteMediaClient?.getItemIndex()
|
val currentIdIndex = remoteMediaClient?.getItemIndex()
|
||||||
|
|
||||||
val nextId = remoteMediaClient?.mediaQueue?.itemIds?.get(
|
val nextId = remoteMediaClient?.mediaQueue?.itemIds?.get(
|
||||||
currentIdIndex?.plus(1) ?: 0
|
currentIdIndex?.plus(1) ?: 0
|
||||||
)
|
)
|
||||||
|
|
||||||
if (currentIdIndex == null && nextId != null) {
|
if (currentIdIndex == null && nextId != null) {
|
||||||
awaitLinks(
|
awaitLinks(
|
||||||
remoteMediaClient?.queueInsertAndPlayItem(
|
remoteMediaClient?.queueInsertAndPlayItem(
|
||||||
MediaQueueItem.Builder(mediaItem).build(),
|
MediaQueueItem.Builder(mediaItem).build(),
|
||||||
nextId,
|
nextId,
|
||||||
startAt,
|
startAt,
|
||||||
JSONObject()
|
JSONObject(),
|
||||||
)
|
)
|
||||||
) {
|
) { loadMirror(index + 1) }
|
||||||
loadMirror(index + 1)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
val mediaLoadOptions =
|
val mediaLoadOptions =
|
||||||
MediaLoadOptions.Builder()
|
MediaLoadOptions.Builder()
|
||||||
|
|
@ -244,11 +215,9 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
mediaItem,
|
mediaItem,
|
||||||
mediaLoadOptions
|
mediaLoadOptions
|
||||||
)
|
)
|
||||||
) {
|
) { loadMirror(index + 1) }
|
||||||
loadMirror(index + 1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (_: Exception) {
|
||||||
val mediaLoadOptions =
|
val mediaLoadOptions =
|
||||||
MediaLoadOptions.Builder()
|
MediaLoadOptions.Builder()
|
||||||
.setPlayPosition(startAt)
|
.setPlayPosition(startAt)
|
||||||
|
|
@ -259,8 +228,8 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadMirror(which)
|
|
||||||
|
|
||||||
|
loadMirror(which)
|
||||||
bottomSheetDialog.dismissSafe(activity)
|
bottomSheetDialog.dismissSafe(activity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -270,23 +239,19 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
|
|
||||||
private fun getCurrentMetaData(): MetadataHolder? {
|
private fun getCurrentMetaData(): MetadataHolder? {
|
||||||
return try {
|
return try {
|
||||||
val data = remoteMediaClient?.mediaInfo?.customData?.toString()
|
val data = remoteMediaClient?.mediaInfo?.customData?.toString() ?: return null
|
||||||
data?.toKotlinObject()
|
parseJson<MetadataHolder>(data)
|
||||||
} catch (e: Exception) {
|
} catch (_: Exception) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var isLoadingMore = false
|
var isLoadingMore = false
|
||||||
|
|
||||||
|
|
||||||
override fun onMediaStatusUpdated() {
|
override fun onMediaStatusUpdated() {
|
||||||
super.onMediaStatusUpdated()
|
super.onMediaStatusUpdated()
|
||||||
val meta = getCurrentMetaData()
|
val meta = getCurrentMetaData()
|
||||||
|
view.visibility = if ((meta?.currentLinks?.size ?: 0) > 1) VISIBLE else INVISIBLE
|
||||||
|
|
||||||
view.visibility = if ((meta?.currentLinks?.size
|
|
||||||
?: 0) > 1
|
|
||||||
) VISIBLE else INVISIBLE
|
|
||||||
try {
|
try {
|
||||||
if (meta != null && meta.episodes.size > meta.currentEpisodeIndex + 1) {
|
if (meta != null && meta.episodes.size > meta.currentEpisodeIndex + 1) {
|
||||||
val currentIdIndex = remoteMediaClient?.getItemIndex() ?: return
|
val currentIdIndex = remoteMediaClient?.getItemIndex() ?: return
|
||||||
|
|
@ -303,7 +268,7 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
currentPosition,
|
currentPosition,
|
||||||
currentDuration,
|
currentDuration,
|
||||||
epData,
|
epData,
|
||||||
meta.episodes.getOrNull(index + 1)
|
meta.episodes.getOrNull(index + 1),
|
||||||
)
|
)
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
logError(t)
|
logError(t)
|
||||||
|
|
@ -314,9 +279,7 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
ioSafe {
|
ioSafe {
|
||||||
val currentLinks = mutableSetOf<ExtractorLink>()
|
val currentLinks = mutableSetOf<ExtractorLink>()
|
||||||
val currentSubs = mutableSetOf<SubtitleData>()
|
val currentSubs = mutableSetOf<SubtitleData>()
|
||||||
|
|
||||||
val generator = RepoLinkGenerator(listOf(epData))
|
val generator = RepoLinkGenerator(listOf(epData))
|
||||||
|
|
||||||
val isSuccessful = safeApiCall {
|
val isSuccessful = safeApiCall {
|
||||||
generator.generateLinks(
|
generator.generateLinks(
|
||||||
clearCache = false,
|
clearCache = false,
|
||||||
|
|
@ -329,7 +292,7 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
currentSubs.add(it)
|
currentSubs.add(it)
|
||||||
},
|
},
|
||||||
offset = 0,
|
offset = 0,
|
||||||
isCasting = true
|
isCasting = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,32 +303,18 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
val jsonCopy = meta.copy(
|
val jsonCopy = meta.copy(
|
||||||
currentLinks = sortedLinks,
|
currentLinks = sortedLinks,
|
||||||
currentSubtitles = sortedSubs,
|
currentSubtitles = sortedSubs,
|
||||||
currentEpisodeIndex = index
|
currentEpisodeIndex = index,
|
||||||
)
|
)
|
||||||
|
|
||||||
val done =
|
val done = JSONObject(jsonCopy.toJson())
|
||||||
JSONObject(jsonCopy.toJson())
|
|
||||||
|
|
||||||
val mediaInfo = getMediaInfo(
|
val mediaInfo = getMediaInfo(
|
||||||
epData,
|
epData,
|
||||||
jsonCopy,
|
jsonCopy,
|
||||||
0,
|
0,
|
||||||
done,
|
done,
|
||||||
sortedSubs
|
sortedSubs,
|
||||||
)
|
)
|
||||||
|
|
||||||
/*fun loadIndex(index: Int) {
|
|
||||||
println("LOAD INDEX::::: $index")
|
|
||||||
if (meta.currentLinks.size <= index) return
|
|
||||||
val info = getMediaInfo(
|
|
||||||
epData,
|
|
||||||
meta,
|
|
||||||
index,
|
|
||||||
done)
|
|
||||||
awaitLinks(remoteMediaClient?.load(info, true, 0)) {
|
|
||||||
loadIndex(index + 1)
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
awaitLinks(
|
awaitLinks(
|
||||||
remoteMediaClient?.queueAppendItem(
|
remoteMediaClient?.queueAppendItem(
|
||||||
|
|
@ -374,7 +323,6 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
println("FAILED TO LOAD NEXT ITEM")
|
println("FAILED TO LOAD NEXT ITEM")
|
||||||
// loadIndex(1)
|
|
||||||
}
|
}
|
||||||
isLoadingMore = false
|
isLoadingMore = false
|
||||||
}
|
}
|
||||||
|
|
@ -397,10 +345,7 @@ class SelectSourceController(val view: ImageView, val activity: ControllerActivi
|
||||||
|
|
||||||
class SkipTimeController(val view: ImageView, forwards: Boolean) : UIController() {
|
class SkipTimeController(val view: ImageView, forwards: Boolean) : UIController() {
|
||||||
init {
|
init {
|
||||||
//val settingsManager = PreferenceManager.getDefaultSharedPreferences()
|
|
||||||
//val time = settingsManager?.getInt("chromecast_tap_time", 30) ?: 30
|
|
||||||
val time = 30
|
val time = 30
|
||||||
//view.setImageResource(if (forwards) R.drawable.netflix_skip_forward else R.drawable.netflix_skip_back)
|
|
||||||
view.setImageResource(if (forwards) R.drawable.go_forward_30 else R.drawable.go_back_30)
|
view.setImageResource(if (forwards) R.drawable.go_forward_30 else R.drawable.go_back_30)
|
||||||
view.setOnClickListener {
|
view.setOnClickListener {
|
||||||
remoteMediaClient?.let {
|
remoteMediaClient?.let {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.lagradost.api.Log
|
import com.lagradost.api.Log
|
||||||
|
import com.lagradost.cloudstream3.CloudStreamApp
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
import com.lagradost.cloudstream3.isEpisodeBased
|
import com.lagradost.cloudstream3.isEpisodeBased
|
||||||
import com.lagradost.cloudstream3.mvvm.Resource
|
import com.lagradost.cloudstream3.mvvm.Resource
|
||||||
|
|
@ -36,6 +37,7 @@ import com.lagradost.cloudstream3.utils.ResourceLiveData
|
||||||
import com.lagradost.cloudstream3.utils.downloader.DownloadObjects
|
import com.lagradost.cloudstream3.utils.downloader.DownloadObjects
|
||||||
import com.lagradost.cloudstream3.utils.downloader.DownloadQueueManager
|
import com.lagradost.cloudstream3.utils.downloader.DownloadQueueManager
|
||||||
import com.lagradost.cloudstream3.utils.downloader.VideoDownloadManager.deleteFilesAndUpdateSettings
|
import com.lagradost.cloudstream3.utils.downloader.VideoDownloadManager.deleteFilesAndUpdateSettings
|
||||||
|
import com.lagradost.cloudstream3.utils.downloader.VideoDownloadManager.downloadDeleteEvent
|
||||||
import com.lagradost.cloudstream3.utils.downloader.VideoDownloadManager.getDownloadFileInfo
|
import com.lagradost.cloudstream3.utils.downloader.VideoDownloadManager.getDownloadFileInfo
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
@ -67,6 +69,17 @@ class DownloadViewModel : ViewModel() {
|
||||||
private val _selectedItemIds = ConsistentLiveData<Set<Int>?>(null)
|
private val _selectedItemIds = ConsistentLiveData<Set<Int>?>(null)
|
||||||
val selectedItemIds: LiveData<Set<Int>?> = _selectedItemIds
|
val selectedItemIds: LiveData<Set<Int>?> = _selectedItemIds
|
||||||
|
|
||||||
|
init {
|
||||||
|
// Keep the Downloads list in sync when a download is deleted/cancelled from
|
||||||
|
// anywhere in the app (result page button, queue, notification, etc.). See
|
||||||
|
// onDownloadDeleted for the rationale (issue #1227).
|
||||||
|
downloadDeleteEvent += ::onDownloadDeleted
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCleared() {
|
||||||
|
downloadDeleteEvent -= ::onDownloadDeleted
|
||||||
|
super.onCleared()
|
||||||
|
}
|
||||||
|
|
||||||
fun cancelSelection() {
|
fun cancelSelection() {
|
||||||
updateSelectedItems { null }
|
updateSelectedItems { null }
|
||||||
|
|
@ -389,6 +402,18 @@ class DownloadViewModel : ViewModel() {
|
||||||
postChildren(_childCards.success?.filter { it.data.id !in idsToRemove })
|
postChildren(_childCards.success?.filter { it.data.id !in idsToRemove })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refreshes the Downloads screen in real time when a download is deleted/cancelled.
|
||||||
|
*/
|
||||||
|
private fun onDownloadDeleted(id: Int) {
|
||||||
|
// Keep multi-select state consistent: forget the removed id if it was selected.
|
||||||
|
updateSelectedItems { it?.minus(id) }
|
||||||
|
|
||||||
|
val context = CloudStreamApp.context ?: return
|
||||||
|
updateHeaderList(context)
|
||||||
|
postChildren(_childCards.success?.filterNot { it.data.id == id })
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateStorageStats(visual: List<VisualDownloadCached.Header>) {
|
private fun updateStorageStats(visual: List<VisualDownloadCached.Header>) {
|
||||||
try {
|
try {
|
||||||
val stat = StatFs(Environment.getExternalStorageDirectory().path)
|
val stat = StatFs(Environment.getExternalStorageDirectory().path)
|
||||||
|
|
@ -584,4 +609,4 @@ class DownloadViewModel : ViewModel() {
|
||||||
val names: List<String>,
|
val names: List<String>,
|
||||||
val parentName: String?
|
val parentName: String?
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,9 +164,11 @@ abstract class BaseFetchButton(context: Context, attributeSet: AttributeSet) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*fun downloadDeleteEvent(data: Int) {
|
fun downloadDeleteEvent(data: Int) {
|
||||||
|
if (data == persistentId) {
|
||||||
}*/
|
resetView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*fun downloadEvent(data: Pair<Int, VideoDownloadManager.DownloadActionType>) {
|
/*fun downloadEvent(data: Pair<Int, VideoDownloadManager.DownloadActionType>) {
|
||||||
val (id, action) = data
|
val (id, action) = data
|
||||||
|
|
@ -185,7 +187,7 @@ abstract class BaseFetchButton(context: Context, attributeSet: AttributeSet) :
|
||||||
|
|
||||||
override fun onAttachedToWindow() {
|
override fun onAttachedToWindow() {
|
||||||
VideoDownloadManager.downloadStatusEvent += ::downloadStatusEvent
|
VideoDownloadManager.downloadStatusEvent += ::downloadStatusEvent
|
||||||
// VideoDownloadManager.downloadDeleteEvent += ::downloadDeleteEvent
|
VideoDownloadManager.downloadDeleteEvent += ::downloadDeleteEvent
|
||||||
// VideoDownloadManager.downloadEvent += ::downloadEvent
|
// VideoDownloadManager.downloadEvent += ::downloadEvent
|
||||||
VideoDownloadManager.downloadProgressEvent += ::downloadProgressEvent
|
VideoDownloadManager.downloadProgressEvent += ::downloadProgressEvent
|
||||||
|
|
||||||
|
|
@ -200,7 +202,7 @@ abstract class BaseFetchButton(context: Context, attributeSet: AttributeSet) :
|
||||||
|
|
||||||
override fun onDetachedFromWindow() {
|
override fun onDetachedFromWindow() {
|
||||||
VideoDownloadManager.downloadStatusEvent -= ::downloadStatusEvent
|
VideoDownloadManager.downloadStatusEvent -= ::downloadStatusEvent
|
||||||
// VideoDownloadManager.downloadDeleteEvent -= ::downloadDeleteEvent
|
VideoDownloadManager.downloadDeleteEvent -= ::downloadDeleteEvent
|
||||||
// VideoDownloadManager.downloadEvent -= ::downloadEvent
|
// VideoDownloadManager.downloadEvent -= ::downloadEvent
|
||||||
VideoDownloadManager.downloadProgressEvent -= ::downloadProgressEvent
|
VideoDownloadManager.downloadProgressEvent -= ::downloadProgressEvent
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -451,7 +451,14 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(
|
||||||
arrayAdapter.clear()
|
arrayAdapter.clear()
|
||||||
val sortedApis = validAPIs
|
val sortedApis = validAPIs
|
||||||
.filter {
|
.filter {
|
||||||
it.hasMainPage && (pinnedphashset.contains(it.name) || it.supportedTypes.any(
|
val isPinned = pinnedphashset.contains(it.name)
|
||||||
|
|
||||||
|
// Hide pinned NSFW when NSFW not selected. NSFW is distracting when not chosen.
|
||||||
|
if (isPinned && !preSelectedTypes.contains(TvType.NSFW)) {
|
||||||
|
if (it.supportedTypes.all { type -> type == TvType.NSFW }) return@filter false
|
||||||
|
}
|
||||||
|
|
||||||
|
it.hasMainPage && (isPinned || it.supportedTypes.any(
|
||||||
preSelectedTypes::contains
|
preSelectedTypes::contains
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -665,7 +672,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(
|
||||||
fromUI = true
|
fromUI = true
|
||||||
)
|
)
|
||||||
showToast(R.string.action_reload, Toast.LENGTH_SHORT)
|
showToast(R.string.action_reload, Toast.LENGTH_SHORT)
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
homePreviewSearchButton.setOnClickListener { _ ->
|
homePreviewSearchButton.setOnClickListener { _ ->
|
||||||
|
|
|
||||||
|
|
@ -719,7 +719,7 @@ class CS3IPlayer : IPlayer {
|
||||||
**/
|
**/
|
||||||
var preferredAudioTrackLanguage: String? = null
|
var preferredAudioTrackLanguage: String? = null
|
||||||
get() {
|
get() {
|
||||||
return field ?: getKey(
|
return field ?: getKey<String>(
|
||||||
"$currentAccount/$PREFERRED_AUDIO_LANGUAGE_KEY",
|
"$currentAccount/$PREFERRED_AUDIO_LANGUAGE_KEY",
|
||||||
field
|
field
|
||||||
)?.also {
|
)?.also {
|
||||||
|
|
|
||||||
|
|
@ -1202,6 +1202,10 @@ open class FullScreenPlayer : AbstractPlayerFragment<FragmentPlayerBinding>(
|
||||||
}
|
}
|
||||||
|
|
||||||
skipChapterButton.setOnClickListener {
|
skipChapterButton.setOnClickListener {
|
||||||
|
// Switch focus for a better UX, as otherwise it is reset to a random button like "back button"
|
||||||
|
if(skipChapterButton.hasFocus()) {
|
||||||
|
playerPausePlay.requestFocus()
|
||||||
|
}
|
||||||
player.handleEvent(CSPlayerEvent.SkipCurrentChapter)
|
player.handleEvent(CSPlayerEvent.SkipCurrentChapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -509,7 +509,8 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
|
|
||||||
showDownloadProgress(DownloadEvent(0, 0, 0, null))
|
showDownloadProgress(DownloadEvent(0, 0, 0, null))
|
||||||
|
|
||||||
uiReset()
|
// uiReset() // Removed due to UX
|
||||||
|
|
||||||
currentSelectedLink = link
|
currentSelectedLink = link
|
||||||
// setEpisodes(viewModel.getAllMeta() ?: emptyList())
|
// setEpisodes(viewModel.getAllMeta() ?: emptyList())
|
||||||
setPlayerDimen(null)
|
setPlayerDimen(null)
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,14 @@ import androidx.annotation.OptIn
|
||||||
import androidx.media3.common.MimeTypes
|
import androidx.media3.common.MimeTypes
|
||||||
import androidx.media3.common.util.UnstableApi
|
import androidx.media3.common.util.UnstableApi
|
||||||
import androidx.media3.ui.SubtitleView
|
import androidx.media3.ui.SubtitleView
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.ui.subtitles.SaveCaptionStyle
|
import com.lagradost.cloudstream3.ui.subtitles.SaveCaptionStyle
|
||||||
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.setSubtitleViewStyle
|
import com.lagradost.cloudstream3.ui.subtitles.SubtitlesFragment.Companion.setSubtitleViewStyle
|
||||||
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromLanguageToTagIETF
|
import com.lagradost.cloudstream3.utils.SubtitleHelper.fromLanguageToTagIETF
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
enum class SubtitleStatus {
|
enum class SubtitleStatus {
|
||||||
IS_ACTIVE,
|
IS_ACTIVE,
|
||||||
|
|
@ -32,17 +35,19 @@ enum class SubtitleOrigin {
|
||||||
* @param url Url for the subtitle, when EMBEDDED_IN_VIDEO this variable is used as the real backend id
|
* @param url Url for the subtitle, when EMBEDDED_IN_VIDEO this variable is used as the real backend id
|
||||||
* @param headers if empty it will use the base onlineDataSource headers else only the specified headers
|
* @param headers if empty it will use the base onlineDataSource headers else only the specified headers
|
||||||
* @param languageCode usually, tags such as "en", "es-mx", or "zh-hant-TW". But it could be something like "English 4"
|
* @param languageCode usually, tags such as "en", "es-mx", or "zh-hant-TW". But it could be something like "English 4"
|
||||||
* */
|
*/
|
||||||
|
@Serializable
|
||||||
data class SubtitleData(
|
data class SubtitleData(
|
||||||
val originalName: String,
|
@SerialName("originalName") val originalName: String,
|
||||||
val nameSuffix: String,
|
@SerialName("nameSuffix") val nameSuffix: String,
|
||||||
val url: String,
|
@SerialName("url") val url: String,
|
||||||
val origin: SubtitleOrigin,
|
@SerialName("origin") val origin: SubtitleOrigin,
|
||||||
val mimeType: String,
|
@SerialName("mimeType") val mimeType: String,
|
||||||
val headers: Map<String, String>,
|
@SerialName("headers") val headers: Map<String, String>,
|
||||||
val languageCode: String?,
|
@SerialName("languageCode") val languageCode: String?,
|
||||||
) {
|
) {
|
||||||
/** Internal ID for exoplayer, unique for each link*/
|
/** Internal ID for media3, unique for each link. */
|
||||||
|
@JsonIgnore
|
||||||
fun getId(): String {
|
fun getId(): String {
|
||||||
return if (origin == SubtitleOrigin.EMBEDDED_IN_VIDEO) url
|
return if (origin == SubtitleOrigin.EMBEDDED_IN_VIDEO) url
|
||||||
else "$url|$name"
|
else "$url|$name"
|
||||||
|
|
@ -54,22 +59,22 @@ data class SubtitleData(
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tries hard to figure out a valid IETF tag based on language code and name. Will return null if not found. */
|
/** Tries hard to figure out a valid IETF tag based on language code and name. Will return null if not found. */
|
||||||
|
@JsonIgnore
|
||||||
fun getIETF_tag(): String? {
|
fun getIETF_tag(): String? {
|
||||||
return fromLanguageToTagIETF(this.languageCode) ?: fromLanguageToTagIETF(this.originalName, halfMatch = true)
|
return fromLanguageToTagIETF(this.languageCode) ?: fromLanguageToTagIETF(this.originalName, halfMatch = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
val name = "$originalName $nameSuffix"
|
@SerialName("name") val name = "$originalName $nameSuffix"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the URL, but tries to fix it if it is malformed.
|
* Gets the URL, but tries to fix it if it is malformed.
|
||||||
*/
|
*/
|
||||||
|
@JsonIgnore
|
||||||
fun getFixedUrl(): String {
|
fun getFixedUrl(): String {
|
||||||
// Some extensions fail to include the protocol, this helps with that.
|
// Some extensions fail to include the protocol, this helps with that.
|
||||||
val fixedSubUrl = if (this.url.startsWith("//")) {
|
val fixedSubUrl = if (this.url.startsWith("//")) {
|
||||||
"https:${this.url}"
|
"https:${this.url}"
|
||||||
} else {
|
} else this.url
|
||||||
this.url
|
|
||||||
}
|
|
||||||
return fixedSubUrl
|
return fixedSubUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -142,4 +147,4 @@ class PlayerSubtitleHelper {
|
||||||
setSubStyle(it)
|
setSubStyle(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import com.lagradost.cloudstream3.mvvm.logError
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import torrServer.TorrServer
|
import torrServer.TorrServer
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.ConnectException
|
import java.net.ConnectException
|
||||||
|
|
@ -32,14 +34,14 @@ object Torrent {
|
||||||
|
|
||||||
/** Returns true if the server is up */
|
/** Returns true if the server is up */
|
||||||
private suspend fun echo(): Boolean {
|
private suspend fun echo(): Boolean {
|
||||||
if(TORRENT_SERVER_URL.isEmpty()) {
|
if (TORRENT_SERVER_URL.isEmpty()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return try {
|
return try {
|
||||||
app.get(
|
app.get(
|
||||||
"$TORRENT_SERVER_URL/echo",
|
"$TORRENT_SERVER_URL/echo",
|
||||||
).text.isNotEmpty()
|
).text.isNotEmpty()
|
||||||
} catch (e: ConnectException) {
|
} catch (_: ConnectException) {
|
||||||
// `Failed to connect to /127.0.0.1:8090` if the server is down
|
// `Failed to connect to /127.0.0.1:8090` if the server is down
|
||||||
false
|
false
|
||||||
} catch (t: Throwable) {
|
} catch (t: Throwable) {
|
||||||
|
|
@ -52,7 +54,7 @@ object Torrent {
|
||||||
/** Gracefully shutdown the server.
|
/** Gracefully shutdown the server.
|
||||||
* should not be used because I am unable to start it again, and the stopTorrentServer() crashes the app */
|
* should not be used because I am unable to start it again, and the stopTorrentServer() crashes the app */
|
||||||
suspend fun shutdown(): Boolean {
|
suspend fun shutdown(): Boolean {
|
||||||
if(TORRENT_SERVER_URL.isEmpty()) {
|
if (TORRENT_SERVER_URL.isEmpty()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return try {
|
return try {
|
||||||
|
|
@ -68,7 +70,7 @@ object Torrent {
|
||||||
/** Lists all torrents by the server */
|
/** Lists all torrents by the server */
|
||||||
@Throws
|
@Throws
|
||||||
private suspend fun list(): Array<TorrentStatus> {
|
private suspend fun list(): Array<TorrentStatus> {
|
||||||
if(TORRENT_SERVER_URL.isEmpty()) {
|
if (TORRENT_SERVER_URL.isEmpty()) {
|
||||||
throw ErrorLoadingException("Not initialized")
|
throw ErrorLoadingException("Not initialized")
|
||||||
}
|
}
|
||||||
return app.post(
|
return app.post(
|
||||||
|
|
@ -83,7 +85,7 @@ object Torrent {
|
||||||
|
|
||||||
/** Drops a single torrent, (I think) this means closing the stream. Returns returns if it is successful */
|
/** Drops a single torrent, (I think) this means closing the stream. Returns returns if it is successful */
|
||||||
private suspend fun drop(hash: String): Boolean {
|
private suspend fun drop(hash: String): Boolean {
|
||||||
if(TORRENT_SERVER_URL.isEmpty()) {
|
if (TORRENT_SERVER_URL.isEmpty()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return try {
|
return try {
|
||||||
|
|
@ -104,7 +106,7 @@ object Torrent {
|
||||||
|
|
||||||
/** Removes a single torrent from the server registry */
|
/** Removes a single torrent from the server registry */
|
||||||
private suspend fun rem(hash: String): Boolean {
|
private suspend fun rem(hash: String): Boolean {
|
||||||
if(TORRENT_SERVER_URL.isEmpty()) {
|
if (TORRENT_SERVER_URL.isEmpty()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return try {
|
return try {
|
||||||
|
|
@ -126,7 +128,7 @@ object Torrent {
|
||||||
|
|
||||||
/** Removes all torrents from the server, and returns if it is successful */
|
/** Removes all torrents from the server, and returns if it is successful */
|
||||||
suspend fun clearAll(): Boolean {
|
suspend fun clearAll(): Boolean {
|
||||||
if(TORRENT_SERVER_URL.isEmpty()) {
|
if (TORRENT_SERVER_URL.isEmpty()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return try {
|
return try {
|
||||||
|
|
@ -164,10 +166,8 @@ object Torrent {
|
||||||
/** Gets all the metadata of a torrent, will throw if that hash does not exists
|
/** Gets all the metadata of a torrent, will throw if that hash does not exists
|
||||||
* https://github.com/Diegopyl1209/torrentserver-aniyomi/blob/c18f58e51b6738f053261bc863177078aa9c1c98/web/api/torrents.go#L126 */
|
* https://github.com/Diegopyl1209/torrentserver-aniyomi/blob/c18f58e51b6738f053261bc863177078aa9c1c98/web/api/torrents.go#L126 */
|
||||||
@Throws
|
@Throws
|
||||||
suspend fun get(
|
suspend fun get(hash: String): TorrentStatus {
|
||||||
hash: String,
|
if (TORRENT_SERVER_URL.isEmpty()) {
|
||||||
): TorrentStatus {
|
|
||||||
if(TORRENT_SERVER_URL.isEmpty()) {
|
|
||||||
throw ErrorLoadingException("Not initialized")
|
throw ErrorLoadingException("Not initialized")
|
||||||
}
|
}
|
||||||
return app.post(
|
return app.post(
|
||||||
|
|
@ -184,7 +184,7 @@ object Torrent {
|
||||||
/** Adds a torrent to the server, this is needed for us to get the hash for further modification, as well as start streaming it*/
|
/** Adds a torrent to the server, this is needed for us to get the hash for further modification, as well as start streaming it*/
|
||||||
@Throws
|
@Throws
|
||||||
private suspend fun add(url: String): TorrentStatus {
|
private suspend fun add(url: String): TorrentStatus {
|
||||||
if(TORRENT_SERVER_URL.isEmpty()) {
|
if (TORRENT_SERVER_URL.isEmpty()) {
|
||||||
throw ErrorLoadingException("Not initialized")
|
throw ErrorLoadingException("Not initialized")
|
||||||
}
|
}
|
||||||
return app.post(
|
return app.post(
|
||||||
|
|
@ -204,7 +204,7 @@ object Torrent {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
val port = TorrServer.startTorrentServer(dir, 0)
|
val port = TorrServer.startTorrentServer(dir, 0)
|
||||||
if(port < 0) {
|
if (port < 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
TORRENT_SERVER_URL = "http://127.0.0.1:$port"
|
TORRENT_SERVER_URL = "http://127.0.0.1:$port"
|
||||||
|
|
@ -278,94 +278,55 @@ object Torrent {
|
||||||
|
|
||||||
// https://github.com/Diegopyl1209/torrentserver-aniyomi/blob/c18f58e51b6738f053261bc863177078aa9c1c98/web/api/torrents.go#L18
|
// https://github.com/Diegopyl1209/torrentserver-aniyomi/blob/c18f58e51b6738f053261bc863177078aa9c1c98/web/api/torrents.go#L18
|
||||||
// https://github.com/Diegopyl1209/torrentserver-aniyomi/blob/main/web/api/route.go#L7
|
// https://github.com/Diegopyl1209/torrentserver-aniyomi/blob/main/web/api/route.go#L7
|
||||||
|
@Serializable
|
||||||
data class TorrentRequest(
|
data class TorrentRequest(
|
||||||
@JsonProperty("action")
|
@JsonProperty("action") @SerialName("action") val action: String,
|
||||||
val action: String,
|
@JsonProperty("hash") @SerialName("hash") val hash: String = "",
|
||||||
@JsonProperty("hash")
|
@JsonProperty("link") @SerialName("link") val link: String = "",
|
||||||
val hash: String = "",
|
@JsonProperty("title") @SerialName("title") val title: String = "",
|
||||||
@JsonProperty("link")
|
@JsonProperty("poster") @SerialName("poster") val poster: String = "",
|
||||||
val link: String = "",
|
@JsonProperty("data") @SerialName("data") val data: String = "",
|
||||||
@JsonProperty("title")
|
@JsonProperty("save_to_db") @SerialName("save_to_db") val saveToDB: Boolean = false,
|
||||||
val title: String = "",
|
|
||||||
@JsonProperty("poster")
|
|
||||||
val poster: String = "",
|
|
||||||
@JsonProperty("data")
|
|
||||||
val data: String = "",
|
|
||||||
@JsonProperty("save_to_db")
|
|
||||||
val saveToDB: Boolean = false,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// https://github.com/Diegopyl1209/torrentserver-aniyomi/blob/c18f58e51b6738f053261bc863177078aa9c1c98/torr/state/state.go#L33
|
// https://github.com/Diegopyl1209/torrentserver-aniyomi/blob/c18f58e51b6738f053261bc863177078aa9c1c98/torr/state/state.go#L33
|
||||||
// omitempty = nullable
|
// omitempty = nullable
|
||||||
|
@Serializable
|
||||||
data class TorrentStatus(
|
data class TorrentStatus(
|
||||||
@JsonProperty("title")
|
@JsonProperty("title") @SerialName("title") var title: String,
|
||||||
var title: String,
|
@JsonProperty("poster") @SerialName("poster") var poster: String,
|
||||||
@JsonProperty("poster")
|
@JsonProperty("data") @SerialName("data") var data: String?,
|
||||||
var poster: String,
|
@JsonProperty("timestamp") @SerialName("timestamp") var timestamp: Long,
|
||||||
@JsonProperty("data")
|
@JsonProperty("name") @SerialName("name") var name: String?,
|
||||||
var data: String?,
|
@JsonProperty("hash") @SerialName("hash") var hash: String?,
|
||||||
@JsonProperty("timestamp")
|
@JsonProperty("stat") @SerialName("stat") var stat: Int,
|
||||||
var timestamp: Long,
|
@JsonProperty("stat_string") @SerialName("stat_string") var statString: String,
|
||||||
@JsonProperty("name")
|
@JsonProperty("loaded_size") @SerialName("loaded_size") var loadedSize: Long?,
|
||||||
var name: String?,
|
@JsonProperty("torrent_size") @SerialName("torrent_size") var torrentSize: Long?,
|
||||||
@JsonProperty("hash")
|
@JsonProperty("preloaded_bytes") @SerialName("preloaded_bytes") var preloadedBytes: Long?,
|
||||||
var hash: String?,
|
@JsonProperty("preload_size") @SerialName("preload_size") var preloadSize: Long?,
|
||||||
@JsonProperty("stat")
|
@JsonProperty("download_speed") @SerialName("download_speed") var downloadSpeed: Double?,
|
||||||
var stat: Int,
|
@JsonProperty("upload_speed") @SerialName("upload_speed") var uploadSpeed: Double?,
|
||||||
@JsonProperty("stat_string")
|
@JsonProperty("total_peers") @SerialName("total_peers") var totalPeers: Int?,
|
||||||
var statString: String,
|
@JsonProperty("pending_peers") @SerialName("pending_peers") var pendingPeers: Int?,
|
||||||
@JsonProperty("loaded_size")
|
@JsonProperty("active_peers") @SerialName("active_peers") var activePeers: Int?,
|
||||||
var loadedSize: Long?,
|
@JsonProperty("connected_seeders") @SerialName("connected_seeders") var connectedSeeders: Int?,
|
||||||
@JsonProperty("torrent_size")
|
@JsonProperty("half_open_peers") @SerialName("half_open_peers") var halfOpenPeers: Int?,
|
||||||
var torrentSize: Long?,
|
@JsonProperty("bytes_written") @SerialName("bytes_written") var bytesWritten: Long?,
|
||||||
@JsonProperty("preloaded_bytes")
|
@JsonProperty("bytes_written_data") @SerialName("bytes_written_data") var bytesWrittenData: Long?,
|
||||||
var preloadedBytes: Long?,
|
@JsonProperty("bytes_read") @SerialName("bytes_read") var bytesRead: Long?,
|
||||||
@JsonProperty("preload_size")
|
@JsonProperty("bytes_read_data") @SerialName("bytes_read_data") var bytesReadData: Long?,
|
||||||
var preloadSize: Long?,
|
@JsonProperty("bytes_read_useful_data") @SerialName("bytes_read_useful_data") var bytesReadUsefulData: Long?,
|
||||||
@JsonProperty("download_speed")
|
@JsonProperty("chunks_written") @SerialName("chunks_written") var chunksWritten: Long?,
|
||||||
var downloadSpeed: Double?,
|
@JsonProperty("chunks_read") @SerialName("chunks_read") var chunksRead: Long?,
|
||||||
@JsonProperty("upload_speed")
|
@JsonProperty("chunks_read_useful") @SerialName("chunks_read_useful") var chunksReadUseful: Long?,
|
||||||
var uploadSpeed: Double?,
|
@JsonProperty("chunks_read_wasted") @SerialName("chunks_read_wasted") var chunksReadWasted: Long?,
|
||||||
@JsonProperty("total_peers")
|
@JsonProperty("pieces_dirtied_good") @SerialName("pieces_dirtied_good") var piecesDirtiedGood: Long?,
|
||||||
var totalPeers: Int?,
|
@JsonProperty("pieces_dirtied_bad") @SerialName("pieces_dirtied_bad") var piecesDirtiedBad: Long?,
|
||||||
@JsonProperty("pending_peers")
|
@JsonProperty("duration_seconds") @SerialName("duration_seconds") var durationSeconds: Double?,
|
||||||
var pendingPeers: Int?,
|
@JsonProperty("bit_rate") @SerialName("bit_rate") var bitRate: String?,
|
||||||
@JsonProperty("active_peers")
|
@JsonProperty("file_stats") @SerialName("file_stats") var fileStats: List<TorrentFileStat>?,
|
||||||
var activePeers: Int?,
|
@JsonProperty("trackers") @SerialName("trackers") var trackers: List<String>?,
|
||||||
@JsonProperty("connected_seeders")
|
|
||||||
var connectedSeeders: Int?,
|
|
||||||
@JsonProperty("half_open_peers")
|
|
||||||
var halfOpenPeers: Int?,
|
|
||||||
@JsonProperty("bytes_written")
|
|
||||||
var bytesWritten: Long?,
|
|
||||||
@JsonProperty("bytes_written_data")
|
|
||||||
var bytesWrittenData: Long?,
|
|
||||||
@JsonProperty("bytes_read")
|
|
||||||
var bytesRead: Long?,
|
|
||||||
@JsonProperty("bytes_read_data")
|
|
||||||
var bytesReadData: Long?,
|
|
||||||
@JsonProperty("bytes_read_useful_data")
|
|
||||||
var bytesReadUsefulData: Long?,
|
|
||||||
@JsonProperty("chunks_written")
|
|
||||||
var chunksWritten: Long?,
|
|
||||||
@JsonProperty("chunks_read")
|
|
||||||
var chunksRead: Long?,
|
|
||||||
@JsonProperty("chunks_read_useful")
|
|
||||||
var chunksReadUseful: Long?,
|
|
||||||
@JsonProperty("chunks_read_wasted")
|
|
||||||
var chunksReadWasted: Long?,
|
|
||||||
@JsonProperty("pieces_dirtied_good")
|
|
||||||
var piecesDirtiedGood: Long?,
|
|
||||||
@JsonProperty("pieces_dirtied_bad")
|
|
||||||
var piecesDirtiedBad: Long?,
|
|
||||||
@JsonProperty("duration_seconds")
|
|
||||||
var durationSeconds: Double?,
|
|
||||||
@JsonProperty("bit_rate")
|
|
||||||
var bitRate: String?,
|
|
||||||
@JsonProperty("file_stats")
|
|
||||||
var fileStats: List<TorrentFileStat>?,
|
|
||||||
@JsonProperty("trackers")
|
|
||||||
var trackers: List<String>?,
|
|
||||||
) {
|
) {
|
||||||
fun streamUrl(url: String): String {
|
fun streamUrl(url: String): String {
|
||||||
val fileName =
|
val fileName =
|
||||||
|
|
@ -381,12 +342,10 @@ object Torrent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class TorrentFileStat(
|
data class TorrentFileStat(
|
||||||
@JsonProperty("id")
|
@JsonProperty("id") @SerialName("id") val id: Int?,
|
||||||
val id: Int?,
|
@JsonProperty("path") @SerialName("path") val path: String?,
|
||||||
@JsonProperty("path")
|
@JsonProperty("length") @SerialName("length") val length: Long?,
|
||||||
val path: String?,
|
|
||||||
@JsonProperty("length")
|
|
||||||
val length: Long?,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ object QualityDataHelper {
|
||||||
|
|
||||||
fun getSourcePriority(profile: Int, name: String?): Int {
|
fun getSourcePriority(profile: Int, name: String?): Int {
|
||||||
if (name == null) return DEFAULT_SOURCE_PRIORITY
|
if (name == null) return DEFAULT_SOURCE_PRIORITY
|
||||||
return getKey(
|
return getKey<Int>(
|
||||||
"$currentAccount/$VIDEO_SOURCE_PRIORITY/$profile",
|
"$currentAccount/$VIDEO_SOURCE_PRIORITY/$profile",
|
||||||
name,
|
name,
|
||||||
DEFAULT_SOURCE_PRIORITY
|
DEFAULT_SOURCE_PRIORITY
|
||||||
|
|
@ -94,7 +94,7 @@ object QualityDataHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getQualityPriority(profile: Int, quality: Qualities): Int {
|
fun getQualityPriority(profile: Int, quality: Qualities): Int {
|
||||||
return getKey(
|
return getKey<Int>(
|
||||||
"$currentAccount/$VIDEO_QUALITY_PRIORITY/$profile",
|
"$currentAccount/$VIDEO_QUALITY_PRIORITY/$profile",
|
||||||
quality.value.toString(),
|
quality.value.toString(),
|
||||||
quality.defaultPriority
|
quality.defaultPriority
|
||||||
|
|
@ -223,4 +223,4 @@ object QualityDataHelper {
|
||||||
if (target == null) return Qualities.Unknown
|
if (target == null) return Qualities.Unknown
|
||||||
return Qualities.entries.minBy { abs(it.value - target) }
|
return Qualities.entries.minBy { abs(it.value - target) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ import android.content.Intent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.animation.Animation
|
||||||
|
import android.view.animation.OvershootInterpolator
|
||||||
|
import android.view.animation.ScaleAnimation
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.lagradost.cloudstream3.ActorData
|
import com.lagradost.cloudstream3.ActorData
|
||||||
import com.lagradost.cloudstream3.ActorRole
|
import com.lagradost.cloudstream3.ActorRole
|
||||||
|
|
@ -46,6 +49,24 @@ class ActorAdaptor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onUpdateContent(holder: ViewHolderState<Any>, item: ActorData, position: Int) {
|
||||||
|
when (val binding = holder.view) {
|
||||||
|
is CastItemBinding -> {
|
||||||
|
val anim: Animation = ScaleAnimation(
|
||||||
|
0.8f, 1f,
|
||||||
|
0.8f, 1f,
|
||||||
|
Animation.RELATIVE_TO_SELF, 0.5f,
|
||||||
|
Animation.RELATIVE_TO_SELF, 0.5f
|
||||||
|
)
|
||||||
|
anim.fillAfter = true
|
||||||
|
anim.duration = 200
|
||||||
|
anim.interpolator = OvershootInterpolator()
|
||||||
|
binding.voiceActorImageHolder2.startAnimation(anim)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onUpdateContent(holder, item, position)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onBindContent(holder: ViewHolderState<Any>, item: ActorData, position: Int) {
|
override fun onBindContent(holder: ViewHolderState<Any>, item: ActorData, position: Int) {
|
||||||
when (val binding = holder.view) {
|
when (val binding = holder.view) {
|
||||||
is CastItemBinding -> {
|
is CastItemBinding -> {
|
||||||
|
|
@ -137,4 +158,4 @@ class ActorAdaptor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos
|
||||||
import com.lagradost.cloudstream3.utils.Event
|
import com.lagradost.cloudstream3.utils.Event
|
||||||
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
|
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
|
||||||
import com.lagradost.cloudstream3.utils.UiImage
|
import com.lagradost.cloudstream3.utils.UiImage
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
const val START_ACTION_RESUME_LATEST = 1
|
const val START_ACTION_RESUME_LATEST = 1
|
||||||
const val START_ACTION_LOAD_EP = 2
|
const val START_ACTION_LOAD_EP = 2
|
||||||
|
|
@ -34,33 +36,32 @@ enum class VideoWatchState {
|
||||||
Watched
|
Watched
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class ResultEpisode(
|
data class ResultEpisode(
|
||||||
val headerName: String,
|
@SerialName("headerName") val headerName: String,
|
||||||
val name: String?,
|
@SerialName("name") val name: String?,
|
||||||
val poster: String?,
|
@SerialName("poster") val poster: String?,
|
||||||
val episode: Int,
|
@SerialName("episode") val episode: Int,
|
||||||
val seasonIndex: Int?, // this is the "season" index used season names
|
@SerialName("seasonIndex") val seasonIndex: Int?, // this is the "season" index used season names
|
||||||
val season: Int?, // this is the display
|
@SerialName("season") val season: Int?, // this is the display
|
||||||
val data: String,
|
@SerialName("data") val data: String,
|
||||||
val apiName: String,
|
@SerialName("apiName") val apiName: String,
|
||||||
val id: Int,
|
@SerialName("id") val id: Int,
|
||||||
val index: Int,
|
@SerialName("index") val index: Int,
|
||||||
val position: Long, // time in MS
|
@SerialName("position") val position: Long, // time in MS
|
||||||
val duration: Long, // duration in MS
|
@SerialName("duration") val duration: Long, // duration in MS
|
||||||
val score: Score?,
|
@SerialName("score") val score: Score?,
|
||||||
val description: String?,
|
@SerialName("description") val description: String?,
|
||||||
val isFiller: Boolean?,
|
@SerialName("isFiller") val isFiller: Boolean?,
|
||||||
val tvType: TvType,
|
@SerialName("tvType") val tvType: TvType,
|
||||||
val parentId: Int,
|
@SerialName("parentId") val parentId: Int,
|
||||||
/**
|
/** Conveys if the episode itself is marked as watched. */
|
||||||
* Conveys if the episode itself is marked as watched
|
@SerialName("videoWatchState") val videoWatchState: VideoWatchState,
|
||||||
**/
|
/** Sum of all previous season episode counts + episode. */
|
||||||
val videoWatchState: VideoWatchState,
|
@SerialName("totalEpisodeIndex") val totalEpisodeIndex: Int? = null,
|
||||||
/** Sum of all previous season episode counts + episode */
|
@SerialName("airDate") val airDate: Long? = null,
|
||||||
val totalEpisodeIndex: Int? = null,
|
@SerialName("runTime") val runTime: Int? = null,
|
||||||
val airDate: Long? = null,
|
@SerialName("seasonData") val seasonData: SeasonData? = null,
|
||||||
val runTime: Int? = null,
|
|
||||||
val seasonData: SeasonData? = null,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fun ResultEpisode.getRealPosition(): Long {
|
fun ResultEpisode.getRealPosition(): Long {
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,7 @@ class SyncViewModel : ViewModel() {
|
||||||
fun publishUserData() = ioSafe {
|
fun publishUserData() = ioSafe {
|
||||||
Log.i(TAG, "publishUserData")
|
Log.i(TAG, "publishUserData")
|
||||||
val user = userData.value
|
val user = userData.value
|
||||||
|
_userDataResponse.postValue(Resource.Loading())
|
||||||
if (user is Resource.Success) {
|
if (user is Resource.Success) {
|
||||||
syncs.forEach { (prefix, id) ->
|
syncs.forEach { (prefix, id) ->
|
||||||
repos.firstOrNull { it.idPrefix == prefix }?.updateStatus(id, user.value)
|
repos.firstOrNull { it.idPrefix == prefix }?.updateStatus(id, user.value)
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ class SettingsFragment : BaseFragment<MainSettingsBinding>(
|
||||||
|
|
||||||
val appVersion = BuildConfig.VERSION_NAME
|
val appVersion = BuildConfig.VERSION_NAME
|
||||||
val commitHash = activity?.currentCommitHash() ?: ""
|
val commitHash = activity?.currentCommitHash() ?: ""
|
||||||
val buildTimestamp = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG,
|
val buildTimestamp = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM,
|
||||||
Locale.getDefault()
|
Locale.getDefault()
|
||||||
).apply { timeZone = TimeZone.getTimeZone("UTC")
|
).apply { timeZone = TimeZone.getTimeZone("UTC")
|
||||||
}.format(Date(BuildConfig.BUILD_DATE)).replace("UTC", "")
|
}.format(Date(BuildConfig.BUILD_DATE)).replace("UTC", "")
|
||||||
|
|
@ -262,4 +262,4 @@ class SettingsFragment : BaseFragment<MainSettingsBinding>(
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ class SettingsGeneral : BasePreferenceFragmentCompat() {
|
||||||
} ?: emptyList()
|
} ?: emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsManager.edit { putBoolean(getString(R.string.jsdelivr_proxy_key), getKey(getString(R.string.jsdelivr_proxy_key), false) ?: false) }
|
settingsManager.edit { putBoolean(getString(R.string.jsdelivr_proxy_key), getKey<Boolean>(getString(R.string.jsdelivr_proxy_key), false) ?: false) }
|
||||||
getPref(R.string.jsdelivr_proxy_key)?.setOnPreferenceChangeListener { _, newValue ->
|
getPref(R.string.jsdelivr_proxy_key)?.setOnPreferenceChangeListener { _, newValue ->
|
||||||
setKey(getString(R.string.jsdelivr_proxy_key), newValue)
|
setKey(getString(R.string.jsdelivr_proxy_key), newValue)
|
||||||
return@setOnPreferenceChangeListener true
|
return@setOnPreferenceChangeListener true
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ class ChromecastSubtitlesFragment : BaseFragment<ChromecastSubtitleSettingsBindi
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCurrentSavedStyle(): SaveChromeCaptionStyle {
|
fun getCurrentSavedStyle(): SaveChromeCaptionStyle {
|
||||||
return getKey(CHROME_SUBTITLE_KEY) ?: defaultState
|
return getKey<SaveChromeCaptionStyle>(CHROME_SUBTITLE_KEY) ?: defaultState
|
||||||
}
|
}
|
||||||
|
|
||||||
private val defaultState = SaveChromeCaptionStyle()
|
private val defaultState = SaveChromeCaptionStyle()
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ class SubtitlesFragment : BaseDialogFragment<SubtitleSettingsBinding>(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCurrentSavedStyle(): SaveCaptionStyle {
|
fun getCurrentSavedStyle(): SaveCaptionStyle {
|
||||||
return cachedSubtitleStyle ?: (getKey(SUBTITLE_KEY) ?: SaveCaptionStyle(
|
return cachedSubtitleStyle ?: (getKey<SaveCaptionStyle>(SUBTITLE_KEY) ?: SaveCaptionStyle(
|
||||||
foregroundColor = getDefColor(0),
|
foregroundColor = getDefColor(0),
|
||||||
backgroundColor = getDefColor(2),
|
backgroundColor = getDefColor(2),
|
||||||
windowColor = getDefColor(3),
|
windowColor = getDefColor(3),
|
||||||
|
|
@ -293,11 +293,11 @@ class SubtitlesFragment : BaseDialogFragment<SubtitleSettingsBinding>(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDownloadSubsLanguageTagIETF(): List<String> {
|
fun getDownloadSubsLanguageTagIETF(): List<String> {
|
||||||
return getKey(SUBTITLE_DOWNLOAD_KEY) ?: listOf("en")
|
return getKey<List<String>>(SUBTITLE_DOWNLOAD_KEY) ?: listOf("en")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAutoSelectLanguageTagIETF(): String {
|
fun getAutoSelectLanguageTagIETF(): String {
|
||||||
return getKey(SUBTITLE_AUTO_SELECT_KEY) ?: "en"
|
return getKey<String>(SUBTITLE_AUTO_SELECT_KEY) ?: "en"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,12 +90,9 @@ import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
import okhttp3.Cache
|
import okhttp3.Cache
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URL
|
|
||||||
import java.net.URLDecoder
|
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
|
|
||||||
object AppContextUtils {
|
object AppContextUtils {
|
||||||
fun RecyclerView.isRecyclerScrollable(): Boolean {
|
fun RecyclerView.isRecyclerScrollable(): Boolean {
|
||||||
val layoutManager =
|
val layoutManager =
|
||||||
|
|
@ -635,16 +632,17 @@ object AppContextUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun splitQuery(url: URL): Map<String, String> {
|
// Deprecate after next stable
|
||||||
val queryPairs: MutableMap<String, String> = LinkedHashMap()
|
/* @Deprecated(
|
||||||
val query: String = url.query
|
message = "Use splitUrlParameters instead.",
|
||||||
val pairs = query.split("&").toTypedArray()
|
replaceWith = ReplaceWith(
|
||||||
for (pair in pairs) {
|
expression = "splitUrlParameters(url.toString())",
|
||||||
val idx = pair.indexOf("=")
|
imports = ["com.lagradost.cloudstream3.splitUrlParameters"],
|
||||||
queryPairs[URLDecoder.decode(pair.substring(0, idx), "UTF-8")] =
|
),
|
||||||
URLDecoder.decode(pair.substring(idx + 1), "UTF-8")
|
level = DeprecationLevel.WARNING,
|
||||||
}
|
) */
|
||||||
return queryPairs
|
fun splitQuery(url: java.net.URL): Map<String, String> {
|
||||||
|
return com.lagradost.cloudstream3.splitUrlParameters(url.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**| S1:E2 Hello World
|
/**| S1:E2 Hello World
|
||||||
|
|
@ -902,4 +900,4 @@ object AppContextUtils {
|
||||||
} else null
|
} else null
|
||||||
return currentAudioFocusRequest
|
return currentAudioFocusRequest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.lagradost.cloudstream3.utils
|
package com.lagradost.cloudstream3.utils
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||||
import com.lagradost.cloudstream3.CloudStreamApp.Companion.context
|
import com.lagradost.cloudstream3.CloudStreamApp.Companion.context
|
||||||
|
|
@ -31,6 +32,12 @@ import com.lagradost.cloudstream3.ui.result.ResultEpisode
|
||||||
import com.lagradost.cloudstream3.ui.result.VideoWatchState
|
import com.lagradost.cloudstream3.ui.result.VideoWatchState
|
||||||
import com.lagradost.cloudstream3.utils.AppContextUtils.filterProviderByPreferredMedia
|
import com.lagradost.cloudstream3.utils.AppContextUtils.filterProviderByPreferredMedia
|
||||||
import com.lagradost.cloudstream3.utils.downloader.DownloadObjects
|
import com.lagradost.cloudstream3.utils.downloader.DownloadObjects
|
||||||
|
import com.lagradost.cloudstream3.utils.serializers.WriteOnlySerializer
|
||||||
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
|
import kotlinx.serialization.KeepGeneratedSerializer
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.Transient
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.GregorianCalendar
|
import java.util.GregorianCalendar
|
||||||
|
|
@ -43,17 +50,18 @@ const val RESULT_WATCH_STATE = "result_watch_state"
|
||||||
const val RESULT_WATCH_STATE_DATA = "result_watch_state_data"
|
const val RESULT_WATCH_STATE_DATA = "result_watch_state_data"
|
||||||
const val RESULT_SUBSCRIBED_STATE_DATA = "result_subscribed_state_data"
|
const val RESULT_SUBSCRIBED_STATE_DATA = "result_subscribed_state_data"
|
||||||
const val RESULT_FAVORITES_STATE_DATA = "result_favorites_state_data"
|
const val RESULT_FAVORITES_STATE_DATA = "result_favorites_state_data"
|
||||||
const val RESULT_RESUME_WATCHING = "result_resume_watching_2" // changed due to id changes
|
const val RESULT_RESUME_WATCHING = "result_resume_watching_2" // Changed due to id changes
|
||||||
const val RESULT_RESUME_WATCHING_OLD = "result_resume_watching"
|
const val RESULT_RESUME_WATCHING_OLD = "result_resume_watching"
|
||||||
const val RESULT_RESUME_WATCHING_HAS_MIGRATED = "result_resume_watching_migrated"
|
const val RESULT_RESUME_WATCHING_HAS_MIGRATED = "result_resume_watching_migrated"
|
||||||
const val RESULT_EPISODE = "result_episode"
|
const val RESULT_EPISODE = "result_episode"
|
||||||
const val RESULT_SEASON = "result_season"
|
const val RESULT_SEASON = "result_season"
|
||||||
const val RESULT_DUB = "result_dub"
|
const val RESULT_DUB = "result_dub"
|
||||||
const val KEY_RESULT_SORT = "result_sort"
|
const val KEY_RESULT_SORT = "result_sort"
|
||||||
const val USER_PINNED_PROVIDERS = "user_pinned_providers" //key for pinned user set
|
const val USER_PINNED_PROVIDERS = "user_pinned_providers" // Key for pinned user set
|
||||||
|
|
||||||
class UserPreferenceDelegate<T : Any>(
|
class UserPreferenceDelegate<T : Any>(
|
||||||
private val key: String, private val default: T //, private val klass: KClass<T>
|
private val key: String,
|
||||||
|
private val default: T,
|
||||||
) {
|
) {
|
||||||
private val klass: KClass<out T> = default::class
|
private val klass: KClass<out T> = default::class
|
||||||
private val realKey get() = "${DataStoreHelper.currentAccount}/$key"
|
private val realKey get() = "${DataStoreHelper.currentAccount}/$key"
|
||||||
|
|
@ -63,7 +71,7 @@ class UserPreferenceDelegate<T : Any>(
|
||||||
operator fun setValue(
|
operator fun setValue(
|
||||||
self: Any?,
|
self: Any?,
|
||||||
property: KProperty<*>,
|
property: KProperty<*>,
|
||||||
t: T?
|
t: T?,
|
||||||
) {
|
) {
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
removeKey(realKey)
|
removeKey(realKey)
|
||||||
|
|
@ -82,7 +90,7 @@ object DataStoreHelper {
|
||||||
R.drawable.profile_bg_pink,
|
R.drawable.profile_bg_pink,
|
||||||
R.drawable.profile_bg_purple,
|
R.drawable.profile_bg_purple,
|
||||||
R.drawable.profile_bg_red,
|
R.drawable.profile_bg_red,
|
||||||
R.drawable.profile_bg_teal
|
R.drawable.profile_bg_teal,
|
||||||
)
|
)
|
||||||
|
|
||||||
private var searchPreferenceProvidersStrings: List<String> by UserPreferenceDelegate(
|
private var searchPreferenceProvidersStrings: List<String> by UserPreferenceDelegate(
|
||||||
|
|
@ -112,16 +120,17 @@ object DataStoreHelper {
|
||||||
private var searchPreferenceTagsStrings: List<String> by UserPreferenceDelegate(
|
private var searchPreferenceTagsStrings: List<String> by UserPreferenceDelegate(
|
||||||
"search_pref_tags",
|
"search_pref_tags",
|
||||||
listOf(TvType.Movie, TvType.TvSeries).map { it.name })
|
listOf(TvType.Movie, TvType.TvSeries).map { it.name })
|
||||||
|
|
||||||
var searchPreferenceTags: List<TvType>
|
var searchPreferenceTags: List<TvType>
|
||||||
get() = deserializeTv(searchPreferenceTagsStrings)
|
get() = deserializeTv(searchPreferenceTagsStrings)
|
||||||
set(value) {
|
set(value) {
|
||||||
searchPreferenceTagsStrings = serializeTv(value)
|
searchPreferenceTagsStrings = serializeTv(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private var homePreferenceStrings: List<String> by UserPreferenceDelegate(
|
private var homePreferenceStrings: List<String> by UserPreferenceDelegate(
|
||||||
"home_pref_homepage",
|
"home_pref_homepage",
|
||||||
listOf(TvType.Movie, TvType.TvSeries).map { it.name })
|
listOf(TvType.Movie, TvType.TvSeries).map { it.name })
|
||||||
|
|
||||||
var homePreference: List<TvType>
|
var homePreference: List<TvType>
|
||||||
get() = deserializeTv(homePreferenceStrings)
|
get() = deserializeTv(homePreferenceStrings)
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|
@ -132,38 +141,38 @@ object DataStoreHelper {
|
||||||
"home_bookmarked_last_list",
|
"home_bookmarked_last_list",
|
||||||
IntArray(0)
|
IntArray(0)
|
||||||
)
|
)
|
||||||
|
|
||||||
var playBackSpeed: Float by UserPreferenceDelegate("playback_speed", 1.0f)
|
var playBackSpeed: Float by UserPreferenceDelegate("playback_speed", 1.0f)
|
||||||
var resizeMode: Int by UserPreferenceDelegate("resize_mode", 0)
|
var resizeMode: Int by UserPreferenceDelegate("resize_mode", 0)
|
||||||
var librarySortingMode: Int by UserPreferenceDelegate(
|
var librarySortingMode: Int by UserPreferenceDelegate(
|
||||||
"library_sorting_mode",
|
"library_sorting_mode",
|
||||||
ListSorting.AlphabeticalA.ordinal
|
ListSorting.AlphabeticalA.ordinal
|
||||||
)
|
)
|
||||||
|
|
||||||
private var _resultsSortingMode: Int by UserPreferenceDelegate(
|
private var _resultsSortingMode: Int by UserPreferenceDelegate(
|
||||||
"results_sorting_mode",
|
"results_sorting_mode",
|
||||||
EpisodeSortType.NUMBER_ASC.ordinal
|
EpisodeSortType.NUMBER_ASC.ordinal
|
||||||
)
|
)
|
||||||
|
|
||||||
var resultsSortingMode: EpisodeSortType
|
var resultsSortingMode: EpisodeSortType
|
||||||
get() = EpisodeSortType.entries.getOrNull(_resultsSortingMode) ?: EpisodeSortType.NUMBER_ASC
|
get() = EpisodeSortType.entries.getOrNull(_resultsSortingMode) ?: EpisodeSortType.NUMBER_ASC
|
||||||
set(value) {
|
set(value) {
|
||||||
_resultsSortingMode = value.ordinal
|
_resultsSortingMode = value.ordinal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Account(
|
data class Account(
|
||||||
@JsonProperty("keyIndex")
|
@JsonProperty("keyIndex") @SerialName("keyIndex") val keyIndex: Int,
|
||||||
val keyIndex: Int,
|
@JsonProperty("name") @SerialName("name") val name: String,
|
||||||
@JsonProperty("name")
|
@JsonProperty("customImage") @SerialName("customImage") val customImage: String? = null,
|
||||||
val name: String,
|
@JsonProperty("defaultImageIndex") @SerialName("defaultImageIndex") val defaultImageIndex: Int,
|
||||||
@JsonProperty("customImage")
|
@JsonProperty("lockPin") @SerialName("lockPin") val lockPin: String? = null,
|
||||||
val customImage: String? = null,
|
|
||||||
@JsonProperty("defaultImageIndex")
|
|
||||||
val defaultImageIndex: Int,
|
|
||||||
@JsonProperty("lockPin")
|
|
||||||
val lockPin: String? = null,
|
|
||||||
) {
|
) {
|
||||||
val image
|
@get:JsonIgnore
|
||||||
get() = customImage?.let { UiImage.Image(it) } ?: profileImages.getOrNull(
|
val image get() = customImage?.let { UiImage.Image(it) } ?:
|
||||||
defaultImageIndex
|
profileImages.getOrNull(defaultImageIndex)?.let {
|
||||||
)?.let { UiImage.Drawable(it) } ?: UiImage.Drawable(profileImages.first())
|
UiImage.Drawable(it)
|
||||||
|
} ?: UiImage.Drawable(profileImages.first())
|
||||||
}
|
}
|
||||||
|
|
||||||
const val TAG = "data_store_helper"
|
const val TAG = "data_store_helper"
|
||||||
|
|
@ -176,7 +185,7 @@ object DataStoreHelper {
|
||||||
* Setting this does not automatically reload the homepage.
|
* Setting this does not automatically reload the homepage.
|
||||||
*/
|
*/
|
||||||
var currentHomePage: String?
|
var currentHomePage: String?
|
||||||
get() = getKey("$currentAccount/$USER_SELECTED_HOMEPAGE_API")
|
get() = getKey<String>("$currentAccount/$USER_SELECTED_HOMEPAGE_API")
|
||||||
set(value) {
|
set(value) {
|
||||||
val key = "$currentAccount/$USER_SELECTED_HOMEPAGE_API"
|
val key = "$currentAccount/$USER_SELECTED_HOMEPAGE_API"
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
|
@ -188,7 +197,6 @@ object DataStoreHelper {
|
||||||
|
|
||||||
fun setAccount(account: Account) {
|
fun setAccount(account: Account) {
|
||||||
val homepage = currentHomePage
|
val homepage = currentHomePage
|
||||||
|
|
||||||
selectedKeyIndex = account.keyIndex
|
selectedKeyIndex = account.keyIndex
|
||||||
AccountManager.updateAccountIds()
|
AccountManager.updateAccountIds()
|
||||||
showToast(context?.getString(R.string.logged_account, account.name) ?: account.name)
|
showToast(context?.getString(R.string.logged_account, account.name) ?: account.name)
|
||||||
|
|
@ -206,7 +214,7 @@ object DataStoreHelper {
|
||||||
currentAccounts.getOrNull(currentAccounts.indexOfFirst { it.keyIndex == 0 }) ?: Account(
|
currentAccounts.getOrNull(currentAccounts.indexOfFirst { it.keyIndex == 0 }) ?: Account(
|
||||||
keyIndex = 0,
|
keyIndex = 0,
|
||||||
name = context.getString(R.string.default_account),
|
name = context.getString(R.string.default_account),
|
||||||
defaultImageIndex = 0
|
defaultImageIndex = 0,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -232,18 +240,21 @@ object DataStoreHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class PosDur(
|
data class PosDur(
|
||||||
@JsonProperty("position") val position: Long,
|
@JsonProperty("position") @SerialName("position") val position: Long,
|
||||||
@JsonProperty("duration") val duration: Long
|
@JsonProperty("duration") @SerialName("duration") val duration: Long,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun PosDur.fixVisual(): PosDur {
|
fun PosDur.fixVisual(): PosDur {
|
||||||
if (duration <= 0) return PosDur(0, duration)
|
if (duration <= 0) return PosDur(0, duration)
|
||||||
val percentage = position * 100 / duration
|
val percentage = position * 100 / duration
|
||||||
if (percentage <= 1) return PosDur(0, duration)
|
return when {
|
||||||
if (percentage <= 5) return PosDur(5 * duration / 100, duration)
|
percentage <= 1 -> PosDur(0, duration)
|
||||||
if (percentage >= 95) return PosDur(duration, duration)
|
percentage <= 5 -> PosDur(5 * duration / 100, duration)
|
||||||
return this
|
percentage >= 95 -> PosDur(duration, duration)
|
||||||
|
else -> this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Int.toYear(): Date =
|
fun Int.toYear(): Date =
|
||||||
|
|
@ -251,28 +262,38 @@ object DataStoreHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to display notifications on new episodes and posters in library.
|
* Used to display notifications on new episodes and posters in library.
|
||||||
**/
|
*/
|
||||||
|
@Serializable
|
||||||
abstract class LibrarySearchResponse(
|
abstract class LibrarySearchResponse(
|
||||||
@JsonProperty("id") override var id: Int?,
|
/**
|
||||||
@JsonProperty("latestUpdatedTime") open val latestUpdatedTime: Long,
|
* These fields are marked @Transient because this class is only ever serialized through
|
||||||
@JsonProperty("name") override val name: String,
|
* through its subclasses, which redeclare each property with their own @SerialName
|
||||||
@JsonProperty("url") override val url: String,
|
* annotations. Without @Transient here, kotlinx.serialization would try to
|
||||||
@JsonProperty("apiName") override val apiName: String,
|
* generate a serializer for the abstract base class itself (or double-serialize
|
||||||
@JsonProperty("type") override var type: TvType?,
|
* these fields), which fails/conflicts since these are meant to be overridden,
|
||||||
@JsonProperty("posterUrl") override var posterUrl: String?,
|
* not serialized directly from the parent.
|
||||||
@JsonProperty("year") open val year: Int?,
|
*/
|
||||||
@JsonProperty("syncData") open val syncData: Map<String, String>?,
|
@Transient override var id: Int? = null,
|
||||||
@JsonProperty("quality") override var quality: SearchQuality?,
|
@Transient open val latestUpdatedTime: Long = 0L,
|
||||||
@JsonProperty("posterHeaders") override var posterHeaders: Map<String, String>?,
|
@Transient override val name: String = "",
|
||||||
@JsonProperty("plot") open val plot: String? = null,
|
@Transient override val url: String = "",
|
||||||
@JsonProperty("score") override var score: Score? = null,
|
@Transient override val apiName: String = "",
|
||||||
@JsonProperty("tags") open val tags: List<String>? = null,
|
@Transient override var type: TvType? = null,
|
||||||
|
@Transient override var posterUrl: String? = null,
|
||||||
|
@Transient open val year: Int? = null,
|
||||||
|
@Transient open val syncData: Map<String, String>? = null,
|
||||||
|
@Transient override var quality: SearchQuality? = null,
|
||||||
|
@Transient override var posterHeaders: Map<String, String>? = null,
|
||||||
|
@Transient open val plot: String? = null,
|
||||||
|
@Transient override var score: Score? = null,
|
||||||
|
@Transient open val tags: List<String>? = null,
|
||||||
) : SearchResponse {
|
) : SearchResponse {
|
||||||
@JsonProperty("rating", access = JsonProperty.Access.WRITE_ONLY)
|
@JsonProperty("rating", access = JsonProperty.Access.WRITE_ONLY)
|
||||||
|
@SerialName("rating")
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
"`rating` is the old scoring system, use score instead",
|
"`rating` is the old scoring system, use score instead",
|
||||||
replaceWith = ReplaceWith("score"),
|
replaceWith = ReplaceWith("score"),
|
||||||
level = DeprecationLevel.ERROR
|
level = DeprecationLevel.ERROR,
|
||||||
)
|
)
|
||||||
var rating: Int? = null
|
var rating: Int? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|
@ -283,23 +304,26 @@ object DataStoreHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalSerializationApi::class) // KeepGeneratedSerializer is an experimental annotation for now
|
||||||
|
@KeepGeneratedSerializer
|
||||||
|
@Serializable(with = SubscribedData.Serializer::class)
|
||||||
data class SubscribedData(
|
data class SubscribedData(
|
||||||
@JsonProperty("subscribedTime") val subscribedTime: Long,
|
@JsonProperty("subscribedTime") @SerialName("subscribedTime") val subscribedTime: Long,
|
||||||
@JsonProperty("lastSeenEpisodeCount") val lastSeenEpisodeCount: Map<DubStatus, Int?>,
|
@JsonProperty("lastSeenEpisodeCount") @SerialName("lastSeenEpisodeCount") val lastSeenEpisodeCount: Map<DubStatus, Int?>,
|
||||||
override var id: Int?,
|
@JsonProperty("id") @SerialName("id") override var id: Int?,
|
||||||
override val latestUpdatedTime: Long,
|
@JsonProperty("latestUpdatedTime") @SerialName("latestUpdatedTime") override val latestUpdatedTime: Long,
|
||||||
override val name: String,
|
@JsonProperty("name") @SerialName("name") override val name: String,
|
||||||
override val url: String,
|
@JsonProperty("url") @SerialName("url") override val url: String,
|
||||||
override val apiName: String,
|
@JsonProperty("apiName") @SerialName("apiName") override val apiName: String,
|
||||||
override var type: TvType?,
|
@JsonProperty("type") @SerialName("type") override var type: TvType?,
|
||||||
override var posterUrl: String?,
|
@JsonProperty("posterUrl") @SerialName("posterUrl") override var posterUrl: String?,
|
||||||
override val year: Int?,
|
@JsonProperty("year") @SerialName("year") override val year: Int?,
|
||||||
override val syncData: Map<String, String>? = null,
|
@JsonProperty("syncData") @SerialName("syncData") override val syncData: Map<String, String>? = null,
|
||||||
override var quality: SearchQuality? = null,
|
@JsonProperty("quality") @SerialName("quality") override var quality: SearchQuality? = null,
|
||||||
override var posterHeaders: Map<String, String>? = null,
|
@JsonProperty("posterHeaders") @SerialName("posterHeaders") override var posterHeaders: Map<String, String>? = null,
|
||||||
override val plot: String? = null,
|
@JsonProperty("plot") @SerialName("plot") override val plot: String? = null,
|
||||||
override var score: Score? = null,
|
@JsonProperty("score") @SerialName("score") override var score: Score? = null,
|
||||||
override val tags: List<String>? = null,
|
@JsonProperty("tags") @SerialName("tags") override val tags: List<String>? = null,
|
||||||
) : LibrarySearchResponse(
|
) : LibrarySearchResponse(
|
||||||
id,
|
id,
|
||||||
latestUpdatedTime,
|
latestUpdatedTime,
|
||||||
|
|
@ -314,8 +338,13 @@ object DataStoreHelper {
|
||||||
posterHeaders,
|
posterHeaders,
|
||||||
plot,
|
plot,
|
||||||
score,
|
score,
|
||||||
tags
|
tags,
|
||||||
) {
|
) {
|
||||||
|
object Serializer : WriteOnlySerializer<SubscribedData>(
|
||||||
|
SubscribedData.generatedSerializer(),
|
||||||
|
setOf("rating"),
|
||||||
|
)
|
||||||
|
|
||||||
fun toLibraryItem(): SyncAPI.LibraryItem? {
|
fun toLibraryItem(): SyncAPI.LibraryItem? {
|
||||||
return SyncAPI.LibraryItem(
|
return SyncAPI.LibraryItem(
|
||||||
name,
|
name,
|
||||||
|
|
@ -334,27 +363,30 @@ object DataStoreHelper {
|
||||||
this.id,
|
this.id,
|
||||||
plot = this.plot,
|
plot = this.plot,
|
||||||
score = this.score,
|
score = this.score,
|
||||||
tags = this.tags
|
tags = this.tags,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalSerializationApi::class) // KeepGeneratedSerializer is an experimental annotation for now
|
||||||
|
@KeepGeneratedSerializer
|
||||||
|
@Serializable(with = BookmarkedData.Serializer::class)
|
||||||
data class BookmarkedData(
|
data class BookmarkedData(
|
||||||
@JsonProperty("bookmarkedTime") val bookmarkedTime: Long,
|
@JsonProperty("bookmarkedTime") @SerialName("bookmarkedTime") val bookmarkedTime: Long,
|
||||||
override var id: Int?,
|
@JsonProperty("id") @SerialName("id") override var id: Int?,
|
||||||
override val latestUpdatedTime: Long,
|
@JsonProperty("latestUpdatedTime") @SerialName("latestUpdatedTime") override val latestUpdatedTime: Long,
|
||||||
override val name: String,
|
@JsonProperty("name") @SerialName("name") override val name: String,
|
||||||
override val url: String,
|
@JsonProperty("url") @SerialName("url") override val url: String,
|
||||||
override val apiName: String,
|
@JsonProperty("apiName") @SerialName("apiName") override val apiName: String,
|
||||||
override var type: TvType?,
|
@JsonProperty("type") @SerialName("type") override var type: TvType?,
|
||||||
override var posterUrl: String?,
|
@JsonProperty("posterUrl") @SerialName("posterUrl") override var posterUrl: String?,
|
||||||
override val year: Int?,
|
@JsonProperty("year") @SerialName("year") override val year: Int?,
|
||||||
override val syncData: Map<String, String>? = null,
|
@JsonProperty("syncData") @SerialName("syncData") override val syncData: Map<String, String>? = null,
|
||||||
override var quality: SearchQuality? = null,
|
@JsonProperty("quality") @SerialName("quality") override var quality: SearchQuality? = null,
|
||||||
override var posterHeaders: Map<String, String>? = null,
|
@JsonProperty("posterHeaders") @SerialName("posterHeaders") override var posterHeaders: Map<String, String>? = null,
|
||||||
override val plot: String? = null,
|
@JsonProperty("plot") @SerialName("plot") override val plot: String? = null,
|
||||||
override var score: Score? = null,
|
@JsonProperty("score") @SerialName("score") override var score: Score? = null,
|
||||||
override val tags: List<String>? = null,
|
@JsonProperty("tags") @SerialName("tags") override val tags: List<String>? = null,
|
||||||
) : LibrarySearchResponse(
|
) : LibrarySearchResponse(
|
||||||
id,
|
id,
|
||||||
latestUpdatedTime,
|
latestUpdatedTime,
|
||||||
|
|
@ -367,8 +399,13 @@ object DataStoreHelper {
|
||||||
syncData,
|
syncData,
|
||||||
quality,
|
quality,
|
||||||
posterHeaders,
|
posterHeaders,
|
||||||
plot
|
plot,
|
||||||
) {
|
) {
|
||||||
|
object Serializer : WriteOnlySerializer<BookmarkedData>(
|
||||||
|
BookmarkedData.generatedSerializer(),
|
||||||
|
setOf("rating"),
|
||||||
|
)
|
||||||
|
|
||||||
fun toLibraryItem(id: String): SyncAPI.LibraryItem {
|
fun toLibraryItem(id: String): SyncAPI.LibraryItem {
|
||||||
return SyncAPI.LibraryItem(
|
return SyncAPI.LibraryItem(
|
||||||
name,
|
name,
|
||||||
|
|
@ -387,27 +424,30 @@ object DataStoreHelper {
|
||||||
this.id,
|
this.id,
|
||||||
plot = this.plot,
|
plot = this.plot,
|
||||||
score = this.score,
|
score = this.score,
|
||||||
tags = this.tags
|
tags = this.tags,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalSerializationApi::class) // KeepGeneratedSerializer is an experimental annotation for now
|
||||||
|
@KeepGeneratedSerializer
|
||||||
|
@Serializable(with = FavoritesData.Serializer::class)
|
||||||
data class FavoritesData(
|
data class FavoritesData(
|
||||||
@JsonProperty("favoritesTime") val favoritesTime: Long,
|
@JsonProperty("favoritesTime") @SerialName("favoritesTime") val favoritesTime: Long,
|
||||||
override var id: Int?,
|
@JsonProperty("id") @SerialName("id") override var id: Int?,
|
||||||
override val latestUpdatedTime: Long,
|
@JsonProperty("latestUpdatedTime") @SerialName("latestUpdatedTime") override val latestUpdatedTime: Long,
|
||||||
override val name: String,
|
@JsonProperty("name") @SerialName("name") override val name: String,
|
||||||
override val url: String,
|
@JsonProperty("url") @SerialName("url") override val url: String,
|
||||||
override val apiName: String,
|
@JsonProperty("apiName") @SerialName("apiName") override val apiName: String,
|
||||||
override var type: TvType?,
|
@JsonProperty("type") @SerialName("type") override var type: TvType?,
|
||||||
override var posterUrl: String?,
|
@JsonProperty("posterUrl") @SerialName("posterUrl") override var posterUrl: String?,
|
||||||
override val year: Int?,
|
@JsonProperty("year") @SerialName("year") override val year: Int?,
|
||||||
override val syncData: Map<String, String>? = null,
|
@JsonProperty("syncData") @SerialName("syncData") override val syncData: Map<String, String>? = null,
|
||||||
override var quality: SearchQuality? = null,
|
@JsonProperty("quality") @SerialName("quality") override var quality: SearchQuality? = null,
|
||||||
override var posterHeaders: Map<String, String>? = null,
|
@JsonProperty("posterHeaders") @SerialName("posterHeaders") override var posterHeaders: Map<String, String>? = null,
|
||||||
override val plot: String? = null,
|
@JsonProperty("plot") @SerialName("plot") override val plot: String? = null,
|
||||||
override var score: Score? = null,
|
@JsonProperty("score") @SerialName("score") override var score: Score? = null,
|
||||||
override val tags: List<String>? = null,
|
@JsonProperty("tags") @SerialName("tags") override val tags: List<String>? = null,
|
||||||
) : LibrarySearchResponse(
|
) : LibrarySearchResponse(
|
||||||
id,
|
id,
|
||||||
latestUpdatedTime,
|
latestUpdatedTime,
|
||||||
|
|
@ -420,8 +460,13 @@ object DataStoreHelper {
|
||||||
syncData,
|
syncData,
|
||||||
quality,
|
quality,
|
||||||
posterHeaders,
|
posterHeaders,
|
||||||
plot
|
plot,
|
||||||
) {
|
) {
|
||||||
|
object Serializer : WriteOnlySerializer<FavoritesData>(
|
||||||
|
FavoritesData.generatedSerializer(),
|
||||||
|
setOf("rating"),
|
||||||
|
)
|
||||||
|
|
||||||
fun toLibraryItem(): SyncAPI.LibraryItem? {
|
fun toLibraryItem(): SyncAPI.LibraryItem? {
|
||||||
return SyncAPI.LibraryItem(
|
return SyncAPI.LibraryItem(
|
||||||
name,
|
name,
|
||||||
|
|
@ -440,31 +485,32 @@ object DataStoreHelper {
|
||||||
this.id,
|
this.id,
|
||||||
plot = this.plot,
|
plot = this.plot,
|
||||||
score = this.score,
|
score = this.score,
|
||||||
tags = this.tags
|
tags = this.tags,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class ResumeWatchingResult(
|
data class ResumeWatchingResult(
|
||||||
@JsonProperty("name") override val name: String,
|
@JsonProperty("name") @SerialName("name") override val name: String,
|
||||||
@JsonProperty("url") override val url: String,
|
@JsonProperty("url") @SerialName("url") override val url: String,
|
||||||
@JsonProperty("apiName") override val apiName: String,
|
@JsonProperty("apiName") @SerialName("apiName") override val apiName: String,
|
||||||
@JsonProperty("type") override var type: TvType? = null,
|
@JsonProperty("type") @SerialName("type") override var type: TvType? = null,
|
||||||
@JsonProperty("posterUrl") override var posterUrl: String?,
|
@JsonProperty("posterUrl") @SerialName("posterUrl") override var posterUrl: String?,
|
||||||
@JsonProperty("watchPos") val watchPos: PosDur?,
|
@JsonProperty("watchPos") @SerialName("watchPos") val watchPos: PosDur?,
|
||||||
@JsonProperty("id") override var id: Int?,
|
@JsonProperty("id") @SerialName("id") override var id: Int?,
|
||||||
@JsonProperty("parentId") val parentId: Int?,
|
@JsonProperty("parentId") @SerialName("parentId") val parentId: Int?,
|
||||||
@JsonProperty("episode") val episode: Int?,
|
@JsonProperty("episode") @SerialName("episode") val episode: Int?,
|
||||||
@JsonProperty("season") val season: Int?,
|
@JsonProperty("season") @SerialName("season") val season: Int?,
|
||||||
@JsonProperty("isFromDownload") val isFromDownload: Boolean,
|
@JsonProperty("isFromDownload") @SerialName("isFromDownload") val isFromDownload: Boolean,
|
||||||
@JsonProperty("quality") override var quality: SearchQuality? = null,
|
@JsonProperty("quality") @SerialName("quality") override var quality: SearchQuality? = null,
|
||||||
@JsonProperty("posterHeaders") override var posterHeaders: Map<String, String>? = null,
|
@JsonProperty("posterHeaders") @SerialName("posterHeaders") override var posterHeaders: Map<String, String>? = null,
|
||||||
@JsonProperty("score") override var score: Score? = null,
|
@JsonProperty("score") @SerialName("score") override var score: Score? = null,
|
||||||
) : SearchResponse
|
) : SearchResponse
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A datastore wide account for future implementations of a multiple account system
|
* A datastore wide account for future implementations of a multiple account system
|
||||||
**/
|
*/
|
||||||
|
|
||||||
fun getAllWatchStateIds(): List<Int>? {
|
fun getAllWatchStateIds(): List<Int>? {
|
||||||
val folder = "$currentAccount/$RESULT_WATCH_STATE"
|
val folder = "$currentAccount/$RESULT_WATCH_STATE"
|
||||||
|
|
@ -500,7 +546,7 @@ object DataStoreHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun migrateResumeWatching() {
|
fun migrateResumeWatching() {
|
||||||
// if (getKey(RESULT_RESUME_WATCHING_HAS_MIGRATED, false) != true) {
|
// if (getKey<Boolean>(RESULT_RESUME_WATCHING_HAS_MIGRATED, false) != true) {
|
||||||
setKey(RESULT_RESUME_WATCHING_HAS_MIGRATED, true)
|
setKey(RESULT_RESUME_WATCHING_HAS_MIGRATED, true)
|
||||||
getAllResumeStateIdsOld()?.forEach { id ->
|
getAllResumeStateIdsOld()?.forEach { id ->
|
||||||
getLastWatchedOld(id)?.let {
|
getLastWatchedOld(id)?.let {
|
||||||
|
|
@ -510,12 +556,12 @@ object DataStoreHelper {
|
||||||
it.episode,
|
it.episode,
|
||||||
it.season,
|
it.season,
|
||||||
it.isFromDownload,
|
it.isFromDownload,
|
||||||
it.updateTime
|
it.updateTime,
|
||||||
)
|
)
|
||||||
removeLastWatchedOld(it.parentId)
|
removeLastWatchedOld(it.parentId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setLastWatched(
|
fun setLastWatched(
|
||||||
|
|
@ -536,7 +582,7 @@ object DataStoreHelper {
|
||||||
episode,
|
episode,
|
||||||
season,
|
season,
|
||||||
updateTime ?: System.currentTimeMillis(),
|
updateTime ?: System.currentTimeMillis(),
|
||||||
isFromDownload
|
isFromDownload,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -553,7 +599,7 @@ object DataStoreHelper {
|
||||||
|
|
||||||
fun getLastWatched(id: Int?): DownloadObjects.ResumeWatching? {
|
fun getLastWatched(id: Int?): DownloadObjects.ResumeWatching? {
|
||||||
if (id == null) return null
|
if (id == null) return null
|
||||||
return getKey(
|
return getKey<DownloadObjects.ResumeWatching>(
|
||||||
"$currentAccount/$RESULT_RESUME_WATCHING",
|
"$currentAccount/$RESULT_RESUME_WATCHING",
|
||||||
id.toString(),
|
id.toString(),
|
||||||
)
|
)
|
||||||
|
|
@ -561,7 +607,7 @@ object DataStoreHelper {
|
||||||
|
|
||||||
private fun getLastWatchedOld(id: Int?): DownloadObjects.ResumeWatching? {
|
private fun getLastWatchedOld(id: Int?): DownloadObjects.ResumeWatching? {
|
||||||
if (id == null) return null
|
if (id == null) return null
|
||||||
return getKey(
|
return getKey<DownloadObjects.ResumeWatching>(
|
||||||
"$currentAccount/$RESULT_RESUME_WATCHING_OLD",
|
"$currentAccount/$RESULT_RESUME_WATCHING_OLD",
|
||||||
id.toString(),
|
id.toString(),
|
||||||
)
|
)
|
||||||
|
|
@ -575,18 +621,18 @@ object DataStoreHelper {
|
||||||
|
|
||||||
fun getBookmarkedData(id: Int?): BookmarkedData? {
|
fun getBookmarkedData(id: Int?): BookmarkedData? {
|
||||||
if (id == null) return null
|
if (id == null) return null
|
||||||
return getKey("$currentAccount/$RESULT_WATCH_STATE_DATA", id.toString())
|
return getKey<BookmarkedData>("$currentAccount/$RESULT_WATCH_STATE_DATA", id.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAllBookmarkedData(): List<BookmarkedData> {
|
fun getAllBookmarkedData(): List<BookmarkedData> {
|
||||||
return getKeys("$currentAccount/$RESULT_WATCH_STATE_DATA")?.mapNotNull {
|
return getKeys("$currentAccount/$RESULT_WATCH_STATE_DATA")?.mapNotNull {
|
||||||
getKey(it)
|
getKey<BookmarkedData>(it)
|
||||||
} ?: emptyList()
|
} ?: emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAllSubscriptions(): List<SubscribedData> {
|
fun getAllSubscriptions(): List<SubscribedData> {
|
||||||
return getKeys("$currentAccount/$RESULT_SUBSCRIBED_STATE_DATA")?.mapNotNull {
|
return getKeys("$currentAccount/$RESULT_SUBSCRIBED_STATE_DATA")?.mapNotNull {
|
||||||
getKey(it)
|
getKey<SubscribedData>(it)
|
||||||
} ?: emptyList()
|
} ?: emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -598,12 +644,12 @@ object DataStoreHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set new seen episodes and update time
|
* Set new seen episodes and update time
|
||||||
**/
|
*/
|
||||||
fun updateSubscribedData(id: Int?, data: SubscribedData?, episodeResponse: EpisodeResponse?) {
|
fun updateSubscribedData(id: Int?, data: SubscribedData?, episodeResponse: EpisodeResponse?) {
|
||||||
if (id == null || data == null || episodeResponse == null) return
|
if (id == null || data == null || episodeResponse == null) return
|
||||||
val newData = data.copy(
|
val newData = data.copy(
|
||||||
latestUpdatedTime = unixTimeMS,
|
latestUpdatedTime = unixTimeMS,
|
||||||
lastSeenEpisodeCount = episodeResponse.getLatestEpisodes()
|
lastSeenEpisodeCount = episodeResponse.getLatestEpisodes(),
|
||||||
)
|
)
|
||||||
setKey("$currentAccount/$RESULT_SUBSCRIBED_STATE_DATA", id.toString(), newData)
|
setKey("$currentAccount/$RESULT_SUBSCRIBED_STATE_DATA", id.toString(), newData)
|
||||||
}
|
}
|
||||||
|
|
@ -616,12 +662,12 @@ object DataStoreHelper {
|
||||||
|
|
||||||
fun getSubscribedData(id: Int?): SubscribedData? {
|
fun getSubscribedData(id: Int?): SubscribedData? {
|
||||||
if (id == null) return null
|
if (id == null) return null
|
||||||
return getKey("$currentAccount/$RESULT_SUBSCRIBED_STATE_DATA", id.toString())
|
return getKey<SubscribedData>("$currentAccount/$RESULT_SUBSCRIBED_STATE_DATA", id.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAllFavorites(): List<FavoritesData> {
|
fun getAllFavorites(): List<FavoritesData> {
|
||||||
return getKeys("$currentAccount/$RESULT_FAVORITES_STATE_DATA")?.mapNotNull {
|
return getKeys("$currentAccount/$RESULT_FAVORITES_STATE_DATA")?.mapNotNull {
|
||||||
getKey(it)
|
getKey<FavoritesData>(it)
|
||||||
} ?: emptyList()
|
} ?: emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -639,7 +685,7 @@ object DataStoreHelper {
|
||||||
|
|
||||||
fun getFavoritesData(id: Int?): FavoritesData? {
|
fun getFavoritesData(id: Int?): FavoritesData? {
|
||||||
if (id == null) return null
|
if (id == null) return null
|
||||||
return getKey("$currentAccount/$RESULT_FAVORITES_STATE_DATA", id.toString())
|
return getKey<FavoritesData>("$currentAccount/$RESULT_FAVORITES_STATE_DATA", id.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setViewPos(id: Int?, pos: Long, dur: Long) {
|
fun setViewPos(id: Int?, pos: Long, dur: Long) {
|
||||||
|
|
@ -648,10 +694,10 @@ object DataStoreHelper {
|
||||||
setKey("$currentAccount/$VIDEO_POS_DUR", id.toString(), PosDur(pos, dur))
|
setKey("$currentAccount/$VIDEO_POS_DUR", id.toString(), PosDur(pos, dur))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the position, duration, and resume data of an episode/movie,
|
/**
|
||||||
*
|
* Sets the position, duration, and resume data of an episode/movie,
|
||||||
* if nextEpisode is not specified it will not be able to set the next episode as resumable if progress > NEXT_WATCH_EPISODE_PERCENTAGE
|
* If nextEpisode is not specified it will not be able to set the next episode as resumable if progress > NEXT_WATCH_EPISODE_PERCENTAGE
|
||||||
* */
|
*/
|
||||||
fun setViewPosAndResume(id: Int?, position: Long, duration: Long, currentEpisode: Any?, nextEpisode: Any?) {
|
fun setViewPosAndResume(id: Int?, position: Long, duration: Long, currentEpisode: Any?, nextEpisode: Any?) {
|
||||||
setViewPos(id, position, duration)
|
setViewPos(id, position, duration)
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
|
|
@ -687,7 +733,7 @@ object DataStoreHelper {
|
||||||
resumeMeta.id,
|
resumeMeta.id,
|
||||||
resumeMeta.episode,
|
resumeMeta.episode,
|
||||||
resumeMeta.season,
|
resumeMeta.season,
|
||||||
isFromDownload = false
|
isFromDownload = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -697,7 +743,7 @@ object DataStoreHelper {
|
||||||
resumeMeta.id,
|
resumeMeta.id,
|
||||||
resumeMeta.episode,
|
resumeMeta.episode,
|
||||||
resumeMeta.season,
|
resumeMeta.season,
|
||||||
isFromDownload = true
|
isFromDownload = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -706,17 +752,16 @@ object DataStoreHelper {
|
||||||
|
|
||||||
fun getViewPos(id: Int?): PosDur? {
|
fun getViewPos(id: Int?): PosDur? {
|
||||||
if (id == null) return null
|
if (id == null) return null
|
||||||
return getKey("$currentAccount/$VIDEO_POS_DUR", id.toString(), null)
|
return getKey<PosDur>("$currentAccount/$VIDEO_POS_DUR", id.toString(), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getVideoWatchState(id: Int?): VideoWatchState? {
|
fun getVideoWatchState(id: Int?): VideoWatchState? {
|
||||||
if (id == null) return null
|
if (id == null) return null
|
||||||
return getKey("$currentAccount/$VIDEO_WATCH_STATE", id.toString(), null)
|
return getKey<VideoWatchState>("$currentAccount/$VIDEO_WATCH_STATE", id.toString(), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setVideoWatchState(id: Int?, watchState: VideoWatchState) {
|
fun setVideoWatchState(id: Int?, watchState: VideoWatchState) {
|
||||||
if (id == null) return
|
if (id == null) return
|
||||||
|
|
||||||
// None == No key
|
// None == No key
|
||||||
if (watchState == VideoWatchState.None) {
|
if (watchState == VideoWatchState.None) {
|
||||||
removeKey("$currentAccount/$VIDEO_WATCH_STATE", id.toString())
|
removeKey("$currentAccount/$VIDEO_WATCH_STATE", id.toString())
|
||||||
|
|
@ -727,7 +772,7 @@ object DataStoreHelper {
|
||||||
|
|
||||||
fun getDub(id: Int): DubStatus? {
|
fun getDub(id: Int): DubStatus? {
|
||||||
return DubStatus.entries
|
return DubStatus.entries
|
||||||
.getOrNull(getKey("$currentAccount/$RESULT_DUB", id.toString(), -1) ?: -1)
|
.getOrNull(getKey<Int>("$currentAccount/$RESULT_DUB", id.toString(), -1) ?: -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDub(id: Int, status: DubStatus) {
|
fun setDub(id: Int, status: DubStatus) {
|
||||||
|
|
@ -748,13 +793,13 @@ object DataStoreHelper {
|
||||||
getKey<Int>(
|
getKey<Int>(
|
||||||
"$currentAccount/$RESULT_WATCH_STATE",
|
"$currentAccount/$RESULT_WATCH_STATE",
|
||||||
id.toString(),
|
id.toString(),
|
||||||
null
|
null,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getResultSeason(id: Int): Int? {
|
fun getResultSeason(id: Int): Int? {
|
||||||
return getKey("$currentAccount/$RESULT_SEASON", id.toString(), null)
|
return getKey<Int>("$currentAccount/$RESULT_SEASON", id.toString(), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setResultSeason(id: Int, value: Int?) {
|
fun setResultSeason(id: Int, value: Int?) {
|
||||||
|
|
@ -762,7 +807,7 @@ object DataStoreHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getResultEpisode(id: Int): Int? {
|
fun getResultEpisode(id: Int): Int? {
|
||||||
return getKey("$currentAccount/$RESULT_EPISODE", id.toString(), null)
|
return getKey<Int>("$currentAccount/$RESULT_EPISODE", id.toString(), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setResultEpisode(id: Int, value: Int?) {
|
fun setResultEpisode(id: Int, value: Int?) {
|
||||||
|
|
@ -775,12 +820,11 @@ object DataStoreHelper {
|
||||||
|
|
||||||
fun getSync(id: Int, idPrefixes: List<String>): List<String?> {
|
fun getSync(id: Int, idPrefixes: List<String>): List<String?> {
|
||||||
return idPrefixes.map { idPrefix ->
|
return idPrefixes.map { idPrefix ->
|
||||||
getKey("${idPrefix}_sync", id.toString())
|
getKey<String>("${idPrefix}_sync", id.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pinnedProviders: Array<String>
|
var pinnedProviders: Array<String>
|
||||||
get() = getKey(USER_PINNED_PROVIDERS) ?: emptyArray<String>()
|
get() = getKey<Array<String>>(USER_PINNED_PROVIDERS) ?: emptyArray<String>()
|
||||||
set(value) = setKey(USER_PINNED_PROVIDERS, value)
|
set(value) = setKey(USER_PINNED_PROVIDERS, value)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ object SyncUtil {
|
||||||
// Gogoanime, Twistmoe and 9anime
|
// Gogoanime, Twistmoe and 9anime
|
||||||
val url = "https://raw.githubusercontent.com/MALSync/MAL-Sync-Backup/master/data/pages/$site/$slug.json"
|
val url = "https://raw.githubusercontent.com/MALSync/MAL-Sync-Backup/master/data/pages/$site/$slug.json"
|
||||||
val response = app.get(url, cacheTime = 1, cacheUnit = TimeUnit.DAYS).text
|
val response = app.get(url, cacheTime = 1, cacheUnit = TimeUnit.DAYS).text
|
||||||
val mapped = tryParseJson<MalSyncPage?>(response)
|
val mapped = tryParseJson<MalSyncPage>(response)
|
||||||
|
|
||||||
val overrideMal = mapped?.malId ?: mapped?.mal?.id ?: mapped?.anilist?.malId
|
val overrideMal = mapped?.malId ?: mapped?.mal?.id ?: mapped?.anilist?.malId
|
||||||
val overrideAnilist = mapped?.aniId ?: mapped?.anilist?.id
|
val overrideAnilist = mapped?.aniId ?: mapped?.anilist?.id
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,15 @@ const val PROGRAM_ID_LIST_KEY = "persistent_program_ids"
|
||||||
|
|
||||||
object TvChannelUtils {
|
object TvChannelUtils {
|
||||||
fun Context.saveProgramId(programId: Long) {
|
fun Context.saveProgramId(programId: Long) {
|
||||||
val existing: List<Long> = getKey(PROGRAM_ID_LIST_KEY) ?: emptyList()
|
val existing: List<Long> = getKey<List<Long>>(PROGRAM_ID_LIST_KEY) ?: emptyList()
|
||||||
val updated = (existing + programId).distinct()
|
val updated = (existing + programId).distinct()
|
||||||
setKey(PROGRAM_ID_LIST_KEY, updated)
|
setKey(PROGRAM_ID_LIST_KEY, updated)
|
||||||
}
|
}
|
||||||
fun Context.getStoredProgramIds(): List<Long> {
|
fun Context.getStoredProgramIds(): List<Long> {
|
||||||
return getKey(PROGRAM_ID_LIST_KEY) ?: emptyList()
|
return getKey<List<Long>>(PROGRAM_ID_LIST_KEY) ?: emptyList()
|
||||||
}
|
}
|
||||||
fun Context.removeProgramId(programId: Long) {
|
fun Context.removeProgramId(programId: Long) {
|
||||||
val existing: List<Long> = getKey(PROGRAM_ID_LIST_KEY) ?: emptyList()
|
val existing: List<Long> = getKey<List<Long>>(PROGRAM_ID_LIST_KEY) ?: emptyList()
|
||||||
val updated = existing.filter { it != programId }
|
val updated = existing.filter { it != programId }
|
||||||
setKey(PROGRAM_ID_LIST_KEY, updated)
|
setKey(PROGRAM_ID_LIST_KEY, updated)
|
||||||
}
|
}
|
||||||
|
|
@ -161,4 +161,4 @@ object TvChannelUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -597,6 +597,10 @@ object UIHelper {
|
||||||
fun MaterialButton.showProgress(@ColorInt tintColor: Int = this.iconTint.defaultColor) =
|
fun MaterialButton.showProgress(@ColorInt tintColor: Int = this.iconTint.defaultColor) =
|
||||||
// Use runOnMainThreadNative to allow process on io threads, to make the code a bit cleaner
|
// Use runOnMainThreadNative to allow process on io threads, to make the code a bit cleaner
|
||||||
runOnMainThreadNative {
|
runOnMainThreadNative {
|
||||||
|
// No need to set it again, as then it will reset the animation
|
||||||
|
if(this.icon is IndeterminateDrawable<*>) {
|
||||||
|
return@runOnMainThreadNative
|
||||||
|
}
|
||||||
val spec = CircularProgressIndicatorSpec(
|
val spec = CircularProgressIndicatorSpec(
|
||||||
context, null, 0,
|
context, null, 0,
|
||||||
com.google.android.material.R.style.Widget_Material3_CircularProgressIndicator_ExtraSmall
|
com.google.android.material.R.style.Widget_Material3_CircularProgressIndicator_ExtraSmall
|
||||||
|
|
|
||||||
|
|
@ -1640,11 +1640,11 @@ object VideoDownloadManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDownloadResumePackage(context: Context, id: Int): DownloadResumePackage? {
|
fun getDownloadResumePackage(context: Context, id: Int): DownloadResumePackage? {
|
||||||
return context.getKey(KEY_RESUME_PACKAGES, id.toString())
|
return context.getKey<DownloadResumePackage>(KEY_RESUME_PACKAGES, id.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDownloadQueuePackage(context: Context, id: Int): DownloadQueueWrapper? {
|
fun getDownloadQueuePackage(context: Context, id: Int): DownloadQueueWrapper? {
|
||||||
return context.getKey(KEY_RESUME_IN_QUEUE, id.toString())
|
return context.getKey<DownloadQueueWrapper>(KEY_RESUME_IN_QUEUE, id.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDownloadEpisodeMetadata(
|
fun getDownloadEpisodeMetadata(
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,32 @@
|
||||||
package com.lagradost.cloudstream3.utils.downloader
|
package com.lagradost.cloudstream3.utils.downloader
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.Score
|
import com.lagradost.cloudstream3.Score
|
||||||
|
import com.lagradost.cloudstream3.SkipSerializationTest
|
||||||
import com.lagradost.cloudstream3.TvType
|
import com.lagradost.cloudstream3.TvType
|
||||||
import com.lagradost.cloudstream3.services.DownloadQueueService
|
import com.lagradost.cloudstream3.services.DownloadQueueService
|
||||||
import com.lagradost.cloudstream3.ui.player.SubtitleData
|
import com.lagradost.cloudstream3.ui.player.SubtitleData
|
||||||
import com.lagradost.cloudstream3.ui.result.ResultEpisode
|
import com.lagradost.cloudstream3.ui.result.ResultEpisode
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
|
import com.lagradost.cloudstream3.utils.serializers.UriSerializer
|
||||||
|
import com.lagradost.cloudstream3.utils.serializers.WriteOnlySerializer
|
||||||
import com.lagradost.safefile.SafeFile
|
import com.lagradost.safefile.SafeFile
|
||||||
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
|
import kotlinx.serialization.KeepGeneratedSerializer
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
import java.util.Objects
|
import java.util.Objects
|
||||||
|
|
||||||
object DownloadObjects {
|
object DownloadObjects {
|
||||||
/** An item can either be something to resume or something new to start */
|
/** An item can either be something to resume or something new to start */
|
||||||
|
@Serializable
|
||||||
data class DownloadQueueWrapper(
|
data class DownloadQueueWrapper(
|
||||||
@JsonProperty("resumePackage") val resumePackage: DownloadResumePackage?,
|
@JsonProperty("resumePackage") @SerialName("resumePackage") val resumePackage: DownloadResumePackage?,
|
||||||
@JsonProperty("downloadItem") val downloadItem: DownloadQueueItem?,
|
@JsonProperty("downloadItem") @SerialName("downloadItem") val downloadItem: DownloadQueueItem?,
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
assert(resumePackage != null || downloadItem != null) {
|
assert(resumePackage != null || downloadItem != null) {
|
||||||
|
|
@ -26,56 +35,66 @@ object DownloadObjects {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loop through the current download instances to see if it is currently downloading. Also includes link loading. */
|
/** Loop through the current download instances to see if it is currently downloading. Also includes link loading. */
|
||||||
|
@JsonIgnore
|
||||||
fun isCurrentlyDownloading(): Boolean {
|
fun isCurrentlyDownloading(): Boolean {
|
||||||
return DownloadQueueService.downloadInstances.value.any { it.downloadQueueWrapper.id == this.id }
|
return DownloadQueueService.downloadInstances.value.any { it.downloadQueueWrapper.id == this.id }
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id") @SerialName("id")
|
||||||
val id = resumePackage?.item?.ep?.id ?: downloadItem!!.episode.id
|
val id = resumePackage?.item?.ep?.id ?: downloadItem!!.episode.id
|
||||||
|
|
||||||
@JsonProperty("parentId")
|
@JsonProperty("parentId") @SerialName("parentId")
|
||||||
val parentId = resumePackage?.item?.ep?.parentId ?: downloadItem!!.episode.parentId
|
val parentId = resumePackage?.item?.ep?.parentId ?: downloadItem!!.episode.parentId
|
||||||
}
|
}
|
||||||
|
|
||||||
/** General data about the episode and show to start a download from. */
|
/** General data about the episode and show to start a download from. */
|
||||||
|
@Serializable
|
||||||
data class DownloadQueueItem(
|
data class DownloadQueueItem(
|
||||||
@JsonProperty("episode") val episode: ResultEpisode,
|
@JsonProperty("episode") @SerialName("episode") val episode: ResultEpisode,
|
||||||
@JsonProperty("isMovie") val isMovie: Boolean,
|
@JsonProperty("isMovie") @SerialName("isMovie") val isMovie: Boolean,
|
||||||
@JsonProperty("resultName") val resultName: String,
|
@JsonProperty("resultName") @SerialName("resultName") val resultName: String,
|
||||||
@JsonProperty("resultType") val resultType: TvType,
|
@JsonProperty("resultType") @SerialName("resultType") val resultType: TvType,
|
||||||
@JsonProperty("resultPoster") val resultPoster: String?,
|
@JsonProperty("resultPoster") @SerialName("resultPoster") val resultPoster: String?,
|
||||||
@JsonProperty("apiName") val apiName: String,
|
@JsonProperty("apiName") @SerialName("apiName") val apiName: String,
|
||||||
@JsonProperty("resultId") val resultId: Int,
|
@JsonProperty("resultId") @SerialName("resultId") val resultId: Int,
|
||||||
@JsonProperty("resultUrl") val resultUrl: String,
|
@JsonProperty("resultUrl") @SerialName("resultUrl") val resultUrl: String,
|
||||||
@JsonProperty("links") val links: List<ExtractorLink>? = null,
|
@JsonProperty("links") @SerialName("links") val links: List<ExtractorLink>? = null,
|
||||||
@JsonProperty("subs") val subs: List<SubtitleData>? = null,
|
@JsonProperty("subs") @SerialName("subs") val subs: List<SubtitleData>? = null,
|
||||||
) {
|
) {
|
||||||
fun toWrapper(): DownloadQueueWrapper {
|
fun toWrapper(): DownloadQueueWrapper {
|
||||||
return DownloadQueueWrapper(null, this)
|
return DownloadQueueWrapper(null, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DownloadCached {
|
||||||
|
val id: Int
|
||||||
|
}
|
||||||
|
|
||||||
abstract class DownloadCached(
|
@OptIn(ExperimentalSerializationApi::class) // KeepGeneratedSerializer is an experimental annotation for now
|
||||||
@JsonProperty("id") open val id: Int,
|
@KeepGeneratedSerializer
|
||||||
)
|
@Serializable(with = DownloadEpisodeCached.Serializer::class)
|
||||||
|
|
||||||
data class DownloadEpisodeCached(
|
data class DownloadEpisodeCached(
|
||||||
@JsonProperty("name") val name: String?,
|
@JsonProperty("name") @SerialName("name") val name: String?,
|
||||||
@JsonProperty("poster") val poster: String?,
|
@JsonProperty("poster") @SerialName("poster") val poster: String?,
|
||||||
@JsonProperty("episode") val episode: Int,
|
@JsonProperty("episode") @SerialName("episode") val episode: Int,
|
||||||
@JsonProperty("season") val season: Int?,
|
@JsonProperty("season") @SerialName("season") val season: Int?,
|
||||||
@JsonProperty("parentId") val parentId: Int,
|
@JsonProperty("parentId") @SerialName("parentId") val parentId: Int,
|
||||||
@JsonProperty("score") var score: Score? = null,
|
@JsonProperty("score") @SerialName("score") var score: Score? = null,
|
||||||
@JsonProperty("description") val description: String?,
|
@JsonProperty("description") @SerialName("description") val description: String?,
|
||||||
@JsonProperty("cacheTime") val cacheTime: Long,
|
@JsonProperty("cacheTime") @SerialName("cacheTime") val cacheTime: Long,
|
||||||
override val id: Int,
|
@JsonProperty("id") @SerialName("id") override val id: Int,
|
||||||
) : DownloadCached(id) {
|
) : DownloadCached {
|
||||||
|
object Serializer : WriteOnlySerializer<DownloadEpisodeCached>(
|
||||||
|
DownloadEpisodeCached.generatedSerializer(),
|
||||||
|
setOf("rating"),
|
||||||
|
)
|
||||||
|
|
||||||
@JsonProperty("rating", access = JsonProperty.Access.WRITE_ONLY)
|
@JsonProperty("rating", access = JsonProperty.Access.WRITE_ONLY)
|
||||||
|
@SerialName("rating")
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
"`rating` is the old scoring system, use score instead",
|
"`rating` is the old scoring system, use score instead",
|
||||||
replaceWith = ReplaceWith("score"),
|
replaceWith = ReplaceWith("score"),
|
||||||
level = DeprecationLevel.ERROR
|
level = DeprecationLevel.ERROR,
|
||||||
)
|
)
|
||||||
var rating: Int? = null
|
var rating: Int? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|
@ -87,74 +106,81 @@ object DownloadObjects {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** What to display to the user for a downloaded show/movie. Includes info such as name, poster and url */
|
/** What to display to the user for a downloaded show/movie. Includes info such as name, poster and url */
|
||||||
|
@Serializable
|
||||||
data class DownloadHeaderCached(
|
data class DownloadHeaderCached(
|
||||||
@JsonProperty("apiName") val apiName: String,
|
@JsonProperty("apiName") @SerialName("apiName") val apiName: String,
|
||||||
@JsonProperty("url") val url: String,
|
@JsonProperty("url") @SerialName("url") val url: String,
|
||||||
@JsonProperty("type") val type: TvType,
|
@JsonProperty("type") @SerialName("type") val type: TvType,
|
||||||
@JsonProperty("name") val name: String,
|
@JsonProperty("name") @SerialName("name") val name: String,
|
||||||
@JsonProperty("poster") val poster: String?,
|
@JsonProperty("poster") @SerialName("poster") val poster: String?,
|
||||||
@JsonProperty("cacheTime") val cacheTime: Long,
|
@JsonProperty("cacheTime") @SerialName("cacheTime") val cacheTime: Long,
|
||||||
override val id: Int,
|
@JsonProperty("id") @SerialName("id") override val id: Int,
|
||||||
) : DownloadCached(id)
|
) : DownloadCached
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class DownloadResumePackage(
|
data class DownloadResumePackage(
|
||||||
@JsonProperty("item") val item: DownloadItem,
|
@JsonProperty("item") @SerialName("item") val item: DownloadItem,
|
||||||
/** Tills which link should get resumed */
|
/** Tills which link should get resumed */
|
||||||
@JsonProperty("linkIndex") val linkIndex: Int?,
|
@JsonProperty("linkIndex") @SerialName("linkIndex") val linkIndex: Int?,
|
||||||
) {
|
) {
|
||||||
fun toWrapper(): DownloadQueueWrapper {
|
fun toWrapper(): DownloadQueueWrapper {
|
||||||
return DownloadQueueWrapper(this, null)
|
return DownloadQueueWrapper(this, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class DownloadItem(
|
data class DownloadItem(
|
||||||
@JsonProperty("source") val source: String?,
|
@JsonProperty("source") @SerialName("source") val source: String?,
|
||||||
@JsonProperty("folder") val folder: String?,
|
@JsonProperty("folder") @SerialName("folder") val folder: String?,
|
||||||
@JsonProperty("ep") val ep: DownloadEpisodeMetadata,
|
@JsonProperty("ep") @SerialName("ep") val ep: DownloadEpisodeMetadata,
|
||||||
@JsonProperty("links") val links: List<ExtractorLink>,
|
@JsonProperty("links") @SerialName("links") val links: List<ExtractorLink>,
|
||||||
)
|
)
|
||||||
|
|
||||||
/** Metadata for a specific episode and how to display it. */
|
/** Metadata for a specific episode and how to display it. */
|
||||||
|
@Serializable
|
||||||
data class DownloadEpisodeMetadata(
|
data class DownloadEpisodeMetadata(
|
||||||
@JsonProperty("id") val id: Int,
|
@JsonProperty("id") @SerialName("id") val id: Int,
|
||||||
@JsonProperty("parentId") val parentId: Int,
|
@JsonProperty("parentId") @SerialName("parentId") val parentId: Int,
|
||||||
@JsonProperty("mainName") val mainName: String,
|
@JsonProperty("mainName") @SerialName("mainName") val mainName: String,
|
||||||
@JsonProperty("sourceApiName") val sourceApiName: String?,
|
@JsonProperty("sourceApiName") @SerialName("sourceApiName") val sourceApiName: String?,
|
||||||
@JsonProperty("poster") val poster: String?,
|
@JsonProperty("poster") @SerialName("poster") val poster: String?,
|
||||||
@JsonProperty("name") val name: String?,
|
@JsonProperty("name") @SerialName("name") val name: String?,
|
||||||
@JsonProperty("season") val season: Int?,
|
@JsonProperty("season") @SerialName("season") val season: Int?,
|
||||||
@JsonProperty("episode") val episode: Int?,
|
@JsonProperty("episode") @SerialName("episode") val episode: Int?,
|
||||||
@JsonProperty("type") val type: TvType?,
|
@JsonProperty("type") @SerialName("type") val type: TvType?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class DownloadedFileInfo(
|
data class DownloadedFileInfo(
|
||||||
@JsonProperty("totalBytes") val totalBytes: Long,
|
@JsonProperty("totalBytes") @SerialName("totalBytes") val totalBytes: Long,
|
||||||
@JsonProperty("relativePath") val relativePath: String,
|
@JsonProperty("relativePath") @SerialName("relativePath") val relativePath: String,
|
||||||
@JsonProperty("displayName") val displayName: String,
|
@JsonProperty("displayName") @SerialName("displayName") val displayName: String,
|
||||||
@JsonProperty("extraInfo") val extraInfo: String? = null,
|
@JsonProperty("extraInfo") @SerialName("extraInfo") val extraInfo: String? = null,
|
||||||
@JsonProperty("basePath") val basePath: String? = null, // null is for legacy downloads. See getBasePath()
|
@JsonProperty("basePath") @SerialName("basePath") val basePath: String? = null, // null is for legacy downloads. See getBasePath()
|
||||||
// Hash of the link associated with this DownloadFile, used so not override old data in the DownloadedFileInfo
|
// Hash of the link associated with this DownloadFile, used so not override old data in the DownloadedFileInfo
|
||||||
@JsonProperty("linkHash") val linkHash : Int? = null
|
@JsonProperty("linkHash") @SerialName("linkHash") val linkHash: Int? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
@SkipSerializationTest // Uri has issues with Jackson
|
||||||
data class DownloadedFileInfoResult(
|
data class DownloadedFileInfoResult(
|
||||||
@JsonProperty("fileLength") val fileLength: Long,
|
@JsonProperty("fileLength") @SerialName("fileLength") val fileLength: Long,
|
||||||
@JsonProperty("totalBytes") val totalBytes: Long,
|
@JsonProperty("totalBytes") @SerialName("totalBytes") val totalBytes: Long,
|
||||||
@JsonProperty("path") val path: Uri,
|
@JsonProperty("path") @SerialName("path")
|
||||||
|
@Serializable(with = UriSerializer::class)
|
||||||
|
val path: Uri,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class ResumeWatching(
|
data class ResumeWatching(
|
||||||
@JsonProperty("parentId") val parentId: Int,
|
@JsonProperty("parentId") @SerialName("parentId") val parentId: Int,
|
||||||
@JsonProperty("episodeId") val episodeId: Int?,
|
@JsonProperty("episodeId") @SerialName("episodeId") val episodeId: Int?,
|
||||||
@JsonProperty("episode") val episode: Int?,
|
@JsonProperty("episode") @SerialName("episode") val episode: Int?,
|
||||||
@JsonProperty("season") val season: Int?,
|
@JsonProperty("season") @SerialName("season") val season: Int?,
|
||||||
@JsonProperty("updateTime") val updateTime: Long,
|
@JsonProperty("updateTime") @SerialName("updateTime") val updateTime: Long,
|
||||||
@JsonProperty("isFromDownload") val isFromDownload: Boolean,
|
@JsonProperty("isFromDownload") @SerialName("isFromDownload") val isFromDownload: Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
data class DownloadStatus(
|
data class DownloadStatus(
|
||||||
/** if you should retry with the same args and hope for a better result */
|
/** if you should retry with the same args and hope for a better result */
|
||||||
val retrySame: Boolean,
|
val retrySame: Boolean,
|
||||||
|
|
@ -164,20 +190,19 @@ object DownloadObjects {
|
||||||
val success: Boolean,
|
val success: Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
data class CreateNotificationMetadata(
|
data class CreateNotificationMetadata(
|
||||||
val type: VideoDownloadManager.DownloadType,
|
val type: VideoDownloadManager.DownloadType,
|
||||||
val bytesDownloaded: Long,
|
val bytesDownloaded: Long,
|
||||||
val bytesTotal: Long,
|
val bytesTotal: Long,
|
||||||
val hlsProgress: Long? = null,
|
val hlsProgress: Long? = null,
|
||||||
val hlsTotal: Long? = null,
|
val hlsTotal: Long? = null,
|
||||||
val bytesPerSecond: Long
|
val bytesPerSecond: Long,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class StreamData(
|
data class StreamData(
|
||||||
private val fileLength: Long,
|
private val fileLength: Long,
|
||||||
val file: SafeFile,
|
val file: SafeFile,
|
||||||
//val fileStream: OutputStream,
|
// val fileStream: OutputStream,
|
||||||
) {
|
) {
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
fun open(): OutputStream {
|
fun open(): OutputStream {
|
||||||
|
|
@ -198,9 +223,11 @@ object DownloadObjects {
|
||||||
val exists: Boolean get() = file.exists() == true
|
val exists: Boolean get() = file.exists() == true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/** bytes have the size end-start where the byte range is [start,end)
|
* Bytes have the size end-start where the byte range is [start,end)
|
||||||
* note that ByteArray is a pointer and therefore cant be stored without cloning it */
|
* note that ByteArray is a pointer and therefore can't be stored
|
||||||
|
* without cloning it.
|
||||||
|
*/
|
||||||
data class LazyStreamDownloadResponse(
|
data class LazyStreamDownloadResponse(
|
||||||
val bytes: ByteArray,
|
val bytes: ByteArray,
|
||||||
val startByte: Long,
|
val startByte: Long,
|
||||||
|
|
@ -221,4 +248,4 @@ object DownloadObjects {
|
||||||
return Objects.hash(startByte, endByte)
|
return Objects.hash(startByte, endByte)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.lagradost.cloudstream3.utils.serializers
|
package com.lagradost.cloudstream3.utils.serializers
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import com.lagradost.cloudstream3.InternalAPI
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||||
|
|
@ -26,6 +27,7 @@ import kotlinx.serialization.encoding.Encoder
|
||||||
* val uri: Uri,
|
* val uri: Uri,
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@InternalAPI
|
||||||
object UriSerializer : KSerializer<Uri> {
|
object UriSerializer : KSerializer<Uri> {
|
||||||
override val descriptor: SerialDescriptor =
|
override val descriptor: SerialDescriptor =
|
||||||
PrimitiveSerialDescriptor("Uri", PrimitiveKind.STRING)
|
PrimitiveSerialDescriptor("Uri", PrimitiveKind.STRING)
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/voice_actor_image_holder2"
|
||||||
android:layout_width="70dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="70dp"
|
||||||
android:foreground="@drawable/outline_drawable"
|
android:foreground="@drawable/outline_drawable"
|
||||||
|
|
|
||||||
|
|
@ -353,4 +353,5 @@
|
||||||
<string name="play_from_beginning_img_des">শুরু থেকে চালু করুন</string>
|
<string name="play_from_beginning_img_des">শুরু থেকে চালু করুন</string>
|
||||||
<string name="speech_recognition_unavailable">স্পিচ রিকগনিশন উপলব্ধ নেই</string>
|
<string name="speech_recognition_unavailable">স্পিচ রিকগনিশন উপলব্ধ নেই</string>
|
||||||
<string name="begin_speaking">কথা বলা শুরু করুন…</string>
|
<string name="begin_speaking">কথা বলা শুরু করুন…</string>
|
||||||
|
<string name="download_queue">ডাউনলোড তালিকা</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -730,4 +730,7 @@
|
||||||
<string name="source_priority">ソースの優先順位</string>
|
<string name="source_priority">ソースの優先順位</string>
|
||||||
<string name="source_priority_help">プレイヤーでのビデオソースの並び順を設定します</string>
|
<string name="source_priority_help">プレイヤーでのビデオソースの並び順を設定します</string>
|
||||||
<string name="show_player_metadata_overlay">プレイヤーメタデータオーバーレイを表示</string>
|
<string name="show_player_metadata_overlay">プレイヤーメタデータオーバーレイを表示</string>
|
||||||
|
<string name="video_singular">動画</string>
|
||||||
|
<string name="skip_type_preview">プレビュー</string>
|
||||||
|
<string name="player_is_live">ライブ</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -25,18 +25,18 @@
|
||||||
<string name="sort_copy">Kopijuoti</string>
|
<string name="sort_copy">Kopijuoti</string>
|
||||||
<string name="benene_des">Duoti bananai</string>
|
<string name="benene_des">Duoti bananai</string>
|
||||||
<string name="home_more_info">Daugiau informacijos</string>
|
<string name="home_more_info">Daugiau informacijos</string>
|
||||||
<string name="title_downloads">Atsiuntimai</string>
|
<string name="title_downloads">Atsisiuntimai</string>
|
||||||
<string name="subs_auto_select_language">Automatiškai pasirinkti kalbą</string>
|
<string name="subs_auto_select_language">Automatiškai pasirinkti kalbą</string>
|
||||||
<string name="error_loading_links_toast">Klaida kraunant nuorodas</string>
|
<string name="error_loading_links_toast">Klaida kraunant nuorodas</string>
|
||||||
<string name="go_forward_30">+30</string>
|
<string name="go_forward_30">+30</string>
|
||||||
<string name="download_done">Atsiuntimas baigtas</string>
|
<string name="download_done">Atsisiuntimas baigtas</string>
|
||||||
<string name="continue_watching">Tęsti žiūrėjimą</string>
|
<string name="continue_watching">Tęsti žiūrėjimą</string>
|
||||||
<string name="new_update_format" formatted="true">Rastas atnaujinimas! \n%1$s -> %2$s</string>
|
<string name="new_update_format" formatted="true">Rastas atnaujinimas!\n%1$s -> %2$s</string>
|
||||||
<string name="subs_download_languages">Atsisiųsti kalbas</string>
|
<string name="subs_download_languages">Atsisiųsti kalbas</string>
|
||||||
<string name="search_provider_text_providers">Ieškoti naudojant tiekėjus</string>
|
<string name="search_provider_text_providers">Ieškoti naudojant tiekėjus</string>
|
||||||
<string name="go_back_img_des">Grįžti atgal</string>
|
<string name="go_back_img_des">Grįžti atgal</string>
|
||||||
<string name="downloading">Siunčiama</string>
|
<string name="downloading">Siunčiama</string>
|
||||||
<string name="episode_more_options_des">Daugiau pasirinkčiu</string>
|
<string name="episode_more_options_des">Daugiau parinkčių</string>
|
||||||
<string name="play_episode">Paleisti seriją</string>
|
<string name="play_episode">Paleisti seriją</string>
|
||||||
<string name="player_speed">Grotuvo greitis</string>
|
<string name="player_speed">Grotuvo greitis</string>
|
||||||
<string name="benene_count_text">%d Bananai duoti kūrėjams</string>
|
<string name="benene_count_text">%d Bananai duoti kūrėjams</string>
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
<string name="result_tags">Žanrai</string>
|
<string name="result_tags">Žanrai</string>
|
||||||
<string name="go_back_30">-30</string>
|
<string name="go_back_30">-30</string>
|
||||||
<string name="episode_poster_img_des">Serijos plakatas</string>
|
<string name="episode_poster_img_des">Serijos plakatas</string>
|
||||||
<string name="vpn_might_be_needed">Gali reikėti VPN šitam tiekėjui, kad veiktų teisingai</string>
|
<string name="vpn_might_be_needed">Gali reikėti VPN šiam tiekėjui, kad veiktų teisingai</string>
|
||||||
<string name="search_hint_site" formatted="true">Ieškoti %s…</string>
|
<string name="search_hint_site" formatted="true">Ieškoti %s…</string>
|
||||||
<string name="github">Github</string>
|
<string name="github">Github</string>
|
||||||
<string name="benene_count_text_none">Nėra duotu bananų</string>
|
<string name="benene_count_text_none">Nėra duotu bananų</string>
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
<string name="cancel">Atšaukti</string>
|
<string name="cancel">Atšaukti</string>
|
||||||
<string name="start">Pradėti</string>
|
<string name="start">Pradėti</string>
|
||||||
<string name="cartoons_singular">Filmukas</string>
|
<string name="cartoons_singular">Filmukas</string>
|
||||||
<string name="download_canceled">Atsiuntimas atšauktas</string>
|
<string name="download_canceled">Atsisiuntimas atšauktas</string>
|
||||||
<string name="advanced_search">Išplėstinė paieška</string>
|
<string name="advanced_search">Išplėstinė paieška</string>
|
||||||
<string name="empty_library_logged_in_message">Tuščias sąrašas. Pabandykite pasirinkti kitą sąrašą.</string>
|
<string name="empty_library_logged_in_message">Tuščias sąrašas. Pabandykite pasirinkti kitą sąrašą.</string>
|
||||||
<string name="chromecast_subtitles_settings">Chromecast subtitrai</string>
|
<string name="chromecast_subtitles_settings">Chromecast subtitrai</string>
|
||||||
|
|
@ -93,10 +93,10 @@
|
||||||
<string name="type_completed">Užbaigta</string>
|
<string name="type_completed">Užbaigta</string>
|
||||||
<string name="use_system_brightness_settings_des">Naudoti sistemos ryškumą programos grotuve vietoj tamsumo</string>
|
<string name="use_system_brightness_settings_des">Naudoti sistemos ryškumą programos grotuve vietoj tamsumo</string>
|
||||||
<string name="restore_failed_format" formatted="true">Nepavyko atstatyti duomenis iš failo %s</string>
|
<string name="restore_failed_format" formatted="true">Nepavyko atstatyti duomenis iš failo %s</string>
|
||||||
<string name="play_trailer_button">Paleisti anonsa</string>
|
<string name="play_trailer_button">Paleisti anonsą</string>
|
||||||
<string name="play_livestream_button">Paleisti gyva transliacija</string>
|
<string name="play_livestream_button">Paleisti gyvą transliaciją</string>
|
||||||
<string name="no_episodes_found">Nerasta serijų</string>
|
<string name="no_episodes_found">Nerasta serijų</string>
|
||||||
<string name="vpn_torrent">Šis tiekėjas yra iš Torrentų, VPN rekomenduojama naudoti</string>
|
<string name="vpn_torrent">Šis tiekėjas yra iš Torrent\'ų, rekomenduojamas VPN</string>
|
||||||
<string name="test_failed">Nepavyko</string>
|
<string name="test_failed">Nepavyko</string>
|
||||||
<string name="result_poster_img_des">Plakatas</string>
|
<string name="result_poster_img_des">Plakatas</string>
|
||||||
<string name="popup_play_file">Paleisti failą</string>
|
<string name="popup_play_file">Paleisti failą</string>
|
||||||
|
|
@ -108,21 +108,21 @@
|
||||||
<string name="redo_setup_process">Perdaryti nustatymo procesą</string>
|
<string name="redo_setup_process">Perdaryti nustatymo procesą</string>
|
||||||
<string name="episodes_range">%1$d-%2$d</string>
|
<string name="episodes_range">%1$d-%2$d</string>
|
||||||
<string name="benene">Duoti bananą kūrėjams</string>
|
<string name="benene">Duoti bananą kūrėjams</string>
|
||||||
<string name="go_back">Sugryšti</string>
|
<string name="go_back">Sugrįšti</string>
|
||||||
<string name="copy_link_toast">Nuoroda nukopijuota į iškarpinę</string>
|
<string name="copy_link_toast">Nuoroda nukopijuota į iškarpinę</string>
|
||||||
<string name="search">Paieška</string>
|
<string name="search">Paieška</string>
|
||||||
<string name="settings_info">Informacija</string>
|
<string name="settings_info">Informacija</string>
|
||||||
<string name="skip_loading">Praleisti įkėlima</string>
|
<string name="skip_loading">Praleisti įkėlimą</string>
|
||||||
<string name="home_info">Informacija</string>
|
<string name="home_info">Informacija</string>
|
||||||
<string name="next_episode_format" formatted="true">Serija %d bus išleista</string>
|
<string name="next_episode_format" formatted="true">Serija %d bus išleista</string>
|
||||||
<string name="sort_save">Išsaugoti</string>
|
<string name="sort_save">Išsaugoti</string>
|
||||||
<string name="clipboard_too_large">Perdaug teksto. Nepavyko išsaugoti i iškarpynę.</string>
|
<string name="clipboard_too_large">Perdaug teksto. Nepavyko išsaugoti i iškarpynę.</string>
|
||||||
<string name="download_failed">Atsiuntimas nepavyko</string>
|
<string name="download_failed">Atsisiuntimas nepavyko</string>
|
||||||
<string name="result_share">Pasidalinti</string>
|
<string name="result_share">Pasidalinti</string>
|
||||||
<string name="home_main_poster_img_des">Pagrindinis Plakatas</string>
|
<string name="home_main_poster_img_des">Pagrindinis Plakatas</string>
|
||||||
<string name="pick_source">Šaltiniai</string>
|
<string name="pick_source">Šaltiniai</string>
|
||||||
<string name="title_settings">Nustatymai</string>
|
<string name="title_settings">Nustatymai</string>
|
||||||
<string name="title_search">Ieškoti</string>
|
<string name="title_search">Paieška</string>
|
||||||
<string name="loading">Kraunama…</string>
|
<string name="loading">Kraunama…</string>
|
||||||
<string name="action_remove_watching">Pašalinti</string>
|
<string name="action_remove_watching">Pašalinti</string>
|
||||||
<string name="action_open_watching">Daugiau informacijos</string>
|
<string name="action_open_watching">Daugiau informacijos</string>
|
||||||
|
|
@ -138,7 +138,7 @@
|
||||||
<string name="sort_close">Uždaryti</string>
|
<string name="sort_close">Uždaryti</string>
|
||||||
<string name="action_add_to_bookmarks">Nustatyti žiūrėjimo statusą</string>
|
<string name="action_add_to_bookmarks">Nustatyti žiūrėjimo statusą</string>
|
||||||
<string name="play_with_app_name">Paleisti su CloudStream</string>
|
<string name="play_with_app_name">Paleisti su CloudStream</string>
|
||||||
<string name="subs_subtitle_elevation">Subtitrų iškėlimas</string>
|
<string name="subs_subtitle_elevation">Subtitrų lygis</string>
|
||||||
<string name="episodes">Serijos</string>
|
<string name="episodes">Serijos</string>
|
||||||
<string name="cast_format" formatted="true">Skleisti: %s</string>
|
<string name="cast_format" formatted="true">Skleisti: %s</string>
|
||||||
<string name="season">Sezonas</string>
|
<string name="season">Sezonas</string>
|
||||||
|
|
@ -248,4 +248,51 @@
|
||||||
<string name="confirm_exit_dialog">Ar tikrai norite išeiti?</string>
|
<string name="confirm_exit_dialog">Ar tikrai norite išeiti?</string>
|
||||||
<string name="action_remove_from_watched">Pašalinti iš žiūrimų</string>
|
<string name="action_remove_from_watched">Pašalinti iš žiūrimų</string>
|
||||||
<string name="audio_tracks">Garso takelis</string>
|
<string name="audio_tracks">Garso takelis</string>
|
||||||
|
<string name="filler" formatted="true">Užpildymas</string>
|
||||||
|
<string name="duration_format" formatted="true">%d min</string>
|
||||||
|
<string name="title_home">Namai</string>
|
||||||
|
<string name="download_queue">Atsisiuntimų eilė</string>
|
||||||
|
<string name="speech_recognition_unavailable">Balso atpažinimas nepasiekiamas</string>
|
||||||
|
<string name="begin_speaking">Pradėkite kalbėti…</string>
|
||||||
|
<string name="type_dropped">Nežiūrimas</string>
|
||||||
|
<string name="play_full_series_button">Paleisti visą seriją</string>
|
||||||
|
<string name="torrent_info">Šis įrašas yra Torrent\'e, tai reiškia, kad tavo įrašo veikla gali būti sekama. Įsitikinkite, kad suprantate Torrenting prieš tęsiant.</string>
|
||||||
|
<string name="reload_error">Atkurti ryšį…</string>
|
||||||
|
<string name="downloads_delete_select">Pasirinkite elementus, kuriuos norite pašalinti</string>
|
||||||
|
<string name="downloads_empty">Šiuo metu atsisiuntimų nėra.</string>
|
||||||
|
<string name="queue_empty_message">Šiuo metu atsisiuntimų eilėje nėra.</string>
|
||||||
|
<string name="offline_file">Pasiekiama žiūrėti neprisijungus</string>
|
||||||
|
<string name="select_all">Pasirinkti viską</string>
|
||||||
|
<string name="deselect_all">Panaikinti visus pasirinkimus</string>
|
||||||
|
<string name="stream">Tinklo srautas</string>
|
||||||
|
<string name="open_local_video">Atidaryti vietinį video</string>
|
||||||
|
<string name="links_reloaded_toast">Nuorodos perkrautos</string>
|
||||||
|
<string name="app_subbed_text">Subtitrai</string>
|
||||||
|
<string name="repo_copy_label">Repozitorijos pavadinimas ir adresas</string>
|
||||||
|
<string name="toast_copied">nukopijuota!</string>
|
||||||
|
<string name="subscribe_tooltip">Naujos serijos pranešimas</string>
|
||||||
|
<string name="result_search_tooltip">Ieškoti kituose plėtiniuose</string>
|
||||||
|
<string name="recommendations_tooltip">Rodyti rekomendacijas</string>
|
||||||
|
<string name="subs_outline_color">Apvado spalva</string>
|
||||||
|
<string name="subs_edge_type">Rėmelio tipas</string>
|
||||||
|
<string name="search_provider_text_types">Ieškoti naudojant tipus</string>
|
||||||
|
<string name="subs_hold_to_reset_to_default">Laikyti ilgai, kad sugražinti pradinius nustatymus</string>
|
||||||
|
<string name="subs_import_text" formatted="true">Įkelti šriftus sudedant juos į %s</string>
|
||||||
|
<string name="provider_info_meta">Metaduomenys nesuteikiamos svetainės, vaizdo įkėlimas nepavyks, jeigu jo nebus svetainėje.</string>
|
||||||
|
<string name="torrent_plot">Aprašymas</string>
|
||||||
|
<string name="normal_no_plot">Nėra siužeto aprašymo</string>
|
||||||
|
<string name="torrent_no_plot">Aprašymas nerastas</string>
|
||||||
|
<string name="show_log_cat">Rodyti Logcat</string>
|
||||||
|
<string name="picture_in_picture">Vaizdas vaizde</string>
|
||||||
|
<string name="picture_in_picture_des">Tęsia atkūrimą mažame grotuve virš kitų programų</string>
|
||||||
|
<string name="player_size_settings">Grotuvo dydžio pakeitimo mygtukas</string>
|
||||||
|
<string name="player_size_settings_des">Pašalinti juodas paraštes</string>
|
||||||
|
<string name="player_subtitles_settings">Subtitrai</string>
|
||||||
|
<string name="chromecast_subtitles_settings_des">Chromecast subtitrų nustatymai</string>
|
||||||
|
<string name="eigengraumode_settings">Atkūrimo sparta</string>
|
||||||
|
<string name="speed_setting_summary">Prideda greičio pasirinkimą grotuve</string>
|
||||||
|
<string name="swipe_to_seek_settings">Braukite, kas ieškotumėte</string>
|
||||||
|
<string name="swipe_to_seek_settings_des">Braukite į šonus, kad kontroliuotumėte padėtį vaizdo įraše</string>
|
||||||
|
<string name="swipe_to_change_settings">Braukite, kad pakeistumėte nustatymus</string>
|
||||||
|
<string name="swipe_to_change_settings_des">Braukite aukštyn arba žemyn ekrano kairėje arba dešinėje, jei norite pakeisti ryškumą arba garsą</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -287,12 +287,12 @@
|
||||||
<string name="pref_category_defaults">Parasts</string>
|
<string name="pref_category_defaults">Parasts</string>
|
||||||
<string name="pref_category_looks">Izskats</string>
|
<string name="pref_category_looks">Izskats</string>
|
||||||
<string name="pref_category_ui_features">Funkcijas</string>
|
<string name="pref_category_ui_features">Funkcijas</string>
|
||||||
<string name="category_general">Ģenerāls</string>
|
<string name="category_general">Vispārīgie</string>
|
||||||
<string name="random_button_settings">Randomā poga</string>
|
<string name="random_button_settings">Randomā poga</string>
|
||||||
<string name="random_button_settings_desc">Rādīt izlases pogu Sākums un Bibliotēka sadaļās</string>
|
<string name="random_button_settings_desc">Rādīt izlases pogu Sākums un Bibliotēka sadaļās</string>
|
||||||
<string name="provider_lang_settings">Papildinājuma valodas</string>
|
<string name="provider_lang_settings">Papildinājuma valodas</string>
|
||||||
<string name="app_layout">Lietotnes izkārtojums</string>
|
<string name="app_layout">Lietotnes izkārtojums</string>
|
||||||
<string name="preferred_media_settings">Izvēlētā media</string>
|
<string name="preferred_media_settings">Vēlamie multimediji</string>
|
||||||
<string name="enable_nsfw_on_providers">Iespējot nepiedienīgu, izaicinošu saturu (NSFW) atbalstītajos papildinājumos</string>
|
<string name="enable_nsfw_on_providers">Iespējot nepiedienīgu, izaicinošu saturu (NSFW) atbalstītajos papildinājumos</string>
|
||||||
<string name="subtitles_encoding">Subtitru kodējums</string>
|
<string name="subtitles_encoding">Subtitru kodējums</string>
|
||||||
<string name="category_providers">Devēji</string>
|
<string name="category_providers">Devēji</string>
|
||||||
|
|
@ -372,7 +372,7 @@
|
||||||
<string name="error">Kļūda</string>
|
<string name="error">Kļūda</string>
|
||||||
<string name="subtitles_remove_captions">Noņemt slēgtos parakstus no subtitriem</string>
|
<string name="subtitles_remove_captions">Noņemt slēgtos parakstus no subtitriem</string>
|
||||||
<string name="subtitles_remove_bloat">Noņemt lieko no subtitriem (piemēram, reklāmu)</string>
|
<string name="subtitles_remove_bloat">Noņemt lieko no subtitriem (piemēram, reklāmu)</string>
|
||||||
<string name="subtitles_filter_lang">Filtrēt pēc vēlamās multivides valodas</string>
|
<string name="subtitles_filter_lang">Atlasīt pēc vēlamās multimediju valodas</string>
|
||||||
<string name="extras">Ekstras</string>
|
<string name="extras">Ekstras</string>
|
||||||
<string name="trailer">Treileris</string>
|
<string name="trailer">Treileris</string>
|
||||||
<string name="network_adress_example">https://piemērs.com/piemērs.mp4</string>
|
<string name="network_adress_example">https://piemērs.com/piemērs.mp4</string>
|
||||||
|
|
@ -382,7 +382,7 @@
|
||||||
<string name="previous">Iepriekšējais</string>
|
<string name="previous">Iepriekšējais</string>
|
||||||
<string name="skip_setup">Izlaist uzstādīšanu</string>
|
<string name="skip_setup">Izlaist uzstādīšanu</string>
|
||||||
<string name="app_layout_subtext">Mainiet lietotnes izskatu, lai tā atbilstu savai ierīcei</string>
|
<string name="app_layout_subtext">Mainiet lietotnes izskatu, lai tā atbilstu savai ierīcei</string>
|
||||||
<string name="preferred_media_subtext">Ko tu vēlies redzēt</string>
|
<string name="preferred_media_subtext">Ko jūs vēlētos skatīt</string>
|
||||||
<string name="setup_done">Pabeigts</string>
|
<string name="setup_done">Pabeigts</string>
|
||||||
<string name="extensions">Papildinājumi</string>
|
<string name="extensions">Papildinājumi</string>
|
||||||
<string name="add_repository">Pievienot repozitoriju</string>
|
<string name="add_repository">Pievienot repozitoriju</string>
|
||||||
|
|
@ -607,4 +607,11 @@
|
||||||
<string name="delete_message_series_only" formatted="true">Vai tiešām vēlaties neatgriezeniski dzēst visas šī seriāla, raidījuma epizodes?\n\n%s</string>
|
<string name="delete_message_series_only" formatted="true">Vai tiešām vēlaties neatgriezeniski dzēst visas šī seriāla, raidījuma epizodes?\n\n%s</string>
|
||||||
<string name="queue_empty_message">Pašlaik nav nevienas rindā ievietotas lejupielādes.</string>
|
<string name="queue_empty_message">Pašlaik nav nevienas rindā ievietotas lejupielādes.</string>
|
||||||
<string name="open_local_video">Atvērt vietējo video</string>
|
<string name="open_local_video">Atvērt vietējo video</string>
|
||||||
|
<string name="custom_media_singular">Multimedija</string>
|
||||||
|
<string name="video_info">Multimediju informācija</string>
|
||||||
|
<string name="torrent_preferred_media">Iespējojiet torrentu Iestatījumi/Pakalpojumu sniedzēji/Vēlamie multimediji sadaļā</string>
|
||||||
|
<string name="subscribe_tooltip">Paziņojums par jaunu epizodi</string>
|
||||||
|
<string name="extra_brightness_settings">Papildu spilgtums</string>
|
||||||
|
<string name="extra_brightness_key">Papildu spilgtums iespējots</string>
|
||||||
|
<string name="search_suggestions">Meklēšanas ieteikumi</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -677,4 +677,9 @@
|
||||||
<string name="confirm_before_exiting_title">Bevestig voor afsluiten</string>
|
<string name="confirm_before_exiting_title">Bevestig voor afsluiten</string>
|
||||||
<string name="confirm_before_exiting_desc">Toon dialoogvenster voordat de app wordt afgesloten</string>
|
<string name="confirm_before_exiting_desc">Toon dialoogvenster voordat de app wordt afgesloten</string>
|
||||||
<string name="subs_edge_size">Randgrote</string>
|
<string name="subs_edge_size">Randgrote</string>
|
||||||
|
<string name="show_player_metadata_overlay">Laat Speler Metadata Overlay zien</string>
|
||||||
|
<string name="device_pin_error_message">Kon de apparaat PIN niet vinden, probeer locale authenticatie</string>
|
||||||
|
<string name="torrent_preferred_media">Zet torrent aan in Instellingen/Providers/Media voorkeur</string>
|
||||||
|
<string name="torrent_not_accepted">Herstart de app en accepteer de Stream Torrent pop-up om verder te gaan.</string>
|
||||||
|
<string name="update_plugins_manually">Handmatige Update Knop</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
كلاودستريم
|
CloudStream
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@ junit = "4.13.2"
|
||||||
junitKtx = "1.3.0"
|
junitKtx = "1.3.0"
|
||||||
junitVersion = "1.3.0"
|
junitVersion = "1.3.0"
|
||||||
juniversalchardet = "2.5.0"
|
juniversalchardet = "2.5.0"
|
||||||
kotlinGradlePlugin = "2.3.20"
|
kotlinGradlePlugin = "2.4.0"
|
||||||
kotlinxAtomicfu = "0.33.0"
|
kotlinxAtomicfu = "0.33.0"
|
||||||
kotlinxCollectionsImmutable = "0.4.0"
|
kotlinxCollectionsImmutable = "0.4.0"
|
||||||
kotlinxCoroutinesCore = "1.11.0"
|
kotlinxCoroutines = "1.11.0"
|
||||||
kotlinxDatetime = "0.8.0"
|
kotlinxDatetime = "0.8.0"
|
||||||
kotlinxSerializationJson = "1.11.0"
|
kotlinxSerializationJson = "1.11.0"
|
||||||
ksoup = "0.2.6"
|
ksoup = "0.2.6"
|
||||||
|
|
@ -59,11 +59,11 @@ zipline = "1.27.0"
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "1.8"
|
||||||
jdkToolchain = "17"
|
jdkToolchain = "17"
|
||||||
minSdk = "23"
|
minSdk = "23"
|
||||||
compileSdk = "36"
|
compileSdk = "37"
|
||||||
targetSdk = "36"
|
targetSdk = "36"
|
||||||
|
|
||||||
versionCode = "68"
|
versionCode = "68"
|
||||||
versionName = "4.7.0"
|
versionName = "4.8.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" }
|
activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" }
|
||||||
|
|
@ -96,7 +96,8 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref =
|
||||||
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlinGradlePlugin" }
|
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlinGradlePlugin" }
|
||||||
kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "kotlinxAtomicfu" }
|
kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "kotlinxAtomicfu" }
|
||||||
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinxCollectionsImmutable" }
|
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinxCollectionsImmutable" }
|
||||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
|
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
|
||||||
|
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
|
||||||
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
|
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
|
||||||
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
|
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
|
||||||
ksoup = { module = "com.fleeksoft.ksoup:ksoup", version.ref = "ksoup" }
|
ksoup = { module = "com.fleeksoft.ksoup:ksoup", version.ref = "ksoup" }
|
||||||
|
|
|
||||||
15
library/README.md
Normal file
15
library/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
## CloudStream extension library
|
||||||
|
|
||||||
|
This is the official API surface for all CloudStream plugins.
|
||||||
|
|
||||||
|
To ensure that all plugins work on both the stable release and pre-release we must have
|
||||||
|
binary compatibility on all changes. All new changes must be marked with `@Prerelease` to
|
||||||
|
prevent accidental usage among extension developers.
|
||||||
|
|
||||||
|
We use Kotlin binary compatibility validation using:
|
||||||
|
|
||||||
|
``./gradlew checkKotlinAbi``
|
||||||
|
|
||||||
|
If you for some reason must update the binary compatibility then manually edit `api/jvm/library.api` or use:
|
||||||
|
|
||||||
|
``./gradlew updateKotlinAbi``
|
||||||
8318
library/api/jvm/library.api
Normal file
8318
library/api/jvm/library.api
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -41,10 +41,7 @@ kotlin {
|
||||||
jvm()
|
jvm()
|
||||||
|
|
||||||
compilerOptions {
|
compilerOptions {
|
||||||
freeCompilerArgs.addAll(
|
freeCompilerArgs.add("-Xexpect-actual-classes")
|
||||||
"-Xexpect-actual-classes",
|
|
||||||
"-Xannotation-default-target=param-property"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|
@ -69,13 +66,11 @@ kotlin {
|
||||||
implementation(libs.rhino) // Run JavaScript
|
implementation(libs.rhino) // Run JavaScript
|
||||||
implementation(libs.tmdb.java) // TMDB API v3 Wrapper Made with RetroFit
|
implementation(libs.tmdb.java) // TMDB API v3 Wrapper Made with RetroFit
|
||||||
implementation(libs.bundles.cryptography) // Cryptography
|
implementation(libs.bundles.cryptography) // Cryptography
|
||||||
|
|
||||||
// Deprecated; will be removed once extensions have time to migrate from using it
|
|
||||||
implementation("me.xdrop:fuzzywuzzy:1.4.0")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commonTest.dependencies {
|
commonTest.dependencies {
|
||||||
implementation(libs.kotlin.test)
|
implementation(libs.kotlin.test)
|
||||||
|
implementation(libs.kotlinx.coroutines.test)
|
||||||
}
|
}
|
||||||
|
|
||||||
val jvmCommonMain by creating {
|
val jvmCommonMain by creating {
|
||||||
|
|
@ -89,6 +84,17 @@ kotlin {
|
||||||
androidMain { dependsOn(jvmCommonMain) }
|
androidMain { dependsOn(jvmCommonMain) }
|
||||||
jvmMain { dependsOn(jvmCommonMain) }
|
jvmMain { dependsOn(jvmCommonMain) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation::class)
|
||||||
|
// https://kotlinlang.org/docs/gradle-binary-compatibility-validation.html
|
||||||
|
abiValidation {
|
||||||
|
filters {
|
||||||
|
exclude {
|
||||||
|
annotatedWith.add("com.lagradost.cloudstream3.Prerelease")
|
||||||
|
annotatedWith.add("com.lagradost.cloudstream3.InternalAPI")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinJvmCompile> {
|
tasks.withType<KotlinJvmCompile> {
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,14 @@ package com.lagradost.api
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import java.lang.ref.WeakReference
|
import java.lang.ref.WeakReference
|
||||||
|
|
||||||
var ctx: WeakReference<Context>? = null
|
private var contextRef: WeakReference<Context>? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for Android specific context. Not usable in JVM.
|
* Helper function for Android specific context. Not usable in JVM.
|
||||||
* Do not use this unless absolutely necessary.
|
* Do not use this unless absolutely necessary.
|
||||||
*/
|
*/
|
||||||
actual fun getContext(): Any? {
|
actual fun getContext(): Any? = contextRef?.get()
|
||||||
return ctx?.get()
|
|
||||||
}
|
|
||||||
|
|
||||||
actual fun setContext(context: WeakReference<Any>) {
|
actual fun setContext(context: Any?) {
|
||||||
val actualContext = context.get() as? Context
|
contextRef = (context as? Context)?.let { WeakReference(it) }
|
||||||
if (actualContext != null) {
|
}
|
||||||
ctx = WeakReference(actualContext)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,20 @@
|
||||||
package com.lagradost.cloudstream3.utils
|
package com.lagradost.cloudstream3.utils
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import androidx.annotation.AnyThread
|
import androidx.annotation.AnyThread
|
||||||
import androidx.annotation.MainThread
|
import androidx.annotation.MainThread
|
||||||
|
|
||||||
|
@SuppressLint("ThreadConstraint") // mainLooper.isCurrentThread does not switch the context
|
||||||
@AnyThread
|
@AnyThread
|
||||||
actual fun runOnMainThreadNative(@MainThread work: () -> Unit) {
|
actual fun runOnMainThreadNative(@MainThread work: () -> Unit) {
|
||||||
val mainHandler = Handler(Looper.getMainLooper())
|
val mainLooper = Looper.getMainLooper()
|
||||||
mainHandler.post {
|
if (mainLooper.isCurrentThread) {
|
||||||
|
// Do the work directly if we already are on the main thread, no need to enqueue it
|
||||||
work()
|
work()
|
||||||
|
} else {
|
||||||
|
// Otherwise post it to the other main thread
|
||||||
|
Handler(mainLooper).post(work)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.lagradost.cloudstream3.utils
|
||||||
|
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
// TODO: add androidMain actual using LocaleListCompat.getAdjustedDefault() to respect
|
||||||
|
// per-app language preferences set via AppCompatDelegate.setApplicationLocales()
|
||||||
|
|
||||||
|
actual fun getCurrentLocale(): String =
|
||||||
|
Locale.getDefault().toLanguageTag()
|
||||||
|
|
||||||
|
actual fun localizedLanguageName(ietfTag: String, localizedTo: String): String? {
|
||||||
|
val localeOfLangCode = Locale.forLanguageTag(ietfTag)
|
||||||
|
val localeOfLocalizeTo = Locale.forLanguageTag(localizedTo)
|
||||||
|
val displayName = localeOfLangCode.getDisplayName(localeOfLocalizeTo)
|
||||||
|
|
||||||
|
// Locale.getDisplayName() falls back to the raw tag or "language (country)" form
|
||||||
|
// when it doesn't know how to render the name.
|
||||||
|
val langCodeWithCountry = "${localeOfLangCode.language} ("
|
||||||
|
val failed =
|
||||||
|
displayName.equals(ietfTag, ignoreCase = true) ||
|
||||||
|
displayName.contains(langCodeWithCountry, ignoreCase = true)
|
||||||
|
|
||||||
|
return if (failed) null else displayName
|
||||||
|
}
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
package com.lagradost.api
|
package com.lagradost.api
|
||||||
|
|
||||||
import java.lang.ref.WeakReference
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set context for android specific code such as webview.
|
* Set context for Android-specific code such as webview.
|
||||||
* Does nothing on JVM.
|
* Does nothing on non-Android platforms.
|
||||||
*/
|
*/
|
||||||
expect fun setContext(context: WeakReference<Any>)
|
expect fun setContext(context: Any?)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for Android specific context.
|
* Helper function for Android specific context.
|
||||||
* Do not use this unless absolutely necessary.
|
* Do not use this unless absolutely necessary.
|
||||||
* setContext() must be called before this is called.
|
* setContext() must be called before this is called.
|
||||||
* @return Context if on android, null if not.
|
* @return Context if on Android, null if not.
|
||||||
*/
|
*/
|
||||||
expect fun getContext(): Any?
|
expect fun getContext(): Any?
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ import kotlinx.datetime.format.byUnicodePattern
|
||||||
import kotlinx.datetime.format.char
|
import kotlinx.datetime.format.char
|
||||||
import kotlinx.datetime.format.parse
|
import kotlinx.datetime.format.parse
|
||||||
import kotlinx.datetime.toInstant
|
import kotlinx.datetime.toInstant
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlin.io.encoding.Base64
|
import kotlin.io.encoding.Base64
|
||||||
import kotlin.jvm.JvmName
|
import kotlin.jvm.JvmName
|
||||||
|
|
@ -95,7 +97,6 @@ class ErrorLoadingException(message: String? = null) : Exception(message)
|
||||||
|
|
||||||
//val baseHeader = mapOf("User-Agent" to USER_AGENT)
|
//val baseHeader = mapOf("User-Agent" to USER_AGENT)
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
val json = Json {
|
val json = Json {
|
||||||
encodeDefaults = true
|
encodeDefaults = true
|
||||||
explicitNulls = false
|
explicitNulls = false
|
||||||
|
|
@ -325,7 +326,7 @@ object APIHolder {
|
||||||
).toJson().toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
|
).toJson().toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
|
||||||
|
|
||||||
return app.post("https://graphql.anilist.co", requestBody = data)
|
return app.post("https://graphql.anilist.co", requestBody = data)
|
||||||
.parsedSafe()
|
.parsedSafe<AniSearch>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -393,18 +394,19 @@ const val PROVIDER_STATUS_SLOW = 2
|
||||||
const val PROVIDER_STATUS_OK = 1
|
const val PROVIDER_STATUS_OK = 1
|
||||||
const val PROVIDER_STATUS_DOWN = 0
|
const val PROVIDER_STATUS_DOWN = 0
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class ProvidersInfoJson(
|
data class ProvidersInfoJson(
|
||||||
@JsonProperty("name") var name: String,
|
@JsonProperty("name") @SerialName("name") var name: String,
|
||||||
@JsonProperty("url") var url: String,
|
@JsonProperty("url") @SerialName("url") var url: String,
|
||||||
@JsonProperty("credentials") var credentials: String? = null,
|
@JsonProperty("credentials") @SerialName("credentials") var credentials: String? = null,
|
||||||
@JsonProperty("status") var status: Int,
|
@JsonProperty("status") @SerialName("status") var status: Int,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class SettingsJson(
|
data class SettingsJson(
|
||||||
@JsonProperty("enableAdult") var enableAdult: Boolean = false,
|
@JsonProperty("enableAdult") @SerialName("enableAdult") var enableAdult: Boolean = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
data class MainPageData(
|
data class MainPageData(
|
||||||
val name: String,
|
val name: String,
|
||||||
val data: String,
|
val data: String,
|
||||||
|
|
@ -759,18 +761,64 @@ fun MainAPI.fixUrl(url: String): String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sort the urls based on quality
|
/**
|
||||||
|
* Sort the urls based on quality
|
||||||
|
*
|
||||||
* @param urls Set of [ExtractorLink]
|
* @param urls Set of [ExtractorLink]
|
||||||
* */
|
*/
|
||||||
fun sortUrls(urls: Set<ExtractorLink>): List<ExtractorLink> {
|
fun sortUrls(urls: Set<ExtractorLink>): List<ExtractorLink> {
|
||||||
return urls.sortedBy { t -> -t.quality }
|
return urls.sortedBy { t -> -t.quality }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Capitalize the first letter of string.
|
/**
|
||||||
|
* Splits the parameters of a [Url] into a map of key-value pairs.
|
||||||
|
*
|
||||||
|
* Unlike a manual `split("&")` / `split("=")` implementation, this relies on Ktor's
|
||||||
|
* built-in parameters parser ([Url.parameters]), which already handles URL-decoding,
|
||||||
|
* malformed pairs, and parameters without a value.
|
||||||
|
*
|
||||||
|
* Note: if a parameter key appears multiple times (e.g. `?a=1&a=2`), only the **first**
|
||||||
|
* value is kept, since the return type is `Map<String, String>`. Use [Url.parameters]
|
||||||
|
* directly if you need all values for repeated keys.
|
||||||
|
*
|
||||||
|
* @param url the [Url] whose parameters should be extracted.
|
||||||
|
* @return a map of decoded parameter names to their first decoded value.
|
||||||
|
*
|
||||||
|
* @sample
|
||||||
|
* splitUrlParameters(Url("https://example.com/path?foo=bar&baz=qux"))
|
||||||
|
* // returns {"foo": "bar", "baz": "qux"}
|
||||||
|
*/
|
||||||
|
@Prerelease
|
||||||
|
fun splitUrlParameters(url: Url): Map<String, String> {
|
||||||
|
return url.parameters.entries().associate { (key, values) -> key to values.firstOrNull().orEmpty() }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Splits the parameters of a raw URL [String] into a map of key-value pairs.
|
||||||
|
*
|
||||||
|
* Convenience overload for callers that have a URL as plain text rather than a parsed
|
||||||
|
* [Url] instance. Internally parses [url] with Ktor's [Url] constructor and delegates
|
||||||
|
* to [splitUrlParameters].
|
||||||
|
*
|
||||||
|
* @param url the URL string whose parameters should be extracted.
|
||||||
|
* @return a map of decoded parameter names to their first decoded value.
|
||||||
|
*
|
||||||
|
* @sample
|
||||||
|
* splitUrlParameters("https://example.com/path?foo=bar&baz=qux")
|
||||||
|
* // returns {"foo": "bar", "baz": "qux"}
|
||||||
|
*/
|
||||||
|
@Prerelease
|
||||||
|
fun splitUrlParameters(url: String): Map<String, String> {
|
||||||
|
return splitUrlParameters(Url(url))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capitalize the first letter of string.
|
||||||
|
*
|
||||||
* @param str String to be capitalized
|
* @param str String to be capitalized
|
||||||
* @return non-nullable String
|
* @return non-nullable String
|
||||||
* @see capitalizeStringNullable
|
* @see capitalizeStringNullable
|
||||||
* */
|
*/
|
||||||
fun capitalizeString(str: String): String {
|
fun capitalizeString(str: String): String {
|
||||||
return capitalizeStringNullable(str) ?: str
|
return capitalizeStringNullable(str) ?: str
|
||||||
}
|
}
|
||||||
|
|
@ -797,13 +845,10 @@ fun fixTitle(str: String): String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Deprecated(
|
||||||
* Get rhino context in a safe way as it needs to be initialized on the main thread.
|
message = "Use newJsContext or evalJs instead.",
|
||||||
*
|
level = DeprecationLevel.WARNING,
|
||||||
* Make sure you get the scope using: val scope: Scriptable = rhino.initSafeStandardObjects()
|
)
|
||||||
*
|
|
||||||
* Use like the following: rhino.evaluateString(scope, js, "JavaScript", 1, null)
|
|
||||||
**/
|
|
||||||
suspend fun getRhinoContext(): org.mozilla.javascript.Context {
|
suspend fun getRhinoContext(): org.mozilla.javascript.Context {
|
||||||
return Coroutines.mainWork {
|
return Coroutines.mainWork {
|
||||||
val rhino = org.mozilla.javascript.Context.enter()
|
val rhino = org.mozilla.javascript.Context.enter()
|
||||||
|
|
@ -870,10 +915,10 @@ enum class DubStatus(val id: Int) {
|
||||||
* of this as a decimal class specifically for ratings.
|
* of this as a decimal class specifically for ratings.
|
||||||
* */
|
* */
|
||||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
||||||
|
@Serializable
|
||||||
class Score private constructor(
|
class Score private constructor(
|
||||||
/** Decimal between [0, 10^9] representing the min score and max score respectively */
|
/** Decimal between [0, 10^9] representing the min score and max score respectively */
|
||||||
@JsonProperty("data")
|
@JsonProperty("data") @SerialName("data") private val data: Int,
|
||||||
private val data: Int,
|
|
||||||
) {
|
) {
|
||||||
override fun hashCode(): Int = this.data.hashCode()
|
override fun hashCode(): Int = this.data.hashCode()
|
||||||
override fun equals(other: Any?): Boolean = other is Score && this.data == other.data
|
override fun equals(other: Any?): Boolean = other is Score && this.data == other.data
|
||||||
|
|
@ -1093,7 +1138,6 @@ enum class TvType(value: Int?) {
|
||||||
|
|
||||||
Audio(16),
|
Audio(16),
|
||||||
Podcast(17),
|
Podcast(17),
|
||||||
@Prerelease
|
|
||||||
Video(18),
|
Video(18),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1199,9 +1243,10 @@ suspend fun newSubtitleFile(
|
||||||
* @see newAudioFile
|
* @see newAudioFile
|
||||||
* */
|
* */
|
||||||
@ConsistentCopyVisibility
|
@ConsistentCopyVisibility
|
||||||
|
@Serializable
|
||||||
data class AudioFile internal constructor(
|
data class AudioFile internal constructor(
|
||||||
var url: String,
|
@JsonProperty("url") @SerialName("url") var url: String,
|
||||||
var headers: Map<String, String>? = null
|
@JsonProperty("headers") @SerialName("headers") var headers: Map<String, String>? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
/** Creates an AudioFile with optional initializer for setting additional properties.
|
/** Creates an AudioFile with optional initializer for setting additional properties.
|
||||||
|
|
@ -1824,7 +1869,7 @@ interface LoadResponse {
|
||||||
|
|
||||||
/** Read the id string to get all other ids */
|
/** Read the id string to get all other ids */
|
||||||
fun readIdFromString(idString: String?): Map<SimklSyncServices, String> {
|
fun readIdFromString(idString: String?): Map<SimklSyncServices, String> {
|
||||||
return tryParseJson(idString) ?: return emptyMap()
|
return tryParseJson<Map<SimklSyncServices, String>>(idString) ?: return emptyMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun LoadResponse.isMovie(): Boolean {
|
fun LoadResponse.isMovie(): Boolean {
|
||||||
|
|
@ -2178,10 +2223,11 @@ data class NextAiring(
|
||||||
* @param name To be shown next to the season like "Season $displaySeason $name" but if displaySeason is null then "$name"
|
* @param name To be shown next to the season like "Season $displaySeason $name" but if displaySeason is null then "$name"
|
||||||
* @param displaySeason What to be displayed next to the season name, if null then the name is the only thing shown.
|
* @param displaySeason What to be displayed next to the season name, if null then the name is the only thing shown.
|
||||||
* */
|
* */
|
||||||
|
@Serializable
|
||||||
data class SeasonData(
|
data class SeasonData(
|
||||||
val season: Int,
|
@JsonProperty("season") @SerialName("season") val season: Int,
|
||||||
val name: String? = null,
|
@JsonProperty("name") @SerialName("name") val name: String? = null,
|
||||||
val displaySeason: Int? = null, // will use season if null
|
@JsonProperty("displaySeason") @SerialName("displaySeason") val displaySeason: Int? = null, // will use season if null
|
||||||
)
|
)
|
||||||
|
|
||||||
/** Abstract interface of EpisodeResponse */
|
/** Abstract interface of EpisodeResponse */
|
||||||
|
|
@ -2530,13 +2576,21 @@ constructor(
|
||||||
|
|
||||||
@OptIn(FormatStringsInDatetimeFormats::class)
|
@OptIn(FormatStringsInDatetimeFormats::class)
|
||||||
fun Episode.addDate(date: String?, format: String = "yyyy-MM-dd") {
|
fun Episode.addDate(date: String?, format: String = "yyyy-MM-dd") {
|
||||||
if (date == null) return
|
if (date.isNullOrBlank()) return
|
||||||
this.date = runCatching {
|
this.date = runCatching {
|
||||||
// First try standard ISO 8601 (e.g. "2026-01-01T12:30:00.000Z", "2026-05-17T14:35+02:00")
|
// First try standard ISO 8601 (e.g. "2026-01-01T12:30:00.000Z", "2026-05-17T14:35+02:00")
|
||||||
runCatching { Instant.parse(date).toEpochMilliseconds() }
|
runCatching { Instant.parse(date).toEpochMilliseconds() }
|
||||||
.getOrElse {
|
.getOrElse {
|
||||||
val fmt = DateTimeComponents.Format { byUnicodePattern(format) }
|
val fmt = DateTimeComponents.Format { byUnicodePattern(format) }
|
||||||
val components = DateTimeComponents.parse(date, fmt)
|
|
||||||
|
// Try parsing the full date first then only parse the beginning of the string
|
||||||
|
// May lose time, but better than failing.
|
||||||
|
val components = runCatching {
|
||||||
|
DateTimeComponents.parse(date, fmt)
|
||||||
|
}.recoverCatching {
|
||||||
|
DateTimeComponents.parse(date.trimStart().take(format.length), fmt)
|
||||||
|
}.getOrThrow()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try multiple conversions in order of precision for non-ISO-8601 formats,
|
* Try multiple conversions in order of precision for non-ISO-8601 formats,
|
||||||
* since the date string may or may not include time and/or timezone offset:
|
* since the date string may or may not include time and/or timezone offset:
|
||||||
|
|
@ -2551,21 +2605,18 @@ fun Episode.addDate(date: String?, format: String = "yyyy-MM-dd") {
|
||||||
}.onFailure { logError(it) }.getOrNull()
|
}.onFailure { logError(it) }.getOrNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
fun Episode.addDate(date: LocalDate?) {
|
fun Episode.addDate(date: LocalDate?) {
|
||||||
this.date = date?.atStartOfDayIn(TimeZone.currentSystemDefault())?.toEpochMilliseconds()
|
this.date = date?.atStartOfDayIn(TimeZone.currentSystemDefault())?.toEpochMilliseconds()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
fun Episode.addDate(date: Instant?) {
|
fun Episode.addDate(date: Instant?) {
|
||||||
this.date = date?.toEpochMilliseconds()
|
this.date = date?.toEpochMilliseconds()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecate after next stable
|
@Deprecated(
|
||||||
/* @Deprecated(
|
|
||||||
message = "Use addDate with LocalDate, Instant, or String instead.",
|
message = "Use addDate with LocalDate, Instant, or String instead.",
|
||||||
level = DeprecationLevel.WARNING,
|
level = DeprecationLevel.WARNING,
|
||||||
) */
|
)
|
||||||
fun Episode.addDate(date: java.util.Date?) {
|
fun Episode.addDate(date: java.util.Date?) {
|
||||||
this.date = date?.time
|
this.date = date?.time
|
||||||
}
|
}
|
||||||
|
|
@ -2703,7 +2754,6 @@ fun fetchUrls(text: String?): List<String> {
|
||||||
return linkRegex.findAll(text).map { it.value.trim().removeSurrounding("\"") }.toList()
|
return linkRegex.findAll(text).map { it.value.trim().removeSurrounding("\"") }.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
fun isUpcoming(dateString: String?): Boolean {
|
fun isUpcoming(dateString: String?): Boolean {
|
||||||
return runCatching {
|
return runCatching {
|
||||||
val fmt = DateTimeComponents.Format {
|
val fmt = DateTimeComponents.Format {
|
||||||
|
|
@ -2739,32 +2789,38 @@ data class Tracker(
|
||||||
val cover: String? = null,
|
val cover: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class AniSearch(
|
data class AniSearch(
|
||||||
@JsonProperty("data") var data: Data? = Data()
|
@JsonProperty("data") @SerialName("data") var data: Data? = Data(),
|
||||||
) {
|
) {
|
||||||
|
@Serializable
|
||||||
data class Data(
|
data class Data(
|
||||||
@JsonProperty("Page") var page: Page? = Page()
|
@JsonProperty("Page") @SerialName("Page") var page: Page? = Page(),
|
||||||
) {
|
) {
|
||||||
|
@Serializable
|
||||||
data class Page(
|
data class Page(
|
||||||
@JsonProperty("media") var media: ArrayList<Media> = arrayListOf()
|
@JsonProperty("media") @SerialName("media") var media: ArrayList<Media> = arrayListOf(),
|
||||||
) {
|
) {
|
||||||
|
@Serializable
|
||||||
data class Media(
|
data class Media(
|
||||||
@JsonProperty("title") var title: Title? = null,
|
@JsonProperty("title") @SerialName("title") var title: Title? = null,
|
||||||
@JsonProperty("id") var id: Int? = null,
|
@JsonProperty("id") @SerialName("id") var id: Int? = null,
|
||||||
@JsonProperty("idMal") var idMal: Int? = null,
|
@JsonProperty("idMal") @SerialName("idMal") var idMal: Int? = null,
|
||||||
@JsonProperty("seasonYear") var seasonYear: Int? = null,
|
@JsonProperty("seasonYear") @SerialName("seasonYear") var seasonYear: Int? = null,
|
||||||
@JsonProperty("format") var format: String? = null,
|
@JsonProperty("format") @SerialName("format") var format: String? = null,
|
||||||
@JsonProperty("coverImage") var coverImage: CoverImage? = null,
|
@JsonProperty("coverImage") @SerialName("coverImage") var coverImage: CoverImage? = null,
|
||||||
@JsonProperty("bannerImage") var bannerImage: String? = null,
|
@JsonProperty("bannerImage") @SerialName("bannerImage") var bannerImage: String? = null,
|
||||||
) {
|
) {
|
||||||
|
@Serializable
|
||||||
data class CoverImage(
|
data class CoverImage(
|
||||||
@JsonProperty("extraLarge") var extraLarge: String? = null,
|
@JsonProperty("extraLarge") @SerialName("extraLarge") var extraLarge: String? = null,
|
||||||
@JsonProperty("large") var large: String? = null,
|
@JsonProperty("large") @SerialName("large") var large: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Title(
|
data class Title(
|
||||||
@JsonProperty("romaji") var romaji: String? = null,
|
@JsonProperty("romaji") @SerialName("romaji") var romaji: String? = null,
|
||||||
@JsonProperty("english") var english: String? = null,
|
@JsonProperty("english") @SerialName("english") var english: String? = null,
|
||||||
) {
|
) {
|
||||||
fun isMatchingTitles(title: String?): Boolean {
|
fun isMatchingTitles(title: String?): Boolean {
|
||||||
if (title == null) return false
|
if (title == null) return false
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ var app = Requests(responseParser = jsonResponseParser).apply {
|
||||||
|
|
||||||
/** Same as the default app networking helper, but this instance ignores SSL certificates.
|
/** Same as the default app networking helper, but this instance ignores SSL certificates.
|
||||||
* This should NEVER be used for sensitive networking operations such as logins. Only use this when required. */
|
* This should NEVER be used for sensitive networking operations such as logins. Only use this when required. */
|
||||||
@Prerelease
|
|
||||||
@UnsafeSSL
|
@UnsafeSSL
|
||||||
var insecureApp = Requests(responseParser = jsonResponseParser).apply {
|
var insecureApp = Requests(responseParser = jsonResponseParser).apply {
|
||||||
defaultHeaders = mapOf("user-agent" to USER_AGENT)
|
defaultHeaders = mapOf("user-agent" to USER_AGENT)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Acefile : ExtractorApi() {
|
open class Acefile : ExtractorApi() {
|
||||||
override val name = "Acefile"
|
override val name = "Acefile"
|
||||||
|
|
@ -13,7 +16,7 @@ open class Acefile : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val id = "/(?:d|download|player|f|file)/(\\w+)".toRegex().find(url)?.groupValues?.get(1)
|
val id = "/(?:d|download|player|f|file)/(\\w+)".toRegex().find(url)?.groupValues?.get(1)
|
||||||
val script = getAndUnpack(app.get("$mainUrl/player/${id ?: return}").text)
|
val script = getAndUnpack(app.get("$mainUrl/player/${id ?: return}").text)
|
||||||
|
|
@ -27,14 +30,14 @@ open class Acefile : ExtractorApi() {
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
this.name,
|
this.name,
|
||||||
this.name,
|
this.name,
|
||||||
video ?: return
|
video ?: return,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Source(
|
data class Source(
|
||||||
val data: String? = null,
|
@JsonProperty("data") @SerialName("data") val data: String? = null,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Blogger : ExtractorApi() {
|
open class Blogger : ExtractorApi() {
|
||||||
override val name = "Blogger"
|
override val name = "Blogger"
|
||||||
|
|
@ -22,10 +24,10 @@ open class Blogger : ExtractorApi() {
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
name,
|
name,
|
||||||
name,
|
name,
|
||||||
it.play_url,
|
it.playUrl,
|
||||||
) {
|
) {
|
||||||
this.referer = "https://www.youtube.com/"
|
this.referer = "https://www.youtube.com/"
|
||||||
this.quality = when (it.format_id) {
|
this.quality = when (it.formatId) {
|
||||||
18 -> 360
|
18 -> 360
|
||||||
22 -> 720
|
22 -> 720
|
||||||
else -> Qualities.Unknown.value
|
else -> Qualities.Unknown.value
|
||||||
|
|
@ -36,11 +38,13 @@ open class Blogger : ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sources
|
return sources
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
private data class ResponseSource(
|
private data class ResponseSource(
|
||||||
@JsonProperty("play_url") val play_url: String,
|
@JsonProperty("play_url") @SerialName("play_url") val playUrl: String,
|
||||||
@JsonProperty("format_id") val format_id: Int
|
@JsonProperty("format_id") @SerialName("format_id") val formatId: Int,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,30 +13,32 @@ import dev.whyoleg.cryptography.DelicateCryptographyApi
|
||||||
import dev.whyoleg.cryptography.algorithms.AES
|
import dev.whyoleg.cryptography.algorithms.AES
|
||||||
import io.ktor.http.Url
|
import io.ktor.http.Url
|
||||||
import io.ktor.http.decodeURLPart
|
import io.ktor.http.decodeURLPart
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
class Bysezejataos : ByseSX() {
|
class Bysezejataos : ByseSX() {
|
||||||
override var name = "Bysezejataos"
|
override val name = "Bysezejataos"
|
||||||
override var mainUrl = "https://bysezejataos.com"
|
override val mainUrl = "https://bysezejataos.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
class ByseBuho : ByseSX() {
|
class ByseBuho : ByseSX() {
|
||||||
override var name = "ByseBuho"
|
override val name = "ByseBuho"
|
||||||
override var mainUrl = "https://bysebuho.com"
|
override val mainUrl = "https://bysebuho.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
class ByseVepoin : ByseSX() {
|
class ByseVepoin : ByseSX() {
|
||||||
override var name = "ByseVepoin"
|
override val name = "ByseVepoin"
|
||||||
override var mainUrl = "https://bysevepoin.com"
|
override val mainUrl = "https://bysevepoin.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
class ByseQekaho : ByseSX() {
|
class ByseQekaho : ByseSX() {
|
||||||
override var name = "ByseQekaho"
|
override val name = "ByseQekaho"
|
||||||
override var mainUrl = "https://byseqekaho.com"
|
override val mainUrl = "https://byseqekaho.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
open class ByseSX : ExtractorApi() {
|
open class ByseSX : ExtractorApi() {
|
||||||
override var name = "Byse"
|
override val name = "Byse"
|
||||||
override var mainUrl = "https://byse.sx"
|
override val mainUrl = "https://byse.sx"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
private val aesGcm = CryptographyProvider.Default.get(AES.GCM)
|
private val aesGcm = CryptographyProvider.Default.get(AES.GCM)
|
||||||
|
|
@ -86,15 +88,15 @@ open class ByseSX : ExtractorApi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(DelicateCryptographyApi::class)
|
@OptIn(DelicateCryptographyApi::class)
|
||||||
private fun decryptPlayback(playback: Playback): String? {
|
private suspend fun decryptPlayback(playback: Playback): String? {
|
||||||
val keyBytes = buildAesKey(playback)
|
val keyBytes = buildAesKey(playback)
|
||||||
val ivBytes = b64UrlDecode(playback.iv)
|
val ivBytes = b64UrlDecode(playback.iv)
|
||||||
val cipherBytes = b64UrlDecode(playback.payload)
|
val cipherBytes = b64UrlDecode(playback.payload)
|
||||||
|
|
||||||
val aesKey = aesGcm.keyDecoder().decodeFromByteArrayBlocking(AES.Key.Format.RAW, keyBytes)
|
val aesKey = aesGcm.keyDecoder().decodeFromByteArray(AES.Key.Format.RAW, keyBytes)
|
||||||
// 128-bit GCM tag (default)
|
// 128-bit GCM tag (default)
|
||||||
val cipher = aesKey.cipher()
|
val cipher = aesKey.cipher()
|
||||||
val plainBytes = cipher.decryptWithIvBlocking(ivBytes, cipherBytes)
|
val plainBytes = cipher.decryptWithIv(ivBytes, cipherBytes)
|
||||||
|
|
||||||
var jsonStr = plainBytes.decodeToString()
|
var jsonStr = plainBytes.decodeToString()
|
||||||
if (jsonStr.startsWith("\uFEFF")) jsonStr = jsonStr.substring(1)
|
if (jsonStr.startsWith("\uFEFF")) jsonStr = jsonStr.substring(1)
|
||||||
|
|
@ -112,7 +114,7 @@ open class ByseSX : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val refererUrl = getBaseUrl(url)
|
val refererUrl = getBaseUrl(url)
|
||||||
val playbackRoot = getPlayback(url) ?: return
|
val playbackRoot = getPlayback(url) ?: return
|
||||||
|
|
@ -123,64 +125,58 @@ open class ByseSX : ExtractorApi() {
|
||||||
name,
|
name,
|
||||||
streamUrl,
|
streamUrl,
|
||||||
mainUrl,
|
mainUrl,
|
||||||
headers = headers
|
headers = headers,
|
||||||
).forEach(callback)
|
).forEach(callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class DetailsRoot(
|
data class DetailsRoot(
|
||||||
val id: Long,
|
@JsonProperty("id") @SerialName("id") val id: Long,
|
||||||
val code: String,
|
@JsonProperty("code") @SerialName("code") val code: String,
|
||||||
val title: String,
|
@JsonProperty("title") @SerialName("title") val title: String,
|
||||||
@JsonProperty("poster_url")
|
@JsonProperty("poster_url") @SerialName("poster_url") val posterUrl: String,
|
||||||
val posterUrl: String,
|
@JsonProperty("description") @SerialName("description") val description: String,
|
||||||
val description: String,
|
@JsonProperty("created_at") @SerialName("created_at") val createdAt: String,
|
||||||
@JsonProperty("created_at")
|
@JsonProperty("owner_private") @SerialName("owner_private") val ownerPrivate: Boolean,
|
||||||
val createdAt: String,
|
@JsonProperty("embed_frame_url") @SerialName("embed_frame_url") val embedFrameUrl: String,
|
||||||
@JsonProperty("owner_private")
|
|
||||||
val ownerPrivate: Boolean,
|
|
||||||
@JsonProperty("embed_frame_url")
|
|
||||||
val embedFrameUrl: String,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class PlaybackRoot(
|
data class PlaybackRoot(
|
||||||
val playback: Playback,
|
@JsonProperty("playback") @SerialName("playback") val playback: Playback,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Playback(
|
data class Playback(
|
||||||
val algorithm: String,
|
@JsonProperty("algorithm") @SerialName("algorithm") val algorithm: String,
|
||||||
val iv: String,
|
@JsonProperty("iv") @SerialName("iv") val iv: String,
|
||||||
val payload: String,
|
@JsonProperty("payload") @SerialName("payload") val payload: String,
|
||||||
@JsonProperty("key_parts")
|
@JsonProperty("key_parts") @SerialName("key_parts") val keyParts: List<String>,
|
||||||
val keyParts: List<String>,
|
@JsonProperty("expires_at") @SerialName("expires_at") val expiresAt: String,
|
||||||
@JsonProperty("expires_at")
|
@JsonProperty("decrypt_keys") @SerialName("decrypt_keys") val decryptKeys: DecryptKeys,
|
||||||
val expiresAt: String,
|
@JsonProperty("iv2") @SerialName("iv2") val iv2: String,
|
||||||
@JsonProperty("decrypt_keys")
|
@JsonProperty("payload2") @SerialName("payload2") val payload2: String,
|
||||||
val decryptKeys: DecryptKeys,
|
|
||||||
val iv2: String,
|
|
||||||
val payload2: String,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class DecryptKeys(
|
data class DecryptKeys(
|
||||||
@JsonProperty("edge_1")
|
@JsonProperty("edge_1") @SerialName("edge_1") val edge1: String,
|
||||||
val edge1: String,
|
@JsonProperty("edge_2") @SerialName("edge_2") val edge2: String,
|
||||||
@JsonProperty("edge_2")
|
@JsonProperty("legacy_fallback") @SerialName("legacy_fallback") val legacyFallback: String,
|
||||||
val edge2: String,
|
|
||||||
@JsonProperty("legacy_fallback")
|
|
||||||
val legacyFallback: String,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class PlaybackDecrypt(
|
data class PlaybackDecrypt(
|
||||||
val sources: List<PlaybackDecryptSource>,
|
@JsonProperty("sources") @SerialName("sources") val sources: List<PlaybackDecryptSource>,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class PlaybackDecryptSource(
|
data class PlaybackDecryptSource(
|
||||||
val quality: String,
|
@JsonProperty("quality") @SerialName("quality") val quality: String,
|
||||||
val label: String,
|
@JsonProperty("label") @SerialName("label") val label: String,
|
||||||
@JsonProperty("mime_type")
|
@JsonProperty("mime_type") @SerialName("mime_type") val mimeType: String,
|
||||||
val mimeType: String,
|
@JsonProperty("url") @SerialName("url") val url: String,
|
||||||
val url: String,
|
@JsonProperty("bitrate_kbps") @SerialName("bitrate_kbps") val bitrateKbps: Long,
|
||||||
@JsonProperty("bitrate_kbps")
|
@JsonProperty("height") @SerialName("height") val height: Int?,
|
||||||
val bitrateKbps: Long,
|
|
||||||
val height: Any?,
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.USER_AGENT
|
import com.lagradost.cloudstream3.USER_AGENT
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
|
|
@ -8,6 +9,8 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.cloudstream3.utils.StringUtils.decodeUrl
|
import com.lagradost.cloudstream3.utils.StringUtils.decodeUrl
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Cda : ExtractorApi() {
|
open class Cda : ExtractorApi() {
|
||||||
override var mainUrl = "https://ebd.cda.pl"
|
override var mainUrl = "https://ebd.cda.pl"
|
||||||
|
|
@ -22,7 +25,7 @@ open class Cda : ExtractorApi() {
|
||||||
"https://ebd.cda.pl/647x500/$mediaId", headers = mapOf(
|
"https://ebd.cda.pl/647x500/$mediaId", headers = mapOf(
|
||||||
"Referer" to "https://ebd.cda.pl/647x500/$mediaId",
|
"Referer" to "https://ebd.cda.pl/647x500/$mediaId",
|
||||||
"User-Agent" to USER_AGENT,
|
"User-Agent" to USER_AGENT,
|
||||||
"Cookie" to "cda.player=html5"
|
"Cookie" to "cda.player=html5",
|
||||||
)
|
)
|
||||||
).document
|
).document
|
||||||
val dataRaw = doc.selectFirst("[player_data]")?.attr("player_data") ?: return null
|
val dataRaw = doc.selectFirst("[player_data]")?.attr("player_data") ?: return null
|
||||||
|
|
@ -86,15 +89,17 @@ open class Cda : ExtractorApi() {
|
||||||
else -> a
|
else -> a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class VideoPlayerData(
|
data class VideoPlayerData(
|
||||||
val file: String,
|
@JsonProperty("file") @SerialName("file") val file: String,
|
||||||
val qualities: Map<String, String> = mapOf(),
|
@JsonProperty("qualities") @SerialName("qualities") val qualities: Map<String, String> = mapOf(),
|
||||||
val quality: String?,
|
@JsonProperty("quality") @SerialName("quality") val quality: String?,
|
||||||
val ts: Int?,
|
@JsonProperty("ts") @SerialName("ts") val ts: Int?,
|
||||||
val hash2: String?
|
@JsonProperty("hash2") @SerialName("hash2") val hash2: String?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class PlayerData(
|
data class PlayerData(
|
||||||
val video: VideoPlayerData
|
@JsonProperty("video") @SerialName("video") val video: VideoPlayerData,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,18 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
import com.google.gson.Gson
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.newSubtitleFile
|
import com.lagradost.cloudstream3.newSubtitleFile
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
||||||
import io.ktor.http.Url
|
import io.ktor.http.Url
|
||||||
import io.ktor.http.decodeURLPart
|
import io.ktor.http.decodeURLPart
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
class Geodailymotion : Dailymotion() {
|
class Geodailymotion : Dailymotion() {
|
||||||
override val name = "GeoDailymotion"
|
override val name = "GeoDailymotion"
|
||||||
|
|
@ -28,25 +31,25 @@ open class Dailymotion : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val embedUrl = getEmbedUrl(url) ?: return
|
val embedUrl = getEmbedUrl(url) ?: return
|
||||||
val id = getVideoId(embedUrl) ?: return
|
val id = getVideoId(embedUrl) ?: return
|
||||||
val metaDataUrl = "$baseUrl/player/metadata/video/$id"
|
val metadataUrl = "$baseUrl/player/metadata/video/$id"
|
||||||
|
|
||||||
val response = app.get(metaDataUrl, referer = embedUrl).text
|
|
||||||
val gson = Gson()
|
|
||||||
val meta = gson.fromJson(response, MetaData::class.java)
|
|
||||||
|
|
||||||
|
val response = app.get(metadataUrl, referer = embedUrl).text
|
||||||
|
val meta = parseJson<Metadata>(response)
|
||||||
meta.qualities?.get("auto")?.forEach { quality ->
|
meta.qualities?.get("auto")?.forEach { quality ->
|
||||||
val videoUrl = quality.url
|
val videoUrl = quality.url
|
||||||
if (!videoUrl.isNullOrEmpty() && videoUrl.contains(".m3u8")) {
|
if (!videoUrl.isNullOrEmpty() && videoUrl.contains(".m3u8")) {
|
||||||
callback.invoke(newExtractorLink(
|
callback.invoke(
|
||||||
name,
|
newExtractorLink(
|
||||||
name,
|
name,
|
||||||
videoUrl,
|
name,
|
||||||
ExtractorLinkType.M3U8
|
videoUrl,
|
||||||
))
|
ExtractorLinkType.M3U8,
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +58,7 @@ open class Dailymotion : ExtractorApi() {
|
||||||
subtitleCallback(
|
subtitleCallback(
|
||||||
newSubtitleFile(
|
newSubtitleFile(
|
||||||
subData.label,
|
subData.label,
|
||||||
subUrl
|
subUrl,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -68,6 +71,7 @@ open class Dailymotion : ExtractorApi() {
|
||||||
val videoId = url.substringAfter("video=")
|
val videoId = url.substringAfter("video=")
|
||||||
return "$baseUrl/embed/video/$videoId"
|
return "$baseUrl/embed/video/$videoId"
|
||||||
}
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,23 +81,27 @@ open class Dailymotion : ExtractorApi() {
|
||||||
return if (id.matches(videoIdRegex)) id else null
|
return if (id.matches(videoIdRegex)) id else null
|
||||||
}
|
}
|
||||||
|
|
||||||
data class MetaData(
|
@Serializable
|
||||||
val qualities: Map<String, List<Quality>>?,
|
data class Metadata(
|
||||||
val subtitles: SubtitlesWrapper?
|
@JsonProperty("qualities") @SerialName("qualities") val qualities: Map<String, List<Quality>>?,
|
||||||
|
@JsonProperty("subtitles") @SerialName("subtitles") val subtitles: SubtitlesWrapper?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Quality(
|
data class Quality(
|
||||||
val type: String?,
|
@JsonProperty("type") @SerialName("type") val type: String?,
|
||||||
val url: String?
|
@JsonProperty("url") @SerialName("url") val url: String?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class SubtitlesWrapper(
|
data class SubtitlesWrapper(
|
||||||
val enable: Boolean,
|
@JsonProperty("enable") @SerialName("enable") val enable: Boolean,
|
||||||
val data: Map<String, SubtitleData>?
|
@JsonProperty("data") @SerialName("data") val data: Map<String, SubtitleData>?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class SubtitleData(
|
data class SubtitleData(
|
||||||
val label: String,
|
@JsonProperty("label") @SerialName("label") val label: String,
|
||||||
val urls: List<String>
|
@JsonProperty("urls") @SerialName("urls") val urls: List<String>,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,6 @@ class MyVidPlay : DoodLaExtractor() {
|
||||||
override var mainUrl = "https://myvidplay.com"
|
override var mainUrl = "https://myvidplay.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
class Playmogo : DoodLaExtractor() {
|
class Playmogo : DoodLaExtractor() {
|
||||||
override var mainUrl = "https://playmogo.com"
|
override var mainUrl = "https://playmogo.com"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,35 +8,33 @@ import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
|
||||||
open class EmturbovidExtractor : ExtractorApi() {
|
open class EmturbovidExtractor : ExtractorApi() {
|
||||||
override var name = "Emturbovid"
|
override val name = "Emturbovid"
|
||||||
override var mainUrl = "https://emturbovid.com"
|
override val mainUrl = "https://emturbovid.com"
|
||||||
override val requiresReferer = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||||
val response = app.get(
|
val response = app.get(url, referer = referer ?: "$mainUrl/")
|
||||||
url, referer = referer ?: "$mainUrl/"
|
val playerScript = response.document
|
||||||
)
|
.select("script")
|
||||||
val playerScript =
|
.first { it.data().contains("var urlPlay") }
|
||||||
response.document.selectXpath("//script[contains(text(),'var urlPlay')]")
|
.html()
|
||||||
.html()
|
|
||||||
|
|
||||||
val sources = mutableListOf<ExtractorLink>()
|
val sources = mutableListOf<ExtractorLink>()
|
||||||
if (playerScript.isNotBlank()) {
|
if (playerScript.isNotBlank()) {
|
||||||
val m3u8Url =
|
val m3u8Url = playerScript.substringAfter("var urlPlay = '").substringBefore("'")
|
||||||
playerScript.substringAfter("var urlPlay = '").substringBefore("'")
|
|
||||||
|
|
||||||
sources.add(
|
sources.add(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = name,
|
source = name,
|
||||||
name = name,
|
name = name,
|
||||||
url = m3u8Url,
|
url = m3u8Url,
|
||||||
type = ExtractorLinkType.M3U8
|
type = ExtractorLinkType.M3U8,
|
||||||
) {
|
) {
|
||||||
this.referer = "$mainUrl/"
|
this.referer = "$mainUrl/"
|
||||||
this.quality = Qualities.Unknown.value
|
this.quality = Qualities.Unknown.value
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sources
|
return sources
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.Prerelease
|
import com.lagradost.cloudstream3.Prerelease
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
|
|
@ -9,33 +10,30 @@ import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
class Firestream : ExtractorApi() {
|
class Firestream : ExtractorApi() {
|
||||||
override val name: String = "Firestream"
|
override val name = "Firestream"
|
||||||
override val mainUrl: String = "https://firestream.to"
|
override val mainUrl = "https://firestream.to"
|
||||||
override val requiresReferer: Boolean = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val id = url.removeSuffix("/").substringAfterLast("/")
|
val id = url.removeSuffix("/").substringAfterLast("/")
|
||||||
val url = getExtractorUrl(id)
|
val url = getExtractorUrl(id)
|
||||||
|
|
||||||
val doc = app.get(url).document
|
val doc = app.get(url).document
|
||||||
val token = doc.selectFirst("script[id=token-blob]")!!.data()
|
val token = doc.selectFirst("script[id=token-blob]")!!.data()
|
||||||
|
val videoResponse = app.post("$mainUrl/api/videos/$id/resolve", json = mapOf("blob" to token))
|
||||||
val videoResponse =
|
.parsed<VideoResponse>()
|
||||||
app.post("$mainUrl/api/videos/$id/resolve", json = mapOf("blob" to token))
|
|
||||||
.parsed<VideoResponse>()
|
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = name,
|
source = name,
|
||||||
name = name,
|
name = name,
|
||||||
url = videoResponse.signedVideoUrl
|
url = videoResponse.signedVideoUrl,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +44,6 @@ class Firestream : ExtractorApi() {
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
private data class VideoResponse(
|
private data class VideoResponse(
|
||||||
@SerialName("signedVideoUrl")
|
@JsonProperty("signedVideoUrl") @SerialName("signedVideoUrl") val signedVideoUrl: String,
|
||||||
val signedVideoUrl: String,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,17 @@ import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
open class Flyfile : ExtractorApi() {
|
open class Flyfile : ExtractorApi() {
|
||||||
override val name: String = "FlyFile"
|
override val name = "FlyFile"
|
||||||
override val mainUrl: String = "https://flyfile.app"
|
override val mainUrl = "https://flyfile.app"
|
||||||
|
override val requiresReferer = false
|
||||||
open val apiUrl: String = "https://api.flyfile.app"
|
open val apiUrl: String = "https://api.flyfile.app"
|
||||||
override val requiresReferer: Boolean = false
|
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val videoId = url.substringAfterLast("/")
|
val videoId = url.substringAfterLast("/")
|
||||||
val videoInfo = app.get("$apiUrl/api/streaming/assign/$videoId")
|
val videoInfo = app.get("$apiUrl/api/streaming/assign/$videoId")
|
||||||
|
|
@ -33,16 +32,14 @@ open class Flyfile : ExtractorApi() {
|
||||||
source = name,
|
source = name,
|
||||||
name = name,
|
name = name,
|
||||||
url = streamUrl,
|
url = streamUrl,
|
||||||
type = ExtractorLinkType.M3U8
|
type = ExtractorLinkType.M3U8,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
private data class StreamInfo(
|
private data class StreamInfo(
|
||||||
@SerialName("url")
|
@SerialName("url") val url: String,
|
||||||
val url: String,
|
@SerialName("token") val token: String,
|
||||||
@SerialName("token")
|
|
||||||
val token: String
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,34 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
import com.google.gson.JsonParser
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.api.Log
|
import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.base64Decode
|
import com.lagradost.cloudstream3.base64Decode
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import io.ktor.http.Url
|
import io.ktor.http.Url
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
class Techinmind: GDMirrorbot() {
|
class Techinmind : GDMirrorbot() {
|
||||||
override var name = "Techinmind Cloud AIO"
|
override val name = "Techinmind Cloud AIO"
|
||||||
override var mainUrl = "https://stream.techinmind.space"
|
override val mainUrl = "https://stream.techinmind.space"
|
||||||
override var requiresReferer = true
|
override val requiresReferer = true
|
||||||
}
|
}
|
||||||
|
|
||||||
open class GDMirrorbot : ExtractorApi() {
|
open class GDMirrorbot : ExtractorApi() {
|
||||||
override var name = "GDMirrorbot"
|
override val name = "GDMirrorbot"
|
||||||
override var mainUrl = "https://gdmirrorbot.nl"
|
override val mainUrl = "https://gdmirrorbot.nl"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val (sid, host) = if (!url.contains("key=")) {
|
val (sid, host) = if (!url.contains("key=")) {
|
||||||
Pair(url.substringAfterLast("embed/"), getBaseUrl(app.get(url).url))
|
Pair(url.substringAfterLast("embed/"), getBaseUrl(app.get(url).url))
|
||||||
|
|
@ -36,63 +39,58 @@ open class GDMirrorbot : ExtractorApi() {
|
||||||
val idType = Regex("""idType\s*=\s*"([^"]+)"""").find(pageText)?.groupValues?.get(1) ?: "imdbid"
|
val idType = Regex("""idType\s*=\s*"([^"]+)"""").find(pageText)?.groupValues?.get(1) ?: "imdbid"
|
||||||
val baseUrl = Regex("""let\s+baseUrl\s*=\s*"([^"]+)"""").find(pageText)?.groupValues?.get(1)
|
val baseUrl = Regex("""let\s+baseUrl\s*=\s*"([^"]+)"""").find(pageText)?.groupValues?.get(1)
|
||||||
val hostUrl = baseUrl?.let { getBaseUrl(it) }
|
val hostUrl = baseUrl?.let { getBaseUrl(it) }
|
||||||
|
|
||||||
if (finalId != null && myKey != null) {
|
if (finalId != null && myKey != null) {
|
||||||
val apiUrl = if (url.contains("/tv/")) {
|
val apiUrl = if (url.contains("/tv/")) {
|
||||||
val season = Regex("""/tv/\d+/(\d+)/""").find(url)?.groupValues?.get(1) ?: "1"
|
val season = Regex("""/tv/\d+/(\d+)/""").find(url)?.groupValues?.get(1) ?: "1"
|
||||||
val episode = Regex("""/tv/\d+/\d+/(\d+)""").find(url)?.groupValues?.get(1) ?: "1"
|
val episode = Regex("""/tv/\d+/\d+/(\d+)""").find(url)?.groupValues?.get(1) ?: "1"
|
||||||
"$mainUrl/myseriesapi?tmdbid=$finalId&season=$season&epname=$episode&key=$myKey"
|
"$mainUrl/myseriesapi?tmdbid=$finalId&season=$season&epname=$episode&key=$myKey"
|
||||||
} else {
|
} else "$mainUrl/mymovieapi?$idType=$finalId&key=$myKey"
|
||||||
"$mainUrl/mymovieapi?$idType=$finalId&key=$myKey"
|
|
||||||
}
|
|
||||||
pageText = app.get(apiUrl).text
|
pageText = app.get(apiUrl).text
|
||||||
}
|
}
|
||||||
|
|
||||||
val jsonElement = JsonParser.parseString(pageText)
|
val embedData = tryParseJson<EmbedData>(pageText)
|
||||||
if (!jsonElement.isJsonObject) return
|
|
||||||
val jsonObject = jsonElement.asJsonObject
|
|
||||||
|
|
||||||
val embedId = url.substringAfterLast("/")
|
val embedId = url.substringAfterLast("/")
|
||||||
val sidValue = jsonObject["data"]?.asJsonArray
|
val sidValue = embedData?.data?.firstOrNull()?.fileSlug
|
||||||
?.takeIf { it.size() > 0 }
|
|
||||||
?.get(0)?.asJsonObject
|
|
||||||
?.get("fileslug")?.asString
|
|
||||||
?.takeIf { it.isNotBlank() } ?: embedId
|
?.takeIf { it.isNotBlank() } ?: embedId
|
||||||
|
|
||||||
Pair(sidValue, hostUrl)
|
Pair(sidValue, hostUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
val postData = mapOf("sid" to sid)
|
val postData = mapOf("sid" to sid)
|
||||||
val responseText = app.post("$host/embedhelper.php", data = postData).text
|
val responseText = app.post("$host/embedhelper.php", data = postData).text
|
||||||
|
|
||||||
val rootElement = JsonParser.parseString(responseText)
|
val root = tryParseJson<EmbedHelper>(responseText) ?: return
|
||||||
if (!rootElement.isJsonObject) return
|
val siteUrls = root.siteUrls ?: return
|
||||||
val root = rootElement.asJsonObject
|
val siteFriendlyNames = root.siteFriendlyNames
|
||||||
|
|
||||||
val siteUrls = root["siteUrls"]?.asJsonObject ?: return
|
// mresult can arrive as a JSON object or a base64-encoded string
|
||||||
val siteFriendlyNames = root["siteFriendlyNames"]?.asJsonObject
|
val mresult: Map<String, String>? = run {
|
||||||
|
val raw = responseText
|
||||||
val decodedMresult = when {
|
.substringAfter("\"mresult\":")
|
||||||
root["mresult"]?.isJsonObject == true -> root["mresult"]!!.asJsonObject
|
.trimStart()
|
||||||
root["mresult"]?.isJsonPrimitive == true -> try {
|
when {
|
||||||
base64Decode(root["mresult"]!!.asString)
|
raw.startsWith("\"") -> {
|
||||||
.let { JsonParser.parseString(it).asJsonObject }
|
// base64-encoded string
|
||||||
} catch (e: Exception) {
|
tryParseJson<Map<String, String>>(
|
||||||
Log.e("GDMirrorbot", "Failed to decode mresult: $e")
|
try { base64Decode(raw.trim('"')) } catch (_: Exception) { return }
|
||||||
return
|
)
|
||||||
|
}
|
||||||
|
raw.startsWith("{") -> tryParseJson<Map<String, String>>(
|
||||||
|
raw.substringBefore("\n}").substringBefore(",\n\"").let { "$it" }
|
||||||
|
.let { responseText.substringAfter("\"mresult\":").trimStart() }
|
||||||
|
)
|
||||||
|
else -> null
|
||||||
}
|
}
|
||||||
else -> return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
siteUrls.keySet().intersect(decodedMresult.keySet()).forEach { key ->
|
if (mresult == null) return
|
||||||
val base = siteUrls[key]?.asString?.trimEnd('/') ?: return@forEach
|
siteUrls.keys.intersect(mresult.keys).forEach { key ->
|
||||||
val path = decodedMresult[key]?.asString?.trimStart('/') ?: return@forEach
|
val base = siteUrls[key]?.trimEnd('/') ?: return@forEach
|
||||||
|
val path = mresult[key]?.trimStart('/') ?: return@forEach
|
||||||
val fullUrl = "$base/$path"
|
val fullUrl = "$base/$path"
|
||||||
val friendlyName = siteFriendlyNames?.get(key)?.asString ?: key
|
val friendlyName = siteFriendlyNames?.get(key) ?: key
|
||||||
|
|
||||||
try {
|
try {
|
||||||
when (friendlyName) {
|
when (friendlyName) {
|
||||||
"StreamHG","EarnVids" -> VidHidePro().getUrl(fullUrl, referer, subtitleCallback, callback)
|
"StreamHG", "EarnVids" -> VidHidePro().getUrl(fullUrl, referer, subtitleCallback, callback)
|
||||||
"RpmShare", "UpnShare", "StreamP2p" -> VidStack().getUrl(fullUrl, referer, subtitleCallback, callback)
|
"RpmShare", "UpnShare", "StreamP2p" -> VidStack().getUrl(fullUrl, referer, subtitleCallback, callback)
|
||||||
else -> loadExtractor(fullUrl, referer ?: mainUrl, subtitleCallback, callback)
|
else -> loadExtractor(fullUrl, referer ?: mainUrl, subtitleCallback, callback)
|
||||||
}
|
}
|
||||||
|
|
@ -105,5 +103,20 @@ open class GDMirrorbot : ExtractorApi() {
|
||||||
private fun getBaseUrl(url: String): String {
|
private fun getBaseUrl(url: String): String {
|
||||||
return Url(url).let { "${it.protocol.name}://${it.host}" }
|
return Url(url).let { "${it.protocol.name}://${it.host}" }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
private data class EmbedData(
|
||||||
|
@JsonProperty("data") @SerialName("data") val data: List<FileSlug>? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
private data class FileSlug(
|
||||||
|
@JsonProperty("fileslug") @SerialName("fileslug") val fileSlug: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
private data class EmbedHelper(
|
||||||
|
@JsonProperty("siteUrls") @SerialName("siteUrls") val siteUrls: Map<String, String>? = null,
|
||||||
|
@JsonProperty("siteFriendlyNames") @SerialName("siteFriendlyNames") val siteFriendlyNames: Map<String, String>? = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,14 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.base64Decode
|
import com.lagradost.cloudstream3.base64Decode
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
|
||||||
open class GUpload: ExtractorApi() {
|
open class GUpload: ExtractorApi() {
|
||||||
override val name: String = "GUpload"
|
override val name: String = "GUpload"
|
||||||
|
|
@ -19,12 +22,12 @@ open class GUpload: ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val response = app.get(url, referer = referer).text
|
val response = app.get(url, referer = referer).text
|
||||||
|
|
||||||
val playerConfigString = response.substringAfter("const config = ").substringBefore(";")
|
val playerConfigString = response.substringAfter("const config = ").substringBefore(";")
|
||||||
val playerConfig = AppUtils.parseJson<VideoInfo>(playerConfigString)
|
val playerConfig = parseJson<VideoInfo>(playerConfigString)
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
|
|
@ -39,14 +42,15 @@ open class GUpload: ExtractorApi() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
private data class VideoInfo(
|
private data class VideoInfo(
|
||||||
@JsonProperty("videoUrl") val videoUrl: String,
|
@JsonProperty("videoUrl") @SerialName("videoUrl") val videoUrl: String,
|
||||||
@JsonProperty("posterUrl") val posterUrl: String? = null,
|
@JsonProperty("posterUrl") @SerialName("posterUrl") val posterUrl: String? = null,
|
||||||
@JsonProperty("videoId") val videoId: String? = null,
|
@JsonProperty("videoId") @SerialName("videoId") val videoId: String? = null,
|
||||||
@JsonProperty("primaryColor") val primaryColor: String? = null,
|
@JsonProperty("primaryColor") @SerialName("primaryColor") val primaryColor: String? = null,
|
||||||
@JsonProperty("audioTracks") val audioTracks: List<Any?> = emptyList(),
|
@JsonProperty("audioTracks") @SerialName("audioTracks") val audioTracks: List<JsonElement> = emptyList(),
|
||||||
@JsonProperty("subtitleTracks") val subtitleTracks: List<Any?> = emptyList(),
|
@JsonProperty("subtitleTracks") @SerialName("subtitleTracks") val subtitleTracks: List<JsonElement> = emptyList(),
|
||||||
@JsonProperty("vastFallbackList") val vastFallbackList: List<String> = emptyList(),
|
@JsonProperty("vastFallbackList") @SerialName("vastFallbackList") val vastFallbackList: List<String> = emptyList(),
|
||||||
@JsonProperty("videoOwnerId") val videoOwnerId: Long = 0,
|
@JsonProperty("videoOwnerId") @SerialName("videoOwnerId") val videoOwnerId: Long = 0,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,16 @@ import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.extractors.helper.AesHelper.cryptoAESHandler
|
import com.lagradost.cloudstream3.extractors.helper.AesHelper.cryptoAESHandler
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
class DatabaseGdrive2 : Gdriveplayer() {
|
class DatabaseGdrive2 : Gdriveplayer() {
|
||||||
override var mainUrl = "https://databasegdriveplayer.co"
|
override val mainUrl = "https://databasegdriveplayer.co"
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatabaseGdrive : Gdriveplayer() {
|
class DatabaseGdrive : Gdriveplayer() {
|
||||||
override var mainUrl = "https://series.databasegdriveplayer.co"
|
override val mainUrl = "https://series.databasegdriveplayer.co"
|
||||||
}
|
}
|
||||||
|
|
||||||
class Gdriveplayerapi : Gdriveplayer() {
|
class Gdriveplayerapi : Gdriveplayer() {
|
||||||
|
|
@ -73,10 +75,9 @@ open class Gdriveplayer : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val document = app.get(url).document
|
val document = app.get(url).document
|
||||||
|
|
||||||
val eval = unpackJs(document)?.replace("\\", "") ?: return
|
val eval = unpackJs(document)?.replace("\\", "") ?: return
|
||||||
val data = Regex("data='(\\S+?)'").first(eval) ?: return
|
val data = Regex("data='(\\S+?)'").first(eval) ?: return
|
||||||
val password = Regex("null,['|\"](\\w+)['|\"]").first(eval)
|
val password = Regex("null,['|\"](\\w+)['|\"]").first(eval)
|
||||||
|
|
@ -84,9 +85,9 @@ open class Gdriveplayer : ExtractorApi() {
|
||||||
?.joinToString("") {
|
?.joinToString("") {
|
||||||
it.toInt().toChar().toString()
|
it.toInt().toChar().toString()
|
||||||
}.let { Regex("var pass = \"(\\S+?)\"").first(it ?: return)?.encodeToByteArray() }
|
}.let { Regex("var pass = \"(\\S+?)\"").first(it ?: return)?.encodeToByteArray() }
|
||||||
?: throw ErrorLoadingException("can't find password")
|
?: throw ErrorLoadingException("can't find password")
|
||||||
val decryptedData = cryptoAESHandler(data, password, false, false)?.let { getAndUnpack(it) }?.replace("\\", "")
|
|
||||||
|
|
||||||
|
val decryptedData = cryptoAESHandler(data, password, false, false)?.let { getAndUnpack(it) }?.replace("\\", "")
|
||||||
val sourceData = decryptedData?.substringAfter("sources:[")?.substringBefore("],")
|
val sourceData = decryptedData?.substringAfter("sources:[")?.substringBefore("],")
|
||||||
val subData = decryptedData?.substringAfter("tracks:[")?.substringBefore("],")
|
val subData = decryptedData?.substringAfter("tracks:[")?.substringBefore("],")
|
||||||
|
|
||||||
|
|
@ -111,16 +112,17 @@ open class Gdriveplayer : ExtractorApi() {
|
||||||
subtitleCallback.invoke(
|
subtitleCallback.invoke(
|
||||||
newSubtitleFile(
|
newSubtitleFile(
|
||||||
sub.label,
|
sub.label,
|
||||||
httpsify(sub.file)
|
httpsify(sub.file),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Tracks(
|
data class Tracks(
|
||||||
@JsonProperty("file") val file: String,
|
@JsonProperty("file") @SerialName("file") val file: String,
|
||||||
@JsonProperty("kind") val kind: String,
|
@JsonProperty("kind") @SerialName("kind") val kind: String,
|
||||||
@JsonProperty("label") val label: String,
|
@JsonProperty("label") @SerialName("label") val label: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlin.math.round
|
import kotlin.math.round
|
||||||
|
|
||||||
open class Gofile : ExtractorApi() {
|
open class Gofile : ExtractorApi() {
|
||||||
|
|
@ -20,20 +22,18 @@ open class Gofile : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val id = Regex("/(?:\\?c=|d/)([\\da-zA-Z-]+)").find(url)?.groupValues?.get(1) ?: return
|
val id = Regex("/(?:\\?c=|d/)([\\da-zA-Z-]+)").find(url)?.groupValues?.get(1) ?: return
|
||||||
|
|
||||||
val token = app.post(
|
val token = app.post(
|
||||||
"$mainApi/accounts",
|
"$mainApi/accounts",
|
||||||
).parsedSafe<AccountResponse>()?.data?.token ?: return
|
).parsedSafe<AccountResponse>()?.data?.token ?: return
|
||||||
|
|
||||||
val globalRes = app.get("$mainUrl/dist/js/config.js").text
|
val globalRes = app.get("$mainUrl/dist/js/config.js").text
|
||||||
val wt = Regex("""appdata\.wt\s*=\s*[\"']([^\"']+)[\"']""").find(globalRes)?.groupValues?.get(1) ?: return
|
val wt = Regex("""appdata\.wt\s*=\s*[\"']([^\"']+)[\"']""").find(globalRes)?.groupValues?.get(1) ?: return
|
||||||
|
|
||||||
val headers = mapOf(
|
val headers = mapOf(
|
||||||
"Authorization" to "Bearer $token",
|
"Authorization" to "Bearer $token",
|
||||||
"X-Website-Token" to wt
|
"X-Website-Token" to wt,
|
||||||
)
|
)
|
||||||
|
|
||||||
val parsedResponse = app.get(
|
val parsedResponse = app.get(
|
||||||
|
|
@ -42,7 +42,6 @@ open class Gofile : ExtractorApi() {
|
||||||
).parsedSafe<GofileResponse>()
|
).parsedSafe<GofileResponse>()
|
||||||
|
|
||||||
val childrenMap = parsedResponse?.data?.children ?: return
|
val childrenMap = parsedResponse?.data?.children ?: return
|
||||||
|
|
||||||
for ((_, file) in childrenMap) {
|
for ((_, file) in childrenMap) {
|
||||||
if (file.link.isNullOrEmpty() || file.type != "file") continue
|
if (file.link.isNullOrEmpty() || file.type != "file") continue
|
||||||
val fileName = file.name ?: ""
|
val fileName = file.name ?: ""
|
||||||
|
|
@ -54,7 +53,7 @@ open class Gofile : ExtractorApi() {
|
||||||
"Gofile",
|
"Gofile",
|
||||||
"[Gofile] $fileName [$formattedSize]",
|
"[Gofile] $fileName [$formattedSize]",
|
||||||
file.link,
|
file.link,
|
||||||
ExtractorLinkType.VIDEO
|
ExtractorLinkType.VIDEO,
|
||||||
) {
|
) {
|
||||||
this.quality = getQuality(fileName)
|
this.quality = getQuality(fileName)
|
||||||
this.headers = mapOf("Cookie" to "accountToken=$token")
|
this.headers = mapOf("Cookie" to "accountToken=$token")
|
||||||
|
|
@ -84,26 +83,31 @@ open class Gofile : ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class AccountResponse(
|
data class AccountResponse(
|
||||||
@JsonProperty("data") val data: AccountData? = null
|
@JsonProperty("data") @SerialName("data") val data: AccountData? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class AccountData(
|
data class AccountData(
|
||||||
@JsonProperty("token") val token: String? = null
|
@JsonProperty("token") @SerialName("token") val token: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class GofileResponse(
|
data class GofileResponse(
|
||||||
@JsonProperty("data") val data: GofileData? = null
|
@JsonProperty("data") @SerialName("data") val data: GofileData? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class GofileData(
|
data class GofileData(
|
||||||
@JsonProperty("children") val children: Map<String, GofileFile>? = null
|
@JsonProperty("children") @SerialName("children") val children: Map<String, GofileFile>? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class GofileFile(
|
data class GofileFile(
|
||||||
@JsonProperty("type") val type: String? = null,
|
@JsonProperty("type") @SerialName("type") val type: String? = null,
|
||||||
@JsonProperty("name") val name: String? = null,
|
@JsonProperty("name") @SerialName("name") val name: String? = null,
|
||||||
@JsonProperty("link") val link: String? = null,
|
@JsonProperty("link") @SerialName("link") val link: String? = null,
|
||||||
@JsonProperty("size") val size: Long? = 0L
|
@JsonProperty("size") @SerialName("size") val size: Long? = 0L,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,39 +8,41 @@ import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.extractors.helper.AesHelper
|
import com.lagradost.cloudstream3.extractors.helper.AesHelper
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class HDMomPlayer : ExtractorApi() {
|
open class HDMomPlayer : ExtractorApi() {
|
||||||
override val name = "HDMomPlayer"
|
override val name = "HDMomPlayer"
|
||||||
override val mainUrl = "https://hdmomplayer.com"
|
override val mainUrl = "https://hdmomplayer.com"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
val m3uLink:String?
|
url: String,
|
||||||
val extRef = referer ?: ""
|
referer: String?,
|
||||||
val iSource = app.get(url, referer=extRef).text
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
) {
|
||||||
|
val m3uLink: String?
|
||||||
|
val extRef = referer ?: ""
|
||||||
|
val iSource = app.get(url, referer = extRef).text
|
||||||
val bePlayer = Regex("""bePlayer\('([^']+)',\s*'(\{[^\}]+\})'\);""").find(iSource)?.groupValues
|
val bePlayer = Regex("""bePlayer\('([^']+)',\s*'(\{[^\}]+\})'\);""").find(iSource)?.groupValues
|
||||||
if (bePlayer != null) {
|
if (bePlayer != null) {
|
||||||
val bePlayerPass = bePlayer.get(1)
|
val bePlayerPass = bePlayer.get(1)
|
||||||
val bePlayerData = bePlayer.get(2)
|
val bePlayerData = bePlayer.get(2)
|
||||||
val encrypted = AesHelper.cryptoAESHandler(bePlayerData, bePlayerPass.encodeToByteArray(), false)?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt")
|
val encrypted = AesHelper.cryptoAESHandler(bePlayerData, bePlayerPass.encodeToByteArray(), false)?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt")
|
||||||
|
|
||||||
m3uLink = Regex("""video_location\":\"([^\"]+)""").find(encrypted)?.groupValues?.get(1)
|
m3uLink = Regex("""video_location\":\"([^\"]+)""").find(encrypted)?.groupValues?.get(1)
|
||||||
} else {
|
} else {
|
||||||
m3uLink = Regex("""file:\"([^\"]+)""").find(iSource)?.groupValues?.get(1)
|
m3uLink = Regex("""file:\"([^\"]+)""").find(iSource)?.groupValues?.get(1)
|
||||||
|
|
||||||
val trackStr = Regex("""tracks:\[([^\]]+)""").find(iSource)?.groupValues?.get(1)
|
val trackStr = Regex("""tracks:\[([^\]]+)""").find(iSource)?.groupValues?.get(1)
|
||||||
if (trackStr != null) {
|
if (trackStr != null) {
|
||||||
val tracks:List<Track> = parseJson<List<Track>>("[${trackStr}]")
|
val tracks = parseJson<List<Track>>("[${trackStr}]")
|
||||||
|
|
||||||
for (track in tracks) {
|
for (track in tracks) {
|
||||||
if (track.file == null || track.label == null) continue
|
if (track.file == null || track.label == null) continue
|
||||||
if (track.label.contains("Forced")) continue
|
if (track.label.contains("Forced")) continue
|
||||||
|
|
||||||
subtitleCallback.invoke(
|
subtitleCallback.invoke(
|
||||||
newSubtitleFile(
|
newSubtitleFile(
|
||||||
lang = track.label,
|
lang = track.label,
|
||||||
url = fixUrl(mainUrl + track.file)
|
url = fixUrl(mainUrl + track.file),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -49,10 +51,10 @@ open class HDMomPlayer : ExtractorApi() {
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
url = m3uLink ?: throw ErrorLoadingException("m3u link not found"),
|
url = m3uLink ?: throw ErrorLoadingException("m3u link not found"),
|
||||||
type = ExtractorLinkType.M3U8
|
type = ExtractorLinkType.M3U8,
|
||||||
) {
|
) {
|
||||||
this.referer = url
|
this.referer = url
|
||||||
this.quality = Qualities.Unknown.value
|
this.quality = Qualities.Unknown.value
|
||||||
|
|
@ -60,11 +62,12 @@ open class HDMomPlayer : ExtractorApi() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Track(
|
data class Track(
|
||||||
@JsonProperty("file") val file: String?,
|
@JsonProperty("file") @SerialName("file") val file: String?,
|
||||||
@JsonProperty("label") val label: String?,
|
@JsonProperty("label") @SerialName("label") val label: String?,
|
||||||
@JsonProperty("kind") val kind: String?,
|
@JsonProperty("kind") @SerialName("kind") val kind: String?,
|
||||||
@JsonProperty("language") val language: String?,
|
@JsonProperty("language") @SerialName("language") val language: String?,
|
||||||
@JsonProperty("default") val default: String?
|
@JsonProperty("default") @SerialName("default") val default: String?,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,56 +2,60 @@
|
||||||
|
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.api.Log
|
import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class HDPlayerSystem : ExtractorApi() {
|
open class HDPlayerSystem : ExtractorApi() {
|
||||||
override val name = "HDPlayerSystem"
|
override val name = "HDPlayerSystem"
|
||||||
override val mainUrl = "https://hdplayersystem.live"
|
override val mainUrl = "https://hdplayersystem.live"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
val extRef = referer ?: ""
|
url: String,
|
||||||
val vidId = if (url.contains("video/")) {
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
) {
|
||||||
|
val extRef = referer ?: ""
|
||||||
|
val vidId = if (url.contains("video/")) {
|
||||||
url.substringAfter("video/")
|
url.substringAfter("video/")
|
||||||
} else {
|
} else {
|
||||||
url.substringAfter("?data=")
|
url.substringAfter("?data=")
|
||||||
}
|
}
|
||||||
val postUrl = "${mainUrl}/player/index.php?data=${vidId}&do=getVideo"
|
val postUrl = "$mainUrl/player/index.php?data=$vidId&do=getVideo"
|
||||||
|
|
||||||
val response = app.post(
|
val response = app.post(
|
||||||
postUrl,
|
postUrl,
|
||||||
data = mapOf(
|
data = mapOf(
|
||||||
"hash" to vidId,
|
"hash" to vidId,
|
||||||
"r" to extRef
|
"r" to extRef,
|
||||||
),
|
),
|
||||||
referer = extRef,
|
referer = extRef,
|
||||||
headers = mapOf(
|
headers = mapOf(
|
||||||
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
|
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
"X-Requested-With" to "XMLHttpRequest"
|
"X-Requested-With" to "XMLHttpRequest",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val videoResponse = response.parsedSafe<SystemResponse>() ?: throw ErrorLoadingException("failed to parse response")
|
val videoResponse = response.parsedSafe<SystemResponse>() ?: throw ErrorLoadingException("failed to parse response")
|
||||||
val m3uLink = videoResponse.securedLink
|
val m3uLink = videoResponse.securedLink
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
url = m3uLink
|
url = m3uLink,
|
||||||
) {
|
) { this.referer = extRef }
|
||||||
this.referer = extRef
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class SystemResponse(
|
data class SystemResponse(
|
||||||
@JsonProperty("hls") val hls: String,
|
@JsonProperty("hls") @SerialName("hls") val hls: String,
|
||||||
@JsonProperty("videoImage") val videoImage: String? = null,
|
@JsonProperty("videoImage") @SerialName("videoImage") val videoImage: String? = null,
|
||||||
@JsonProperty("videoSource") val videoSource: String,
|
@JsonProperty("videoSource") @SerialName("videoSource") val videoSource: String,
|
||||||
@JsonProperty("securedLink") val securedLink: String
|
@JsonProperty("securedLink") @SerialName("securedLink") val securedLink: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
import com.lagradost.cloudstream3.utils.getAndUnpack
|
import com.lagradost.cloudstream3.utils.getAndUnpack
|
||||||
import com.lagradost.cloudstream3.utils.getPacked
|
import com.lagradost.cloudstream3.utils.getPacked
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Jeniusplay : ExtractorApi() {
|
open class Jeniusplay : ExtractorApi() {
|
||||||
override val name = "Jeniusplay"
|
override val name = "Jeniusplay"
|
||||||
|
|
@ -19,16 +21,15 @@ open class Jeniusplay : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val document = app.get(url, referer = "$mainUrl/").document
|
val document = app.get(url, referer = "$mainUrl/").document
|
||||||
val hash = url.split("/").last().substringAfter("data=")
|
val hash = url.split("/").last().substringAfter("data=")
|
||||||
|
|
||||||
val m3uLink = app.post(
|
val m3uLink = app.post(
|
||||||
url = "$mainUrl/player/index.php?data=$hash&do=getVideo",
|
url = "$mainUrl/player/index.php?data=$hash&do=getVideo",
|
||||||
data = mapOf("hash" to hash, "r" to "$referer"),
|
data = mapOf("hash" to hash, "r" to "$referer"),
|
||||||
referer = url,
|
referer = url,
|
||||||
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
|
||||||
).parsed<ResponseSource>().videoSource
|
).parsed<ResponseSource>().videoSource
|
||||||
|
|
||||||
M3u8Helper.generateM3u8(
|
M3u8Helper.generateM3u8(
|
||||||
|
|
@ -36,7 +37,6 @@ open class Jeniusplay : ExtractorApi() {
|
||||||
m3uLink,
|
m3uLink,
|
||||||
url,
|
url,
|
||||||
).forEach(callback)
|
).forEach(callback)
|
||||||
|
|
||||||
document.select("script").map { script ->
|
document.select("script").map { script ->
|
||||||
if (getPacked(script.data()) != null) {
|
if (getPacked(script.data()) != null) {
|
||||||
val unpacked = getAndUnpack(script.data())
|
val unpacked = getAndUnpack(script.data())
|
||||||
|
|
@ -45,9 +45,10 @@ open class Jeniusplay : ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class ResponseSource(
|
data class ResponseSource(
|
||||||
@JsonProperty("hls") val hls: Boolean,
|
@JsonProperty("hls") @SerialName("hls") val hls: Boolean,
|
||||||
@JsonProperty("videoSource") val videoSource: String,
|
@JsonProperty("videoSource") @SerialName("videoSource") val videoSource: String,
|
||||||
@JsonProperty("securedLink") val securedLink: String?,
|
@JsonProperty("securedLink") @SerialName("securedLink") val securedLink: String?,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Linkbox : ExtractorApi() {
|
open class Linkbox : ExtractorApi() {
|
||||||
override val name = "Linkbox"
|
override val name = "Linkbox"
|
||||||
|
|
@ -17,7 +19,7 @@ open class Linkbox : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val token = Regex("""(?:/f/|/file/|\?id=)(\w+)""").find(url)?.groupValues?.get(1)
|
val token = Regex("""(?:/f/|/file/|\?id=)(\w+)""").find(url)?.groupValues?.get(1)
|
||||||
val id = app.get("$mainUrl/api/file/share_out_list/?sortField=utime&sortAsc=0&pageNo=1&pageSize=50&shareToken=$token").parsedSafe<Responses>()?.data?.itemId
|
val id = app.get("$mainUrl/api/file/share_out_list/?sortField=utime&sortAsc=0&pageNo=1&pageSize=50&shareToken=$token").parsedSafe<Responses>()?.data?.itemId
|
||||||
|
|
@ -36,22 +38,25 @@ open class Linkbox : ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Resolutions(
|
data class Resolutions(
|
||||||
@JsonProperty("url") val url: String? = null,
|
@JsonProperty("url") @SerialName("url") val url: String? = null,
|
||||||
@JsonProperty("resolution") val resolution: String? = null,
|
@JsonProperty("resolution") @SerialName("resolution") val resolution: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class ItemInfo(
|
data class ItemInfo(
|
||||||
@JsonProperty("resolutionList") val resolutionList: ArrayList<Resolutions>? = arrayListOf(),
|
@JsonProperty("resolutionList") @SerialName("resolutionList") val resolutionList: ArrayList<Resolutions>? = arrayListOf(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Data(
|
data class Data(
|
||||||
@JsonProperty("itemInfo") val itemInfo: ItemInfo? = null,
|
@JsonProperty("itemInfo") @SerialName("itemInfo") val itemInfo: ItemInfo? = null,
|
||||||
@JsonProperty("itemId") val itemId: String? = null,
|
@JsonProperty("itemId") @SerialName("itemId") val itemId: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Responses(
|
data class Responses(
|
||||||
@JsonProperty("data") val data: Data? = null,
|
@JsonProperty("data") @SerialName("data") val data: Data? = null,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -2,51 +2,57 @@
|
||||||
|
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.api.Log
|
import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class MailRu : ExtractorApi() {
|
open class MailRu : ExtractorApi() {
|
||||||
override val name = "MailRu"
|
override val name = "MailRu"
|
||||||
override val mainUrl = "https://my.mail.ru"
|
override val mainUrl = "https://my.mail.ru"
|
||||||
override val requiresReferer = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
) {
|
||||||
val extRef = referer ?: ""
|
val extRef = referer ?: ""
|
||||||
|
val vidId = url.substringAfter("video/embed/").trim()
|
||||||
val vidId = url.substringAfter("video/embed/").trim()
|
val videoReq = app.get("$mainUrl/+/video/meta/$vidId", referer = url)
|
||||||
val videoReq = app.get("${mainUrl}/+/video/meta/${vidId}", referer=url)
|
val videoKey = videoReq.cookies["video_key"].toString()
|
||||||
val videoKey = videoReq.cookies["video_key"].toString()
|
val videoData = AppUtils.tryParseJson<MailRuData>(videoReq.text) ?:
|
||||||
|
throw ErrorLoadingException("Video not found")
|
||||||
val videoData = AppUtils.tryParseJson<MailRuData>(videoReq.text) ?: throw ErrorLoadingException("Video not found")
|
|
||||||
|
|
||||||
for (video in videoData.videos) {
|
for (video in videoData.videos) {
|
||||||
|
|
||||||
val videoUrl = if (video.url.startsWith("//")) "https:${video.url}" else video.url
|
val videoUrl = if (video.url.startsWith("//")) "https:${video.url}" else video.url
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
url = videoUrl,
|
url = videoUrl,
|
||||||
type = ExtractorLinkType.M3U8
|
type = ExtractorLinkType.M3U8,
|
||||||
) {
|
) {
|
||||||
this.referer = url
|
this.referer = url
|
||||||
this.headers = mapOf("Cookie" to "video_key=${videoKey}")
|
this.headers = mapOf("Cookie" to "video_key=$videoKey")
|
||||||
this.quality = getQualityFromName(video.key)
|
this.quality = getQualityFromName(video.key)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class MailRuData(
|
data class MailRuData(
|
||||||
@JsonProperty("provider") val provider: String,
|
@JsonProperty("provider") @SerialName("provider") val provider: String,
|
||||||
@JsonProperty("videos") val videos: List<MailRuVideoData>
|
@JsonProperty("videos") @SerialName("videos") val videos: List<MailRuVideoData>,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class MailRuVideoData(
|
data class MailRuVideoData(
|
||||||
@JsonProperty("url") val url: String,
|
@JsonProperty("url") @SerialName("url") val url: String,
|
||||||
@JsonProperty("key") val key: String
|
@JsonProperty("key") @SerialName("key") val key: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,19 +7,26 @@ import com.lagradost.cloudstream3.ErrorLoadingException
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.USER_AGENT
|
import com.lagradost.cloudstream3.USER_AGENT
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.INFER_TYPE
|
import com.lagradost.cloudstream3.utils.INFER_TYPE
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Odnoklassniki : ExtractorApi() {
|
open class Odnoklassniki : ExtractorApi() {
|
||||||
override val name = "Odnoklassniki"
|
override val name = "Odnoklassniki"
|
||||||
override val mainUrl = "https://odnoklassniki.ru"
|
override val mainUrl = "https://odnoklassniki.ru"
|
||||||
override val requiresReferer = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
) {
|
||||||
val headers = mapOf(
|
val headers = mapOf(
|
||||||
"Accept" to "*/*",
|
"Accept" to "*/*",
|
||||||
"Connection" to "keep-alive",
|
"Connection" to "keep-alive",
|
||||||
|
|
@ -29,34 +36,33 @@ open class Odnoklassniki : ExtractorApi() {
|
||||||
"Origin" to mainUrl,
|
"Origin" to mainUrl,
|
||||||
"User-Agent" to USER_AGENT,
|
"User-Agent" to USER_AGENT,
|
||||||
)
|
)
|
||||||
val embedUrl = url.replace("/video/","/videoembed/")
|
|
||||||
val videoReq = app.get(embedUrl, headers=headers).text.replace("\\"", "\"").replace("\\\\", "\\")
|
val embedUrl = url.replace("/video/", "/videoembed/")
|
||||||
|
val videoReq = app.get(embedUrl, headers = headers).text.replace("\\"", "\"").replace("\\\\", "\\")
|
||||||
.replace(Regex("\\\\u([0-9A-Fa-f]{4})")) { matchResult ->
|
.replace(Regex("\\\\u([0-9A-Fa-f]{4})")) { matchResult ->
|
||||||
matchResult.groupValues[1].toInt(16).toChar().toString()
|
matchResult.groupValues[1].toInt(16).toChar().toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
val videosStr = Regex(""""videos":(\[[^]]*])""").find(videoReq)?.groupValues?.get(1) ?: throw ErrorLoadingException("Video not found")
|
val videosStr = Regex(""""videos":(\[[^]]*])""").find(videoReq)?.groupValues?.get(1) ?: throw ErrorLoadingException("Video not found")
|
||||||
val videos = AppUtils.tryParseJson<List<OkRuVideo>>(videosStr) ?: throw ErrorLoadingException("Video not found")
|
val videos = tryParseJson<List<OkRuVideo>>(videosStr) ?: throw ErrorLoadingException("Video not found")
|
||||||
|
|
||||||
for (video in videos) {
|
for (video in videos) {
|
||||||
|
val videoUrl = if (video.url.startsWith("//")) "https:${video.url}" else video.url
|
||||||
val videoUrl = if (video.url.startsWith("//")) "https:${video.url}" else video.url
|
val quality = video.name.uppercase()
|
||||||
|
|
||||||
val quality = video.name.uppercase()
|
|
||||||
.replace("MOBILE", "144p")
|
.replace("MOBILE", "144p")
|
||||||
.replace("LOWEST", "240p")
|
.replace("LOWEST", "240p")
|
||||||
.replace("LOW", "360p")
|
.replace("LOW", "360p")
|
||||||
.replace("SD", "480p")
|
.replace("SD", "480p")
|
||||||
.replace("HD", "720p")
|
.replace("HD", "720p")
|
||||||
.replace("FULL", "1080p")
|
.replace("FULL", "1080p")
|
||||||
.replace("QUAD", "1440p")
|
.replace("QUAD", "1440p")
|
||||||
.replace("ULTRA", "4k")
|
.replace("ULTRA", "4k")
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
url = videoUrl,
|
url = videoUrl,
|
||||||
type = INFER_TYPE
|
type = INFER_TYPE,
|
||||||
) {
|
) {
|
||||||
this.referer = "$mainUrl/"
|
this.referer = "$mainUrl/"
|
||||||
this.quality = getQualityFromName(quality)
|
this.quality = getQualityFromName(quality)
|
||||||
|
|
@ -66,8 +72,9 @@ open class Odnoklassniki : ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class OkRuVideo(
|
data class OkRuVideo(
|
||||||
@JsonProperty("name") val name: String,
|
@JsonProperty("name") @SerialName("name") val name: String,
|
||||||
@JsonProperty("url") val url: String,
|
@JsonProperty("url") @SerialName("url") val url: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,57 +2,63 @@
|
||||||
|
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.api.Log
|
import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class PeaceMakerst : ExtractorApi() {
|
open class PeaceMakerst : ExtractorApi() {
|
||||||
override val name = "PeaceMakerst"
|
override val name = "PeaceMakerst"
|
||||||
override val mainUrl = "https://peacemakerst.com"
|
override val mainUrl = "https://peacemakerst.com"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
val m3uLink:String?
|
url: String,
|
||||||
val extRef = referer ?: ""
|
referer: String?,
|
||||||
val postUrl = "${url}?do=getVideo"
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
) {
|
||||||
|
val m3uLink: String?
|
||||||
|
val extRef = referer ?: ""
|
||||||
|
val postUrl = "$url?do=getVideo"
|
||||||
val response = app.post(
|
val response = app.post(
|
||||||
postUrl,
|
postUrl,
|
||||||
data = mapOf(
|
data = mapOf(
|
||||||
"hash" to url.substringAfter("video/"),
|
"hash" to url.substringAfter("video/"),
|
||||||
"r" to extRef,
|
"r" to extRef,
|
||||||
"s" to ""
|
"s" to "",
|
||||||
),
|
),
|
||||||
referer = extRef,
|
referer = extRef,
|
||||||
headers = mapOf(
|
headers = mapOf(
|
||||||
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
|
"Content-Type" to "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
"X-Requested-With" to "XMLHttpRequest"
|
"X-Requested-With" to "XMLHttpRequest",
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
if (response.text.contains("teve2.com.tr\\/embed\\/")) {
|
|
||||||
val teve2Id = response.text.substringAfter("teve2.com.tr\\/embed\\/").substringBefore("\"")
|
|
||||||
val teve2Response = app.get(
|
|
||||||
"https://www.teve2.com.tr/action/media/${teve2Id}",
|
|
||||||
referer = "https://www.teve2.com.tr/embed/${teve2Id}"
|
|
||||||
).parsedSafe<Teve2ApiResponse>() ?: throw ErrorLoadingException("teve2 response is null")
|
|
||||||
|
|
||||||
m3uLink = teve2Response.media.link.serviceUrl + "//" + teve2Response.media.link.securePath
|
if (response.text.contains("teve2.com.tr\\/embed\\/")) {
|
||||||
|
val teve2Id = response.text.substringAfter("teve2.com.tr\\/embed\\/").substringBefore("\"")
|
||||||
|
val teve2Response = app.get(
|
||||||
|
"https://www.teve2.com.tr/action/media/$teve2Id",
|
||||||
|
referer = "https://www.teve2.com.tr/embed/$teve2Id",
|
||||||
|
).parsedSafe<Teve2ApiResponse>() ?: throw ErrorLoadingException("teve2 response is null")
|
||||||
|
m3uLink = teve2Response.media.link.serviceUrl + "//" + teve2Response.media.link.securePath
|
||||||
} else {
|
} else {
|
||||||
val videoResponse = response.parsedSafe<PeaceResponse>() ?: throw ErrorLoadingException("peace response is null")
|
val videoResponse = response.parsedSafe<PeaceResponse>() ?: throw ErrorLoadingException("peace response is null")
|
||||||
val videoSources = videoResponse.videoSources
|
val videoSources = videoResponse.videoSources
|
||||||
if (videoSources.isNotEmpty()) {
|
m3uLink = if (videoSources.isNotEmpty()) {
|
||||||
m3uLink = videoSources.lastOrNull()?.file
|
videoSources.lastOrNull()?.file
|
||||||
} else {
|
} else {
|
||||||
m3uLink = null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
url = m3uLink ?: throw ErrorLoadingException("m3u link not found"),
|
url = m3uLink ?: throw ErrorLoadingException("m3u link not found"),
|
||||||
) {
|
) {
|
||||||
this.referer = extRef
|
this.referer = extRef
|
||||||
this.quality = Qualities.Unknown.value
|
this.quality = Qualities.Unknown.value
|
||||||
|
|
@ -60,29 +66,34 @@ open class PeaceMakerst : ExtractorApi() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class PeaceResponse(
|
data class PeaceResponse(
|
||||||
@JsonProperty("videoImage") val videoImage: String?,
|
@JsonProperty("videoImage") @SerialName("videoImage") val videoImage: String?,
|
||||||
@JsonProperty("videoSources") val videoSources: List<VideoSource>,
|
@JsonProperty("videoSources") @SerialName("videoSources") val videoSources: List<VideoSource>,
|
||||||
@JsonProperty("sIndex") val sIndex: String,
|
@JsonProperty("sIndex") @SerialName("sIndex") val sourceIndex: String,
|
||||||
@JsonProperty("sourceList") val sourceList: Map<String, String>
|
@JsonProperty("sourceList") @SerialName("sourceList") val sourceList: Map<String, String>,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class VideoSource(
|
data class VideoSource(
|
||||||
@JsonProperty("file") val file: String,
|
@JsonProperty("file") @SerialName("file") val file: String,
|
||||||
@JsonProperty("label") val label: String,
|
@JsonProperty("label") @SerialName("label") val label: String,
|
||||||
@JsonProperty("type") val type: String
|
@JsonProperty("type") @SerialName("type") val type: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Teve2ApiResponse(
|
data class Teve2ApiResponse(
|
||||||
@JsonProperty("Media") val media: Teve2Media
|
@JsonProperty("Media") @SerialName("Media") val media: Teve2Media,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Teve2Media(
|
data class Teve2Media(
|
||||||
@JsonProperty("Link") val link: Teve2Link
|
@JsonProperty("Link") @SerialName("Link") val link: Teve2Link,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Teve2Link(
|
data class Teve2Link(
|
||||||
@JsonProperty("ServiceUrl") val serviceUrl: String,
|
@JsonProperty("ServiceUrl") @SerialName("ServiceUrl") val serviceUrl: String,
|
||||||
@JsonProperty("SecurePath") val securePath: String
|
@JsonProperty("SecurePath") @SerialName("SecurePath") val securePath: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,28 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
import com.lagradost.api.Log
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class PlayLtXyz: ExtractorApi() {
|
open class PlayLtXyz : ExtractorApi() {
|
||||||
override val name: String = "PlayLt"
|
override val name = "PlayLt"
|
||||||
override val mainUrl: String = "https://play.playlt.xyz"
|
override val mainUrl = "https://play.playlt.xyz"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
private data class ResponseData(
|
|
||||||
@JsonProperty("data") val data: String? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
||||||
val extractedLinksList = mutableListOf<ExtractorLink>()
|
val extractedLinksList = mutableListOf<ExtractorLink>()
|
||||||
//Log.i(this.name, "Result => (url) $url")
|
|
||||||
var idUser = ""
|
var idUser = ""
|
||||||
var idFile = ""
|
var idFile = ""
|
||||||
var bodyText = ""
|
var bodyText = ""
|
||||||
val doc = app.get(url, referer = referer).document
|
val doc = app.get(url, referer = referer).document
|
||||||
//Log.i(this.name, "Result => (url, script) $url / ${doc.select("script")}")
|
|
||||||
bodyText = doc.select("script").firstOrNull {
|
bodyText = doc.select("script").firstOrNull {
|
||||||
val text = it.toString()
|
val text = it.toString()
|
||||||
text.contains("var idUser")
|
text.contains("var idUser")
|
||||||
}?.toString() ?: ""
|
}?.toString() ?: ""
|
||||||
//Log.i(this.name, "Result => (bodyText) $bodyText")
|
|
||||||
if (bodyText.isNotBlank()) {
|
if (bodyText.isNotBlank()) {
|
||||||
idUser = "(?<=var idUser = \")(.*)(?=\";)".toRegex().find(bodyText)
|
idUser = "(?<=var idUser = \")(.*)(?=\";)".toRegex().find(bodyText)
|
||||||
?.groupValues?.get(0) ?: ""
|
?.groupValues?.get(0) ?: ""
|
||||||
|
|
@ -35,29 +30,27 @@ open class PlayLtXyz: ExtractorApi() {
|
||||||
idFile = "(?<=var idfile = \")(.*)(?=\";)".toRegex().find(bodyText)
|
idFile = "(?<=var idfile = \")(.*)(?=\";)".toRegex().find(bodyText)
|
||||||
?.groupValues?.get(0) ?: ""
|
?.groupValues?.get(0) ?: ""
|
||||||
}
|
}
|
||||||
//Log.i(this.name, "Result => (idUser, idFile) $idUser / $idFile")
|
|
||||||
if (idUser.isNotBlank() && idFile.isNotBlank()) {
|
if (idUser.isNotBlank() && idFile.isNotBlank()) {
|
||||||
//val sess = HttpSession()
|
|
||||||
val ajaxHead = mapOf(
|
val ajaxHead = mapOf(
|
||||||
Pair("Origin", mainUrl),
|
Pair("Origin", mainUrl),
|
||||||
Pair("Referer", mainUrl),
|
Pair("Referer", mainUrl),
|
||||||
Pair("Sec-Fetch-Site", "same-site"),
|
Pair("Sec-Fetch-Site", "same-site"),
|
||||||
Pair("Sec-Fetch-Mode", "cors"),
|
Pair("Sec-Fetch-Mode", "cors"),
|
||||||
Pair("Sec-Fetch-Dest", "empty")
|
Pair("Sec-Fetch-Dest", "empty"),
|
||||||
)
|
|
||||||
val ajaxData = mapOf(
|
|
||||||
Pair("referrer", referer ?: mainUrl),
|
|
||||||
Pair("typeend", "html")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//idUser = 608f7c85cf0743547f1f1b4e
|
val ajaxData = mapOf(
|
||||||
val posturl = "https://api-plhq.playlt.xyz/apiv5/$idUser/$idFile"
|
Pair("referrer", referer ?: mainUrl),
|
||||||
val data = app.post(posturl, headers = ajaxHead, data = ajaxData)
|
Pair("typeend", "html"),
|
||||||
//Log.i(this.name, "Result => (posturl) $posturl")
|
)
|
||||||
|
|
||||||
|
val postUrl = "https://api-plhq.playlt.xyz/apiv5/$idUser/$idFile"
|
||||||
|
val data = app.post(postUrl, headers = ajaxHead, data = ajaxData)
|
||||||
if (data.isSuccessful) {
|
if (data.isSuccessful) {
|
||||||
val itemstr = data.text
|
val itemStr = data.text
|
||||||
Log.i(this.name, "Result => (data) $itemstr")
|
Log.i(this.name, "Result => (data) $itemStr")
|
||||||
tryParseJson<ResponseData?>(itemstr)?.let { item ->
|
tryParseJson<ResponseData>(itemStr)?.let { item ->
|
||||||
val linkUrl = item.data ?: ""
|
val linkUrl = item.data ?: ""
|
||||||
if (linkUrl.isNotBlank()) {
|
if (linkUrl.isNotBlank()) {
|
||||||
extractedLinksList.add(
|
extractedLinksList.add(
|
||||||
|
|
@ -65,7 +58,7 @@ open class PlayLtXyz: ExtractorApi() {
|
||||||
source = name,
|
source = name,
|
||||||
name = name,
|
name = name,
|
||||||
url = linkUrl,
|
url = linkUrl,
|
||||||
type = ExtractorLinkType.M3U8
|
type = ExtractorLinkType.M3U8,
|
||||||
) {
|
) {
|
||||||
this.referer = url
|
this.referer = url
|
||||||
this.quality = Qualities.Unknown.value
|
this.quality = Qualities.Unknown.value
|
||||||
|
|
@ -75,6 +68,12 @@ open class PlayLtXyz: ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return extractedLinksList
|
return extractedLinksList
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Serializable
|
||||||
|
private data class ResponseData(
|
||||||
|
@JsonProperty("data") @SerialName("data") val data: String? = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.base64DecodeArray
|
import com.lagradost.cloudstream3.base64DecodeArray
|
||||||
import com.lagradost.cloudstream3.base64Encode
|
import com.lagradost.cloudstream3.base64Encode
|
||||||
import com.lagradost.cloudstream3.newSubtitleFile
|
import com.lagradost.cloudstream3.newSubtitleFile
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
|
|
@ -16,6 +16,8 @@ import dev.whyoleg.cryptography.CryptographyProvider
|
||||||
import dev.whyoleg.cryptography.DelicateCryptographyApi
|
import dev.whyoleg.cryptography.DelicateCryptographyApi
|
||||||
import dev.whyoleg.cryptography.algorithms.AES
|
import dev.whyoleg.cryptography.algorithms.AES
|
||||||
import dev.whyoleg.cryptography.algorithms.MD5
|
import dev.whyoleg.cryptography.algorithms.MD5
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
class Megacloud : Rabbitstream() {
|
class Megacloud : Rabbitstream() {
|
||||||
override val name = "Megacloud"
|
override val name = "Megacloud"
|
||||||
|
|
@ -36,6 +38,7 @@ class Megacloud : Rabbitstream() {
|
||||||
extractedKey += sourcesArray[i].toString()
|
extractedKey += sourcesArray[i].toString()
|
||||||
sourcesArray[i] = ' '
|
sourcesArray[i] = ' '
|
||||||
}
|
}
|
||||||
|
|
||||||
currentIndex += index[1]
|
currentIndex += index[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +58,7 @@ class Megacloud : Rabbitstream() {
|
||||||
val matchKey2 = matchingKey(match.groupValues[2])
|
val matchKey2 = matchingKey(match.groupValues[2])
|
||||||
try {
|
try {
|
||||||
listOf(matchKey1.toInt(16), matchKey2.toInt(16))
|
listOf(matchKey1.toInt(16), matchKey2.toInt(16))
|
||||||
} catch (e: NumberFormatException) {
|
} catch (_: NumberFormatException) {
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
}.filter { it.isNotEmpty() }
|
}.filter { it.isNotEmpty() }
|
||||||
|
|
@ -86,26 +89,25 @@ open class Rabbitstream : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val id = url.substringAfterLast("/").substringBefore("?")
|
val id = url.substringAfterLast("/").substringBefore("?")
|
||||||
|
|
||||||
val response = app.get(
|
val response = app.get(
|
||||||
"$mainUrl/$embed/getSources?id=$id",
|
"$mainUrl/$embed/getSources?id=$id",
|
||||||
referer = mainUrl,
|
referer = mainUrl,
|
||||||
headers = mapOf("X-Requested-With" to "XMLHttpRequest")
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
|
||||||
)
|
)
|
||||||
|
|
||||||
val encryptedMap = response.parsedSafe<SourcesEncrypted>()
|
val encryptedMap = response.parsedSafe<SourcesEncrypted>()
|
||||||
val sources = encryptedMap?.sources
|
val sources = encryptedMap?.sources
|
||||||
val decryptedSources = if (sources == null || encryptedMap.encrypted == false) {
|
val decryptedSources = if (sources == null || encryptedMap.encrypted == false) {
|
||||||
response.parsedSafe()
|
response.parsedSafe<SourcesResponses>()
|
||||||
} else {
|
} else {
|
||||||
val (key, encData) = extractRealKey(sources)
|
val (key, encData) = extractRealKey(sources)
|
||||||
val decrypted = decryptMapped<List<Sources>>(encData, key)
|
val decrypted = tryParseJson<List<Sources>>(decrypt(encData, key))
|
||||||
SourcesResponses(
|
SourcesResponses(
|
||||||
sources = decrypted,
|
sources = decrypted,
|
||||||
tracks = encryptedMap.tracks
|
tracks = encryptedMap.tracks,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,7 +123,7 @@ open class Rabbitstream : ExtractorApi() {
|
||||||
subtitleCallback.invoke(
|
subtitleCallback.invoke(
|
||||||
newSubtitleFile(
|
newSubtitleFile(
|
||||||
track?.label ?: return@map,
|
track?.label ?: return@map,
|
||||||
track.file ?: return@map
|
track.file ?: return@map,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -133,65 +135,65 @@ open class Rabbitstream : ExtractorApi() {
|
||||||
return extractedKey to sources
|
return extractedKey to sources
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline fun <reified T> decryptMapped(input: String, key: String): T? {
|
private suspend fun decrypt(input: String, key: String): String {
|
||||||
val decrypt = decrypt(input, key)
|
|
||||||
return AppUtils.tryParseJson(decrypt)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun decrypt(input: String, key: String): String {
|
|
||||||
return decryptSourceUrl(
|
return decryptSourceUrl(
|
||||||
generateKey(
|
generateKey(
|
||||||
salt = base64DecodeArray(input).copyOfRange(8, 16),
|
salt = base64DecodeArray(input).copyOfRange(8, 16),
|
||||||
secret = key.encodeToByteArray()
|
secret = key.encodeToByteArray(),
|
||||||
), input
|
), input
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateKey(salt: ByteArray, secret: ByteArray): ByteArray {
|
private suspend fun generateKey(salt: ByteArray, secret: ByteArray): ByteArray {
|
||||||
var key = md5(secret + salt)
|
var key = md5(secret + salt)
|
||||||
var currentKey = key
|
var currentKey = key
|
||||||
while (currentKey.size < 48) {
|
while (currentKey.size < 48) {
|
||||||
key = md5(key + secret + salt)
|
key = md5(key + secret + salt)
|
||||||
currentKey += key
|
currentKey += key
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentKey
|
return currentKey
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun md5(input: ByteArray): ByteArray =
|
private suspend fun md5(input: ByteArray): ByteArray =
|
||||||
md5Hasher.hashBlocking(input)
|
md5Hasher.hash(input)
|
||||||
|
|
||||||
@OptIn(DelicateCryptographyApi::class)
|
@OptIn(DelicateCryptographyApi::class)
|
||||||
private fun decryptSourceUrl(decryptionKey: ByteArray, sourceUrl: String): String {
|
private suspend fun decryptSourceUrl(decryptionKey: ByteArray, sourceUrl: String): String {
|
||||||
val cipherData = base64DecodeArray(sourceUrl)
|
val cipherData = base64DecodeArray(sourceUrl)
|
||||||
val encrypted = cipherData.copyOfRange(16, cipherData.size)
|
val encrypted = cipherData.copyOfRange(16, cipherData.size)
|
||||||
val keyBytes = decryptionKey.copyOfRange(0, 32)
|
val keyBytes = decryptionKey.copyOfRange(0, 32)
|
||||||
val ivBytes = decryptionKey.copyOfRange(32, decryptionKey.size)
|
val ivBytes = decryptionKey.copyOfRange(32, decryptionKey.size)
|
||||||
|
|
||||||
val aesKey = aesCbc.keyDecoder().decodeFromByteArrayBlocking(AES.Key.Format.RAW, keyBytes)
|
val aesKey = aesCbc.keyDecoder().decodeFromByteArray(AES.Key.Format.RAW, keyBytes)
|
||||||
val decryptedData = aesKey.cipher(padding = true).decryptWithIvBlocking(ivBytes, encrypted)
|
val decryptedData = aesKey.cipher(padding = true).decryptWithIv(ivBytes, encrypted)
|
||||||
return decryptedData.decodeToString()
|
return decryptedData.decodeToString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Tracks(
|
data class Tracks(
|
||||||
@JsonProperty("file") val file: String? = null,
|
@JsonProperty("file") @SerialName("file") val file: String? = null,
|
||||||
@JsonProperty("label") val label: String? = null,
|
@JsonProperty("label") @SerialName("label") val label: String? = null,
|
||||||
@JsonProperty("kind") val kind: String? = null,
|
@JsonProperty("kind") @SerialName("kind") val kind: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Sources(
|
data class Sources(
|
||||||
@JsonProperty("file") val file: String? = null,
|
@JsonProperty("file") @SerialName("file") val file: String? = null,
|
||||||
@JsonProperty("type") val type: String? = null,
|
@JsonProperty("type") @SerialName("type") val type: String? = null,
|
||||||
@JsonProperty("label") val label: String? = null,
|
@JsonProperty("label") @SerialName("label") val label: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class SourcesResponses(
|
data class SourcesResponses(
|
||||||
@JsonProperty("sources") val sources: List<Sources?>? = emptyList(),
|
@JsonProperty("sources") @SerialName("sources") val sources: List<Sources?>? = emptyList(),
|
||||||
@JsonProperty("tracks") val tracks: List<Tracks?>? = emptyList(),
|
@JsonProperty("tracks") @SerialName("tracks") val tracks: List<Tracks?>? = emptyList(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class SourcesEncrypted(
|
data class SourcesEncrypted(
|
||||||
@JsonProperty("sources") val sources: String? = null,
|
@JsonProperty("sources") @SerialName("sources") val sources: String? = null,
|
||||||
@JsonProperty("encrypted") val encrypted: Boolean? = null,
|
@JsonProperty("encrypted") @SerialName("encrypted") val encrypted: Boolean? = null,
|
||||||
@JsonProperty("tracks") val tracks: List<Tracks?>? = emptyList(),
|
@JsonProperty("tracks") @SerialName("tracks") val tracks: List<Tracks?>? = emptyList(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,51 +2,53 @@
|
||||||
|
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
|
||||||
open class Sobreatsesuyp : ExtractorApi() {
|
open class Sobreatsesuyp : ExtractorApi() {
|
||||||
override val name = "Sobreatsesuyp"
|
override val name = "Sobreatsesuyp"
|
||||||
override val mainUrl = "https://sobreatsesuyp.com"
|
override val mainUrl = "https://sobreatsesuyp.com"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
) {
|
||||||
val extRef = referer ?: ""
|
val extRef = referer ?: ""
|
||||||
|
|
||||||
val videoReq = app.get(url, referer = extRef).text
|
val videoReq = app.get(url, referer = extRef).text
|
||||||
|
val file = Regex("""file\":\"([^\"]+)""").find(videoReq)?.groupValues?.get(1) ?: throw ErrorLoadingException("File not found")
|
||||||
val file = Regex("""file\":\"([^\"]+)""").find(videoReq)?.groupValues?.get(1) ?: throw ErrorLoadingException("File not found")
|
val postLink = "$mainUrl/" + file.replace("\\", "")
|
||||||
val postLink = "${mainUrl}/" + file.replace("\\", "")
|
val rawList = app.post(postLink, referer = extRef).parsedSafe<List<JsonElement>>() ?: throw ErrorLoadingException("Post link not found")
|
||||||
val rawList = app.post(postLink, referer = extRef).parsedSafe<List<Any>>() ?: throw ErrorLoadingException("Post link not found")
|
|
||||||
|
|
||||||
val postJson: List<SobreatsesuypVideoData> = rawList.drop(1).map { item ->
|
val postJson: List<SobreatsesuypVideoData> = rawList.drop(1).map { item ->
|
||||||
val mapItem = item as Map<*, *>
|
val mapItem = item as Map<*, *>
|
||||||
SobreatsesuypVideoData(
|
SobreatsesuypVideoData(
|
||||||
title = mapItem["title"] as? String,
|
title = mapItem["title"] as? String,
|
||||||
file = mapItem["file"] as? String
|
file = mapItem["file"] as? String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (item in postJson) {
|
for (item in postJson) {
|
||||||
if (item.file == null || item.title == null) continue
|
if (item.file == null || item.title == null) continue
|
||||||
|
val videoData = app.post("$mainUrl/playlist/${item.file.substring(1)}.txt", referer = extRef).text
|
||||||
val videoData = app.post("${mainUrl}/playlist/${item.file.substring(1)}.txt", referer = extRef).text
|
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = "${this.name} - ${item.title}",
|
name = "${this.name} - ${item.title}",
|
||||||
url = videoData,
|
url = videoData,
|
||||||
) {
|
) { this.referer = extRef }
|
||||||
this.referer = extRef
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class SobreatsesuypVideoData(
|
data class SobreatsesuypVideoData(
|
||||||
@JsonProperty("title") val title: String? = null,
|
@JsonProperty("title") @SerialName("title") val title: String? = null,
|
||||||
@JsonProperty("file") val file: String? = null
|
@JsonProperty("file") @SerialName("file") val file: String? = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,22 +7,23 @@ import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class StreamEmbed : ExtractorApi() {
|
open class StreamEmbed : ExtractorApi() {
|
||||||
override var name = "StreamEmbed"
|
override val name = "StreamEmbed"
|
||||||
override var mainUrl = "https://watch.gxplayer.xyz"
|
override val mainUrl = "https://watch.gxplayer.xyz"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val jsonString = app.get(url, referer = mainUrl).text
|
val jsonString = app.get(url, referer = mainUrl).text
|
||||||
.substringAfter("var video = ").substringBefore(";")
|
.substringAfter("var video = ").substringBefore(";")
|
||||||
val video = parseJson<Details>(jsonString)
|
val video = parseJson<Details>(jsonString)
|
||||||
|
|
||||||
M3u8Helper.generateM3u8(
|
M3u8Helper.generateM3u8(
|
||||||
this.name,
|
this.name,
|
||||||
"$mainUrl/m3u8/${video.uid}/${video.md5}/master.txt?s=1&id=${video.id}&cache=${video.status}",
|
"$mainUrl/m3u8/${video.uid}/${video.md5}/master.txt?s=1&id=${video.id}&cache=${video.status}",
|
||||||
|
|
@ -30,14 +31,15 @@ open class StreamEmbed : ExtractorApi() {
|
||||||
).forEach(callback)
|
).forEach(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
private data class Details(
|
private data class Details(
|
||||||
@JsonProperty("id") val id: String,
|
@JsonProperty("id") @SerialName("id") val id: String,
|
||||||
@JsonProperty("uid") val uid: String,
|
@JsonProperty("uid") @SerialName("uid") val uid: String,
|
||||||
@JsonProperty("slug") val slug: String,
|
@JsonProperty("slug") @SerialName("slug") val slug: String,
|
||||||
@JsonProperty("title") val title: String,
|
@JsonProperty("title") @SerialName("title") val title: String,
|
||||||
@JsonProperty("quality") val quality: String,
|
@JsonProperty("quality") @SerialName("quality") val quality: String,
|
||||||
@JsonProperty("type") val type: String,
|
@JsonProperty("type") @SerialName("type") val type: String,
|
||||||
@JsonProperty("status") val status: String,
|
@JsonProperty("status") @SerialName("status") val status: String,
|
||||||
@JsonProperty("md5") val md5: String,
|
@JsonProperty("md5") @SerialName("md5") val md5: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import com.lagradost.cloudstream3.newSubtitleFile
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
class Sblona : StreamSB() {
|
class Sblona : StreamSB() {
|
||||||
|
|
@ -141,17 +143,15 @@ open class StreamSB : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val regexID =
|
val regexId =
|
||||||
Regex("(embed-[a-zA-Z\\d]{0,8}[a-zA-Z\\d_-]+|/e/[a-zA-Z\\d]{0,8}[a-zA-Z\\d_-]+)")
|
Regex("(embed-[a-zA-Z\\d]{0,8}[a-zA-Z\\d_-]+|/e/[a-zA-Z\\d]{0,8}[a-zA-Z\\d_-]+)")
|
||||||
val id = regexID.findAll(url).map {
|
val id = regexId.findAll(url).map {
|
||||||
it.value.replace(Regex("(embed-|/e/)"), "")
|
it.value.replace(Regex("(embed-|/e/)"), "")
|
||||||
}.first()
|
}.first()
|
||||||
val master = "$mainUrl/375664356a494546326c4b797c7c6e756577776778623171737/${encodeId(id)}"
|
val master = "$mainUrl/375664356a494546326c4b797c7c6e756577776778623171737/${encodeId(id)}"
|
||||||
val headers = mapOf(
|
val headers = mapOf("watchsb" to "sbstream")
|
||||||
"watchsb" to "sbstream",
|
|
||||||
)
|
|
||||||
val mapped = app.get(
|
val mapped = app.get(
|
||||||
master.lowercase(),
|
master.lowercase(),
|
||||||
headers = headers,
|
headers = headers,
|
||||||
|
|
@ -161,9 +161,8 @@ open class StreamSB : ExtractorApi() {
|
||||||
name,
|
name,
|
||||||
mapped?.streamData?.file ?: return,
|
mapped?.streamData?.file ?: return,
|
||||||
url,
|
url,
|
||||||
headers = headers
|
headers = headers,
|
||||||
).forEach(callback)
|
).forEach(callback)
|
||||||
|
|
||||||
mapped.streamData.subs?.map {sub ->
|
mapped.streamData.subs?.map {sub ->
|
||||||
subtitleCallback.invoke(
|
subtitleCallback.invoke(
|
||||||
newSubtitleFile(
|
newSubtitleFile(
|
||||||
|
|
@ -189,25 +188,27 @@ open class StreamSB : ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Subs (
|
@Serializable
|
||||||
@JsonProperty("file") val file: String? = null,
|
data class Subs(
|
||||||
@JsonProperty("label") val label: String? = null,
|
@JsonProperty("file") @SerialName("file") val file: String? = null,
|
||||||
|
@JsonProperty("label") @SerialName("label") val label: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class StreamData (
|
@Serializable
|
||||||
@JsonProperty("file") val file: String,
|
data class StreamData(
|
||||||
@JsonProperty("cdn_img") val cdnImg: String,
|
@JsonProperty("file") @SerialName("file") val file: String,
|
||||||
@JsonProperty("hash") val hash: String,
|
@JsonProperty("cdn_img") @SerialName("cdn_img") val cdnImg: String,
|
||||||
@JsonProperty("subs") val subs: ArrayList<Subs>? = arrayListOf(),
|
@JsonProperty("hash") @SerialName("hash") val hash: String,
|
||||||
@JsonProperty("length") val length: String,
|
@JsonProperty("subs") @SerialName("subs") val subs: ArrayList<Subs>? = arrayListOf(),
|
||||||
@JsonProperty("id") val id: String,
|
@JsonProperty("length") @SerialName("length") val length: String,
|
||||||
@JsonProperty("title") val title: String,
|
@JsonProperty("id") @SerialName("id") val id: String,
|
||||||
@JsonProperty("backup") val backup: String,
|
@JsonProperty("title") @SerialName("title") val title: String,
|
||||||
|
@JsonProperty("backup") @SerialName("backup") val backup: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class Main (
|
@Serializable
|
||||||
@JsonProperty("stream_data") val streamData: StreamData,
|
data class Main(
|
||||||
@JsonProperty("status_code") val statusCode: Int,
|
@JsonProperty("stream_data") @SerialName("stream_data") val streamData: StreamData,
|
||||||
|
@JsonProperty("status_code") @SerialName("status_code") val statusCode: Int,
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
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.evalJs
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
import org.mozilla.javascript.Context
|
|
||||||
|
|
||||||
class Watchadsontape : StreamTape() {
|
class Watchadsontape : StreamTape() {
|
||||||
override var mainUrl = "https://watchadsontape.com"
|
override var mainUrl = "https://watchadsontape.com"
|
||||||
|
|
@ -30,24 +30,14 @@ open class StreamTape : ExtractorApi() {
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||||
with(app.get(url)) {
|
with(app.get(url)) {
|
||||||
var result =
|
val result =
|
||||||
this.document.select("script").firstOrNull { it.html().contains("botlink').innerHTML") }
|
this.document.select("script").firstOrNull { it.html().contains("botlink').innerHTML") }
|
||||||
?.html()?.lines()?.firstOrNull{ it.contains("botlink').innerHTML") }?.let {
|
?.html()?.lines()?.firstOrNull { it.contains("botlink').innerHTML") }?.let {
|
||||||
val scriptContent =
|
val scriptContent = it.substringAfter(").innerHTML").replaceFirst("=", "var url =")
|
||||||
it.substringAfter(").innerHTML").replaceFirst("=", "var url =")
|
evalJs(scriptContent, "url")?.toString()
|
||||||
val rhino = Context.enter()
|
|
||||||
rhino.setInterpretedMode(true)
|
|
||||||
val scope = rhino.initStandardObjects()
|
|
||||||
var result = ""
|
|
||||||
try {
|
|
||||||
rhino.evaluateString(scope, scriptContent, "url", 1, null)
|
|
||||||
result = scope.get("url", scope).toString()
|
|
||||||
}finally {
|
|
||||||
rhino.close()
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
}
|
||||||
if(!result.isNullOrEmpty()){
|
|
||||||
|
if (!result.isNullOrEmpty()) {
|
||||||
val extractedUrl = "https:${result}&stream=1"
|
val extractedUrl = "https:${result}&stream=1"
|
||||||
return listOf(
|
return listOf(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ class Ewish : StreamWishExtractor() {
|
||||||
override val mainUrl = "https://embedwish.com"
|
override val mainUrl = "https://embedwish.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
class Hgcloudto : StreamWishExtractor() {
|
class Hgcloudto : StreamWishExtractor() {
|
||||||
override val name = "Hgcloud"
|
override val name = "Hgcloud"
|
||||||
override val mainUrl = "https://Hgcloud.to"
|
override val mainUrl = "https://Hgcloud.to"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
import com.lagradost.cloudstream3.utils.ExtractorLinkType
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
open class Streamcash: ExtractorApi() {
|
open class Streamcash: ExtractorApi() {
|
||||||
override val name: String = "Streamcash"
|
override val name: String = "Streamcash"
|
||||||
override val mainUrl: String = "https://streamcash.to"
|
override val mainUrl: String = "https://streamcash.to"
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,11 @@ import com.lagradost.cloudstream3.utils.INFER_TYPE
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.nicehttp.RequestBodyTypes
|
import com.lagradost.nicehttp.RequestBodyTypes
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
|
||||||
|
|
||||||
class Streamlare : Slmaxed() {
|
class Streamlare : Slmaxed() {
|
||||||
override val mainUrl = "https://streamlare.com/"
|
override val mainUrl = "https://streamlare.com/"
|
||||||
}
|
}
|
||||||
|
|
@ -24,27 +25,11 @@ open class Slmaxed : ExtractorApi() {
|
||||||
|
|
||||||
// https://slmaxed.com/e/oLvgezw3LjPzbp8E -> oLvgezw3LjPzbp8E
|
// https://slmaxed.com/e/oLvgezw3LjPzbp8E -> oLvgezw3LjPzbp8E
|
||||||
val embedRegex = Regex("""/e/([^/]*)""")
|
val embedRegex = Regex("""/e/([^/]*)""")
|
||||||
|
|
||||||
|
|
||||||
data class JsonResponse(
|
|
||||||
@JsonProperty val status: String? = null,
|
|
||||||
@JsonProperty val message: String? = null,
|
|
||||||
@JsonProperty val type: String? = null,
|
|
||||||
@JsonProperty val token: String? = null,
|
|
||||||
@JsonProperty val result: Map<String, Result>? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
data class Result(
|
|
||||||
@JsonProperty val label: String? = null,
|
|
||||||
@JsonProperty val file: String? = null,
|
|
||||||
@JsonProperty val type: String? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||||
val id = embedRegex.find(url)!!.groupValues[1]
|
val id = embedRegex.find(url)!!.groupValues[1]
|
||||||
val json = app.post(
|
val json = app.post(
|
||||||
"${mainUrl}api/video/stream/get",
|
"${mainUrl}api/video/stream/get",
|
||||||
requestBody = """{"id":"$id"}""".toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull())
|
requestBody = """{"id":"$id"}""".toRequestBody(RequestBodyTypes.JSON.toMediaTypeOrNull()),
|
||||||
).parsed<JsonResponse>()
|
).parsed<JsonResponse>()
|
||||||
return json.result?.mapNotNull {
|
return json.result?.mapNotNull {
|
||||||
it.value.let { result ->
|
it.value.let { result ->
|
||||||
|
|
@ -52,18 +37,29 @@ open class Slmaxed : ExtractorApi() {
|
||||||
this.name,
|
this.name,
|
||||||
this.name,
|
this.name,
|
||||||
result.file ?: return@mapNotNull null,
|
result.file ?: return@mapNotNull null,
|
||||||
type = if (result.type?.contains(
|
type = if (result.type?.contains("hls", ignoreCase = true) == true) ExtractorLinkType.M3U8 else INFER_TYPE,
|
||||||
"hls",
|
|
||||||
ignoreCase = true
|
|
||||||
) == true
|
|
||||||
) ExtractorLinkType.M3U8 else INFER_TYPE
|
|
||||||
) {
|
) {
|
||||||
this.referer = url
|
this.referer = url
|
||||||
this.quality =
|
this.quality = result.label?.replace("p", "", ignoreCase = true)?.trim()?.toIntOrNull()
|
||||||
result.label?.replace("p", "", ignoreCase = true)?.trim()?.toIntOrNull()
|
?: Qualities.Unknown.value
|
||||||
?: Qualities.Unknown.value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Serializable
|
||||||
|
data class JsonResponse(
|
||||||
|
@JsonProperty("status") @SerialName("status") val status: String? = null,
|
||||||
|
@JsonProperty("message") @SerialName("message") val message: String? = null,
|
||||||
|
@JsonProperty("type") @SerialName("type") val type: String? = null,
|
||||||
|
@JsonProperty("token") @SerialName("token") val token: String? = null,
|
||||||
|
@JsonProperty("result") @SerialName("result") val result: Map<String, Result>? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Result(
|
||||||
|
@JsonProperty("label") @SerialName("label") val label: String? = null,
|
||||||
|
@JsonProperty("file") @SerialName("file") val file: String? = null,
|
||||||
|
@JsonProperty("type") @SerialName("type") val type: String? = null,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import io.ktor.http.Url
|
import io.ktor.http.Url
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Streamplay : ExtractorApi() {
|
open class Streamplay : ExtractorApi() {
|
||||||
override val name = "Streamplay"
|
override val name = "Streamplay"
|
||||||
|
|
@ -18,37 +20,36 @@ open class Streamplay : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val request = app.get(url, referer = referer)
|
val request = app.get(url, referer = referer)
|
||||||
val redirectUrl = request.url
|
val redirectUrl = request.url
|
||||||
val mainServer = Url(redirectUrl).let { "${it.protocol.name}://${it.host}" }
|
val mainServer = Url(redirectUrl).let { "${it.protocol.name}://${it.host}" }
|
||||||
val key = redirectUrl.substringAfter("embed-").substringBefore(".html")
|
val key = redirectUrl.substringAfter("embed-").substringBefore(".html")
|
||||||
val token =
|
val token = request.document.select("script").find { it.data().contains("sitekey:") }?.data()
|
||||||
request.document.select("script").find { it.data().contains("sitekey:") }?.data()
|
?.substringAfterLast("sitekey: '")?.substringBefore("',")?.let { captchaKey ->
|
||||||
?.substringAfterLast("sitekey: '")?.substringBefore("',")?.let { captchaKey ->
|
getCaptchaToken(
|
||||||
getCaptchaToken(
|
redirectUrl,
|
||||||
redirectUrl,
|
captchaKey,
|
||||||
captchaKey,
|
referer = "$mainServer/",
|
||||||
referer = "$mainServer/"
|
)
|
||||||
)
|
} ?: throw ErrorLoadingException("can't bypass captcha")
|
||||||
} ?: throw ErrorLoadingException("can't bypass captcha")
|
|
||||||
app.post(
|
app.post(
|
||||||
"$mainServer/player-$key-488x286.html", data = mapOf(
|
"$mainServer/player-$key-488x286.html", data = mapOf(
|
||||||
"op" to "embed",
|
"op" to "embed",
|
||||||
"token" to token
|
"token" to token,
|
||||||
),
|
),
|
||||||
referer = redirectUrl,
|
referer = redirectUrl,
|
||||||
headers = mapOf(
|
headers = mapOf(
|
||||||
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||||
"Content-Type" to "application/x-www-form-urlencoded"
|
"Content-Type" to "application/x-www-form-urlencoded",
|
||||||
)
|
),
|
||||||
).document.select("script").find { script ->
|
).document.select("script").find { script ->
|
||||||
script.data().contains("eval(function(p,a,c,k,e,d)")
|
script.data().contains("eval(function(p,a,c,k,e,d)")
|
||||||
}?.let {
|
}?.let {
|
||||||
val data = getAndUnpack(it.data()).substringAfter("sources=[").substringBefore(",desc")
|
val data = getAndUnpack(it.data()).substringAfter("sources=[").substringBefore(",desc")
|
||||||
.replace("file", "\"file\"")
|
.replace("file", "\"file\"").replace("label", "\"label\"")
|
||||||
.replace("label", "\"label\"")
|
|
||||||
tryParseJson<List<Source>>("[$data}]")?.map { res ->
|
tryParseJson<List<Source>>("[$data}]")?.map { res ->
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
|
|
@ -57,24 +58,21 @@ open class Streamplay : ExtractorApi() {
|
||||||
res.file ?: return@map null,
|
res.file ?: return@map null,
|
||||||
) {
|
) {
|
||||||
this.referer = "$mainServer/"
|
this.referer = "$mainServer/"
|
||||||
|
this.headers = mapOf("Range" to "bytes=0-")
|
||||||
this.quality = when (res.label) {
|
this.quality = when (res.label) {
|
||||||
"HD" -> Qualities.P720.value
|
"HD" -> Qualities.P720.value
|
||||||
"SD" -> Qualities.P480.value
|
"SD" -> Qualities.P480.value
|
||||||
else -> Qualities.Unknown.value
|
else -> Qualities.Unknown.value
|
||||||
}
|
}
|
||||||
this.headers = mapOf(
|
|
||||||
"Range" to "bytes=0-"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Source(
|
data class Source(
|
||||||
@JsonProperty("file") val file: String? = null,
|
@JsonProperty("file") @SerialName("file") val file: String? = null,
|
||||||
@JsonProperty("label") val label: String? = null,
|
@JsonProperty("label") @SerialName("label") val label: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,68 +2,68 @@
|
||||||
|
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.api.Log
|
import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
|
||||||
open class TRsTX : ExtractorApi() {
|
open class TRsTX : ExtractorApi() {
|
||||||
override val name = "TRsTX"
|
override val name = "TRsTX"
|
||||||
override val mainUrl = "https://trstx.org"
|
override val mainUrl = "https://trstx.org"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
) {
|
||||||
val extRef = referer ?: ""
|
val extRef = referer ?: ""
|
||||||
|
val videoReq = app.get(url, referer = extRef).text
|
||||||
val videoReq = app.get(url, referer=extRef).text
|
val file = Regex("""file\":\"([^\"]+)""").find(videoReq)?.groupValues?.get(1) ?: throw ErrorLoadingException("File not found")
|
||||||
|
val postLink = "$mainUrl/" + file.replace("\\", "")
|
||||||
val file = Regex("""file\":\"([^\"]+)""").find(videoReq)?.groupValues?.get(1) ?: throw ErrorLoadingException("File not found")
|
val rawList = app.post(postLink, referer = extRef).parsedSafe<List<JsonElement>>() ?: throw ErrorLoadingException("Post link not found")
|
||||||
val postLink = "${mainUrl}/" + file.replace("\\", "")
|
|
||||||
val rawList = app.post(postLink, referer=extRef).parsedSafe<List<Any>>() ?: throw ErrorLoadingException("Post link not found")
|
|
||||||
|
|
||||||
val postJson: List<TrstxVideoData> = rawList.drop(1).map { item ->
|
val postJson: List<TrstxVideoData> = rawList.drop(1).map { item ->
|
||||||
val mapItem = item as Map<*, *>
|
val mapItem = item as Map<*, *>
|
||||||
TrstxVideoData(
|
TrstxVideoData(
|
||||||
title = mapItem["title"] as? String,
|
title = mapItem["title"] as? String,
|
||||||
file = mapItem["file"] as? String
|
file = mapItem["file"] as? String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val vidLinks = mutableSetOf<String>()
|
val vidLinks = mutableSetOf<String>()
|
||||||
val vidMap = mutableListOf<Map<String, String>>()
|
val vidMap = mutableListOf<Map<String, String>>()
|
||||||
for (item in postJson) {
|
for (item in postJson) {
|
||||||
if (item.file == null || item.title == null) continue
|
if (item.file == null || item.title == null) continue
|
||||||
|
val fileUrl = "$mainUrl/playlist/" + item.file.substring(1) + ".txt"
|
||||||
val fileUrl = "${mainUrl}/playlist/" + item.file.substring(1) + ".txt"
|
val videoData = app.post(fileUrl, referer = extRef).text
|
||||||
val videoData = app.post(fileUrl, referer=extRef).text
|
if (videoData in vidLinks) continue
|
||||||
|
|
||||||
if (videoData in vidLinks) { continue }
|
|
||||||
vidLinks.add(videoData)
|
vidLinks.add(videoData)
|
||||||
|
|
||||||
vidMap.add(mapOf(
|
vidMap.add(mapOf(
|
||||||
"title" to item.title,
|
"title" to item.title,
|
||||||
"videoData" to videoData
|
"videoData" to videoData,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
for (mapEntry in vidMap) {
|
for (mapEntry in vidMap) {
|
||||||
val title = mapEntry["title"] ?: continue
|
val title = mapEntry["title"] ?: continue
|
||||||
val m3uLink = mapEntry["videoData"] ?: continue
|
val m3uLink = mapEntry["videoData"] ?: continue
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = "${this.name} - ${title}",
|
name = "${this.name} - $title",
|
||||||
url = m3uLink,
|
url = m3uLink,
|
||||||
) {
|
) { this.referer = extRef }
|
||||||
this.referer = extRef
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class TrstxVideoData(
|
data class TrstxVideoData(
|
||||||
@JsonProperty("title") val title: String? = null,
|
@JsonProperty("title") @SerialName("title") val title: String? = null,
|
||||||
@JsonProperty("file") val file: String? = null
|
@JsonProperty("file") @SerialName("file") val file: String? = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,38 +6,42 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Tantifilm : ExtractorApi() {
|
open class Tantifilm : ExtractorApi() {
|
||||||
override var name = "Tantifilm"
|
override val name = "Tantifilm"
|
||||||
override var mainUrl = "https://cercafilm.net"
|
override val mainUrl = "https://cercafilm.net"
|
||||||
override val requiresReferer = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
data class TantifilmJsonData (
|
|
||||||
@JsonProperty("success") val success : Boolean,
|
|
||||||
@JsonProperty("data") val data : List<TantifilmData>,
|
|
||||||
@JsonProperty("captions")val captions : List<String>,
|
|
||||||
@JsonProperty("is_vr") val is_vr : Boolean
|
|
||||||
)
|
|
||||||
|
|
||||||
data class TantifilmData (
|
|
||||||
@JsonProperty("file") val file : String,
|
|
||||||
@JsonProperty("label") val label : String,
|
|
||||||
@JsonProperty("type") val type : String
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||||
val link = "$mainUrl/api/source/${url.substringAfterLast("/")}"
|
val link = "$mainUrl/api/source/${url.substringAfterLast("/")}"
|
||||||
val response = app.post(link).text.replace("""\""","")
|
val response = app.post(link).text.replace("""\""","")
|
||||||
val jsonvideodata = parseJson<TantifilmJsonData>(response)
|
val jsonVideoData = parseJson<TantifilmJsonData>(response)
|
||||||
return jsonvideodata.data.map {
|
return jsonVideoData.data.map {
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
this.name,
|
this.name,
|
||||||
this.name,
|
this.name,
|
||||||
it.file+".${it.type}"
|
it.file + ".${it.type}",
|
||||||
) {
|
) {
|
||||||
this.referer = mainUrl
|
this.referer = mainUrl
|
||||||
this.quality = it.label.filter{ it.isDigit() }.toInt()
|
this.quality = it.label.filter{ it.isDigit() }.toInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Serializable
|
||||||
|
data class TantifilmJsonData(
|
||||||
|
@JsonProperty("success") @SerialName("success") val success: Boolean,
|
||||||
|
@JsonProperty("data") @SerialName("data") val data: List<TantifilmData>,
|
||||||
|
@JsonProperty("captions") @SerialName("captions") val captions: List<String>,
|
||||||
|
@JsonProperty("is_vr") @SerialName("is_vr") val isVr: Boolean,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TantifilmData(
|
||||||
|
@JsonProperty("file") @SerialName("file") val file: String,
|
||||||
|
@JsonProperty("label") @SerialName("label") val label: String,
|
||||||
|
@JsonProperty("type") @SerialName("type") val type: String,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,35 @@
|
||||||
|
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.api.Log
|
import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class TauVideo : ExtractorApi() {
|
open class TauVideo : ExtractorApi() {
|
||||||
override val name = "TauVideo"
|
override val name = "TauVideo"
|
||||||
override val mainUrl = "https://tau-video.xyz"
|
override val mainUrl = "https://tau-video.xyz"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
val extRef = referer ?: ""
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
|
) {
|
||||||
|
val extRef = referer ?: ""
|
||||||
val videoKey = url.split("/").last()
|
val videoKey = url.split("/").last()
|
||||||
val videoUrl = "${mainUrl}/api/video/${videoKey}"
|
val videoUrl = "$mainUrl/api/video/$videoKey"
|
||||||
|
|
||||||
val api = app.get(videoUrl).parsedSafe<TauVideoUrls>() ?: throw ErrorLoadingException("TauVideo")
|
val api = app.get(videoUrl).parsedSafe<TauVideoUrls>() ?: throw ErrorLoadingException("TauVideo")
|
||||||
|
|
||||||
for (video in api.urls) {
|
for (video in api.urls) {
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
url = video.url,
|
url = video.url,
|
||||||
) {
|
) {
|
||||||
this.referer = extRef
|
this.referer = extRef
|
||||||
this.quality = getQualityFromName(video.label)
|
this.quality = getQualityFromName(video.label)
|
||||||
|
|
@ -33,12 +39,14 @@ open class TauVideo : ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class TauVideoUrls(
|
data class TauVideoUrls(
|
||||||
@JsonProperty("urls") val urls: List<TauVideoData>
|
@JsonProperty("urls") @SerialName("urls") val urls: List<TauVideoData>,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class TauVideoData(
|
data class TauVideoData(
|
||||||
@JsonProperty("url") val url: String,
|
@JsonProperty("url") @SerialName("url") val url: String,
|
||||||
@JsonProperty("label") val label: String,
|
@JsonProperty("label") @SerialName("label") val label: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,6 @@ package com.lagradost.cloudstream3.extractors
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import org.mozilla.javascript.Context
|
|
||||||
import org.mozilla.javascript.EvaluatorException
|
|
||||||
import org.mozilla.javascript.Scriptable
|
|
||||||
|
|
||||||
open class Userload : ExtractorApi() {
|
open class Userload : ExtractorApi() {
|
||||||
override var name = "Userload"
|
override var name = "Userload"
|
||||||
|
|
@ -32,20 +29,11 @@ open class Userload : ExtractorApi() {
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun evaluateMath(mathExpression : String): String {
|
private suspend fun evaluateMath(mathExpression: String): String {
|
||||||
val rhino = Context.enter()
|
return jsValueToString(evalJs("eval($mathExpression)"))
|
||||||
rhino.initStandardObjects()
|
|
||||||
rhino.setInterpretedMode(true)
|
|
||||||
val scope: Scriptable = rhino.initStandardObjects()
|
|
||||||
return try {
|
|
||||||
rhino.evaluateString(scope, "eval($mathExpression)", "JavaScript", 1, null).toString()
|
|
||||||
}
|
|
||||||
catch (e: EvaluatorException){
|
|
||||||
""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun decodeVideoJs(text: String): List<String> {
|
private suspend fun decodeVideoJs(text: String): List<String> {
|
||||||
text.replace("""\s+|/\*.*?\*/""".toRegex(), "")
|
text.replace("""\s+|/\*.*?\*/""".toRegex(), "")
|
||||||
val data = text.split("""+(゚Д゚)[゚o゚]""")[1]
|
val data = text.split("""+(゚Д゚)[゚o゚]""")[1]
|
||||||
val chars = data.split("""+ (゚Д゚)[゚ε゚]+""").drop(1)
|
val chars = data.split("""+ (゚Д゚)[゚ε゚]+""").drop(1)
|
||||||
|
|
@ -68,22 +56,16 @@ open class Userload : ExtractorApi() {
|
||||||
subchar.add(splitInput(v).map { evaluateMath(it).substringBefore(".") }.toString().filter { it.isDigit() })
|
subchar.add(splitInput(v).map { evaluateMath(it).substringBefore(".") }.toString().filter { it.isDigit() })
|
||||||
}
|
}
|
||||||
var txtresult = ""
|
var txtresult = ""
|
||||||
subchar.forEach{
|
subchar.forEach {
|
||||||
txtresult = txtresult.plus(it.toInt(8).toChar())
|
txtresult = txtresult.plus(it.toInt(8).toChar())
|
||||||
}
|
}
|
||||||
val val1 = Regex(""""morocco="((.|\\n)*?)"&mycountry="""").find(txtresult)?.groups?.get(1)?.value.toString().drop(1).dropLast(1)
|
val val1 = Regex(""""morocco="((.|\\n)*?)"&mycountry="""").find(txtresult)?.groups?.get(1)?.value.toString().drop(1).dropLast(1)
|
||||||
val val2 = txtresult.substringAfter("""&mycountry="+""").substringBefore(")")
|
val val2 = txtresult.substringAfter("""&mycountry="+""").substringBefore(")")
|
||||||
|
|
||||||
return listOf(
|
return listOf(val1, val2)
|
||||||
val1,
|
|
||||||
val2
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink>? {
|
||||||
|
|
||||||
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
|
val extractedLinksList: MutableList<ExtractorLink> = mutableListOf()
|
||||||
|
|
||||||
val response = app.get(url).text
|
val response = app.get(url).text
|
||||||
|
|
@ -113,4 +95,4 @@ open class Userload : ExtractorApi() {
|
||||||
|
|
||||||
return extractedLinksList
|
return extractedLinksList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,51 +3,51 @@ package com.lagradost.cloudstream3.extractors
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
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.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Uservideo : ExtractorApi() {
|
open class Uservideo : ExtractorApi() {
|
||||||
override val name: String = "Uservideo"
|
override val name = "Uservideo"
|
||||||
override val mainUrl: String = "https://uservideo.xyz"
|
override val mainUrl = "https://uservideo.xyz"
|
||||||
override val requiresReferer = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val script = app.get(url).document.selectFirst("script:containsData(hosts =)")?.data()
|
val script = app.get(url).document.selectFirst("script:containsData(hosts =)")?.data()
|
||||||
val host = script?.substringAfter("hosts = [\"")?.substringBefore("\"];")
|
val host = script?.substringAfter("hosts = [\"")?.substringBefore("\"];")
|
||||||
val servers = script?.substringAfter("servers = \"")?.substringBefore("\";")
|
val servers = script?.substringAfter("servers = \"")?.substringBefore("\";")
|
||||||
|
|
||||||
val sources = app.get("$host/s/$servers").text.substringAfter("\"sources\":[").substringBefore("],").let {
|
|
||||||
AppUtils.tryParseJson<List<Sources>>("[$it]")
|
|
||||||
}
|
|
||||||
val quality = Regex("(\\d{3,4})[Pp]").find(url)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
val quality = Regex("(\\d{3,4})[Pp]").find(url)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||||
|
val sources = app.get("$host/s/$servers").text.substringAfter("\"sources\":[").substringBefore("],").let {
|
||||||
|
tryParseJson<List<Sources>>("[$it]")
|
||||||
|
}
|
||||||
|
|
||||||
sources?.map { source ->
|
sources?.map { source ->
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
name,
|
name,
|
||||||
name,
|
name,
|
||||||
source.src ?: return@map null
|
source.src ?: return@map null,
|
||||||
) {
|
) {
|
||||||
this.referer = url
|
this.referer = url
|
||||||
this.quality = quality ?: Qualities.Unknown.value
|
this.quality = quality ?: Qualities.Unknown.value
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class Sources(
|
data class Sources(
|
||||||
@JsonProperty("src") val src: String? = null,
|
@JsonProperty("src") @SerialName("src") val src: String? = null,
|
||||||
@JsonProperty("type") val type: String? = null,
|
@JsonProperty("type") @SerialName("type") val type: String? = null,
|
||||||
@JsonProperty("label") val label: String? = null,
|
@JsonProperty("label") @SerialName("label") val label: String? = null,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -8,25 +8,25 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class Vicloud : ExtractorApi() {
|
open class Vicloud : ExtractorApi() {
|
||||||
override val name: String = "Vicloud"
|
override val name = "Vicloud"
|
||||||
override val mainUrl: String = "https://vicloud.sbs"
|
override val mainUrl = "https://vicloud.sbs"
|
||||||
override val requiresReferer = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val id = Regex("\"apiQuery\":\"(.*?)\"").find(app.get(url).text)?.groupValues?.getOrNull(1)
|
val id = Regex("\"apiQuery\":\"(.*?)\"").find(app.get(url).text)?.groupValues?.getOrNull(1)
|
||||||
app.get(
|
app.get(
|
||||||
"$mainUrl/api/?$id=&_=$unixTimeMS",
|
"$mainUrl/api/?$id=&_=$unixTimeMS",
|
||||||
headers = mapOf(
|
headers = mapOf("X-Requested-With" to "XMLHttpRequest"),
|
||||||
"X-Requested-With" to "XMLHttpRequest"
|
referer = url,
|
||||||
),
|
|
||||||
referer = url
|
|
||||||
).parsedSafe<Responses>()?.sources?.map { source ->
|
).parsedSafe<Responses>()?.sources?.map { source ->
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
|
|
@ -39,16 +39,16 @@ open class Vicloud : ExtractorApi() {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
private data class Sources(
|
private data class Sources(
|
||||||
@JsonProperty("file") val file: String? = null,
|
@JsonProperty("file") @SerialName("file") val file: String? = null,
|
||||||
@JsonProperty("label") val label: String? = null,
|
@JsonProperty("label") @SerialName("label") val label: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
private data class Responses(
|
private data class Responses(
|
||||||
@JsonProperty("sources") val sources: List<Sources>? = arrayListOf(),
|
@JsonProperty("sources") @SerialName("sources") val sources: List<Sources>? = arrayListOf(),
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -44,27 +44,29 @@ class VidaraSo : Vidara() {
|
||||||
}
|
}
|
||||||
|
|
||||||
open class Vidara : ExtractorApi() {
|
open class Vidara : ExtractorApi() {
|
||||||
override val name: String = "Vidara"
|
override val name = "Vidara"
|
||||||
override val mainUrl = "https://vidara.to"
|
override val mainUrl = "https://vidara.to"
|
||||||
override val requiresReferer: Boolean = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val fileCode = url.substringAfterLast("/")
|
val fileCode = url.substringAfterLast("/")
|
||||||
val fileInfo =
|
val fileInfo = app.post(
|
||||||
app.post("$mainUrl/api/stream", json = mapOf("filecode" to fileCode, "device" to "web"))
|
"$mainUrl/api/stream", json = mapOf(
|
||||||
.parsed<StreamUpFileInfo>()
|
"filecode" to fileCode,
|
||||||
|
"device" to "web"
|
||||||
|
)
|
||||||
|
).parsed<StreamUpFileInfo>()
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = name,
|
source = name,
|
||||||
name = name,
|
name = name,
|
||||||
url = fileInfo.streamingUrl,
|
url = fileInfo.streamingUrl,
|
||||||
type = ExtractorLinkType.M3U8
|
type = ExtractorLinkType.M3U8,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -77,19 +79,15 @@ open class Vidara : ExtractorApi() {
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
private data class StreamUpFileInfo(
|
private data class StreamUpFileInfo(
|
||||||
val title: String,
|
@JsonProperty("title") @SerialName("title") val title: String,
|
||||||
val thumbnail: String,
|
@JsonProperty("thumbnail") @SerialName("thumbnail") val thumbnail: String,
|
||||||
@SerialName("streaming_url")
|
@JsonProperty("streaming_url") @SerialName("streaming_url") val streamingUrl: String,
|
||||||
@JsonProperty("streaming_url")
|
@JsonProperty("subtitles") @SerialName("subtitles") val subtitles: List<StreamUpSubtitle>?,
|
||||||
val streamingUrl: String,
|
|
||||||
val subtitles: List<StreamUpSubtitle>?
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
private data class StreamUpSubtitle(
|
private data class StreamUpSubtitle(
|
||||||
@SerialName("file_path")
|
@JsonProperty("file_path") @SerialName("file_path") val filePath: String,
|
||||||
@JsonProperty("file_path")
|
@JsonProperty("language") @SerialName("language") val language: String,
|
||||||
val filePath: String,
|
|
||||||
val language: String,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,27 +7,32 @@ import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
open class VideoSeyred : ExtractorApi() {
|
open class VideoSeyred : ExtractorApi() {
|
||||||
override val name = "VideoSeyred"
|
override val name = "VideoSeyred"
|
||||||
override val mainUrl = "https://videoseyred.in"
|
override val mainUrl = "https://videoseyred.in"
|
||||||
override val requiresReferer = true
|
override val requiresReferer = true
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
|
override suspend fun getUrl(
|
||||||
val extRef = referer ?: ""
|
url: String,
|
||||||
val videoId = url.substringAfter("embed/").substringBefore("?")
|
referer: String?,
|
||||||
val videoUrl = "${mainUrl}/playlist/${videoId}.json"
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit,
|
||||||
val responseRaw = app.get(videoUrl)
|
) {
|
||||||
val responseList: List<VideoSeyredSource> = tryParseJson<List<VideoSeyredSource>>(responseRaw.text) ?: throw ErrorLoadingException("VideoSeyred")
|
val extRef = referer ?: ""
|
||||||
val response = responseList[0]
|
val videoId = url.substringAfter("embed/").substringBefore("?")
|
||||||
|
val videoUrl = "$mainUrl/playlist/$videoId.json"
|
||||||
|
val responseRaw = app.get(videoUrl)
|
||||||
|
val responseList = tryParseJson<List<VideoSeyredSource>>(responseRaw.text) ?: throw ErrorLoadingException("VideoSeyred")
|
||||||
|
val response = responseList[0]
|
||||||
for (track in response.tracks) {
|
for (track in response.tracks) {
|
||||||
if (track.label != null && track.kind == "captions") {
|
if (track.label != null && track.kind == "captions") {
|
||||||
subtitleCallback.invoke(
|
subtitleCallback.invoke(
|
||||||
newSubtitleFile(
|
newSubtitleFile(
|
||||||
lang = track.label,
|
lang = track.label,
|
||||||
url = fixUrl(track.file)
|
url = fixUrl(track.file),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -36,35 +41,38 @@ open class VideoSeyred : ExtractorApi() {
|
||||||
for (source in response.sources) {
|
for (source in response.sources) {
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = this.name,
|
source = this.name,
|
||||||
name = this.name,
|
name = this.name,
|
||||||
url = source.file,
|
url = source.file,
|
||||||
) {
|
) {
|
||||||
this.referer = "${mainUrl}/"
|
this.referer = "$mainUrl/"
|
||||||
this.quality = Qualities.Unknown.value
|
this.quality = Qualities.Unknown.value
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class VideoSeyredSource(
|
data class VideoSeyredSource(
|
||||||
@JsonProperty("image") val image: String,
|
@JsonProperty("image") @SerialName("image") val image: String,
|
||||||
@JsonProperty("title") val title: String,
|
@JsonProperty("title") @SerialName("title") val title: String,
|
||||||
@JsonProperty("sources") val sources: List<VSSource>,
|
@JsonProperty("sources") @SerialName("sources") val sources: List<VSSource>,
|
||||||
@JsonProperty("tracks") val tracks: List<VSTrack>
|
@JsonProperty("tracks") @SerialName("tracks") val tracks: List<VSTrack>,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class VSSource(
|
data class VSSource(
|
||||||
@JsonProperty("file") val file: String,
|
@JsonProperty("file") @SerialName("file") val file: String,
|
||||||
@JsonProperty("type") val type: String,
|
@JsonProperty("type") @SerialName("type") val type: String,
|
||||||
@JsonProperty("default") val default: String
|
@JsonProperty("default") @SerialName("default") val default: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class VSTrack(
|
data class VSTrack(
|
||||||
@JsonProperty("file") val file: String,
|
@JsonProperty("file") @SerialName("file") val file: String,
|
||||||
@JsonProperty("kind") val kind: String,
|
@JsonProperty("kind") @SerialName("kind") val kind: String,
|
||||||
@JsonProperty("language") val language: String? = null,
|
@JsonProperty("language") @SerialName("language") val language: String? = null,
|
||||||
@JsonProperty("label") val label: String? = null,
|
@JsonProperty("label") @SerialName("label") val label: String? = null,
|
||||||
@JsonProperty("default") val default: String? = null
|
@JsonProperty("default") @SerialName("default") val default: String? = null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,26 +4,28 @@ import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.api.Log
|
import com.lagradost.api.Log
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
import com.lagradost.cloudstream3.utils.getQualityFromName
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
class Videzz: Vidoza() {
|
class Videzz : Vidoza() {
|
||||||
override val mainUrl: String = "https://videzz.net"
|
override val mainUrl = "https://videzz.net"
|
||||||
}
|
}
|
||||||
|
|
||||||
open class Vidoza: ExtractorApi() {
|
open class Vidoza : ExtractorApi() {
|
||||||
override val name: String = "Vidoza"
|
override val name = "Vidoza"
|
||||||
override val mainUrl: String = "https://vidoza.net"
|
override val mainUrl = "https://vidoza.net"
|
||||||
override val requiresReferer: Boolean = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val response = app.get(url).document
|
val response = app.get(url).document
|
||||||
val script = response.selectFirst("script:containsData(sourcesCode)")?.data()
|
val script = response.selectFirst("script:containsData(sourcesCode)")?.data()
|
||||||
|
|
@ -32,31 +34,27 @@ open class Vidoza: ExtractorApi() {
|
||||||
// e.g. sourcesCode: [{ src: "https://str38.vidoza.net/vod/v2/.../v.mp4", type: "video/mp4", label:"SD", res:"720"}],
|
// e.g. sourcesCode: [{ src: "https://str38.vidoza.net/vod/v2/.../v.mp4", type: "video/mp4", label:"SD", res:"720"}],
|
||||||
var sourcesArray = script.substringAfter("sourcesCode:").substringBefore("\n")
|
var sourcesArray = script.substringAfter("sourcesCode:").substringBefore("\n")
|
||||||
arrayOf("src", "type", "label", "res").forEach {
|
arrayOf("src", "type", "label", "res").forEach {
|
||||||
// add missing quotation marks, e.g. src: "https..." -> "src": "https..."
|
// Add missing quotation marks, e.g. src: "https..." -> "src": "https..."
|
||||||
sourcesArray = sourcesArray
|
sourcesArray = sourcesArray.replace(Regex(""""?$it"?:"""), """"$it":""")
|
||||||
.replace(Regex(""""?$it"?:"""), """"$it":""")
|
|
||||||
}
|
}
|
||||||
val videoData = AppUtils.parseJson<VinovoDataList>(sourcesArray)
|
|
||||||
|
|
||||||
|
val videoData = parseJson<ArrayList<VinovoVideoData>>(sourcesArray)
|
||||||
for (stream in videoData) {
|
for (stream in videoData) {
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = name,
|
source = name,
|
||||||
name = name,
|
name = name,
|
||||||
url = stream.source
|
url = stream.source,
|
||||||
) {
|
) { quality = getQualityFromName(stream.resolution) }
|
||||||
quality = getQualityFromName(stream.resolution)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class VinovoDataList: ArrayList<VinovoVideoData>()
|
@Serializable
|
||||||
|
|
||||||
private data class VinovoVideoData(
|
private data class VinovoVideoData(
|
||||||
@JsonProperty("src") val source: String,
|
@JsonProperty("src") @SerialName("src") val source: String,
|
||||||
@JsonProperty("type") val type: String?,
|
@JsonProperty("type") @SerialName("type") val type: String?,
|
||||||
@JsonProperty("label") val label: String?,
|
@JsonProperty("label") @SerialName("label") val label: String?,
|
||||||
@JsonProperty("res") val resolution: String?,
|
@JsonProperty("res") @SerialName("res") val resolution: String?,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
|
||||||
@Prerelease
|
|
||||||
open class Vids : ExtractorApi() {
|
open class Vids : ExtractorApi() {
|
||||||
override val name: String = "Vids"
|
override val name: String = "Vids"
|
||||||
override val mainUrl: String = "https://vids.st"
|
override val mainUrl: String = "https://vids.st"
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,33 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.APIHolder
|
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
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.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
class VinovoSi : VinovoTo() {
|
class VinovoSi : VinovoTo() {
|
||||||
override var name = "VinovoSi"
|
override val name = "VinovoSi"
|
||||||
override var mainUrl = "https://vinovo.si"
|
override val mainUrl = "https://vinovo.si"
|
||||||
}
|
}
|
||||||
|
|
||||||
open class VinovoTo : ExtractorApi() {
|
open class VinovoTo : ExtractorApi() {
|
||||||
override val mainUrl: String = "https://vinovo.to"
|
override val mainUrl = "https://vinovo.to"
|
||||||
override val name: String = "VinovoTo"
|
override val name = "VinovoTo"
|
||||||
override val requiresReferer: Boolean = false
|
override val requiresReferer = false
|
||||||
|
|
||||||
override suspend fun getUrl(
|
override suspend fun getUrl(
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val fixedUrl = url.replace("/d/", "/e/")
|
val fixedUrl = url.replace("/d/", "/e/")
|
||||||
|
|
||||||
val resp = app.get(fixedUrl, referer = referer)
|
val resp = app.get(fixedUrl, referer = referer)
|
||||||
val doc = resp.document
|
val doc = resp.document
|
||||||
|
|
||||||
|
|
@ -35,21 +36,20 @@ open class VinovoTo : ExtractorApi() {
|
||||||
val fileCode = doc.selectFirst("meta[name=\"file_code\"]")?.attr("content") ?: return
|
val fileCode = doc.selectFirst("meta[name=\"file_code\"]")?.attr("content") ?: return
|
||||||
|
|
||||||
val captchaToken = doc.selectFirst("meta[name=recaptcha]")?.attr("content") ?: return
|
val captchaToken = doc.selectFirst("meta[name=recaptcha]")?.attr("content") ?: return
|
||||||
val captchaSolution =
|
val captchaSolution = getCaptchaToken(fixedUrl, captchaToken, "$mainUrl/") ?: return
|
||||||
APIHolder.getCaptchaToken(fixedUrl, captchaToken, "$mainUrl/") ?: return
|
|
||||||
|
|
||||||
val streamInfo = app.post(
|
val streamInfo = app.post(
|
||||||
url = "$mainUrl/api/file/url/$fileCode",
|
url = "$mainUrl/api/file/url/$fileCode",
|
||||||
data = mapOf("token" to videoToken, "recaptcha" to captchaSolution),
|
data = mapOf("token" to videoToken, "recaptcha" to captchaSolution),
|
||||||
headers = mapOf(
|
headers = mapOf(
|
||||||
"Origin" to mainUrl,
|
"Origin" to mainUrl,
|
||||||
"X-Requested-With" to "XMLHttpRequest"
|
"X-Requested-With" to "XMLHttpRequest",
|
||||||
),
|
),
|
||||||
cookies = resp.cookies,
|
cookies = resp.cookies,
|
||||||
referer = fixedUrl
|
referer = fixedUrl,
|
||||||
).parsed<VinovoFileResp>()
|
).parsed<VinovoFileResp>()
|
||||||
val fileUrl = "$videoBaseUrl/stream/${streamInfo.token}"
|
|
||||||
|
|
||||||
|
val fileUrl = "$videoBaseUrl/stream/${streamInfo.token}"
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(source = name, name = name, url = fileUrl) {
|
newExtractorLink(source = name, name = name, url = fileUrl) {
|
||||||
val dataTitle = doc.selectFirst("video")?.attr("data-title").orEmpty()
|
val dataTitle = doc.selectFirst("video")?.attr("data-title").orEmpty()
|
||||||
|
|
@ -59,8 +59,9 @@ open class VinovoTo : ExtractorApi() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
private data class VinovoFileResp(
|
private data class VinovoFileResp(
|
||||||
@JsonProperty("status") val status: String,
|
@JsonProperty("status") @SerialName("status") val status: String,
|
||||||
@JsonProperty("token") val token: String,
|
@JsonProperty("token") @SerialName("token") val token: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
package com.lagradost.cloudstream3.extractors
|
||||||
|
|
||||||
import com.google.gson.JsonObject
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.google.gson.JsonParser
|
|
||||||
import com.lagradost.cloudstream3.SubtitleFile
|
import com.lagradost.cloudstream3.SubtitleFile
|
||||||
import com.lagradost.cloudstream3.app
|
import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.base64Decode
|
import com.lagradost.cloudstream3.base64Decode
|
||||||
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.INFER_TYPE
|
import com.lagradost.cloudstream3.utils.INFER_TYPE
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
import com.lagradost.cloudstream3.utils.Qualities
|
import com.lagradost.cloudstream3.utils.Qualities
|
||||||
import com.lagradost.cloudstream3.utils.newExtractorLink
|
import com.lagradost.cloudstream3.utils.newExtractorLink
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
class Tubeless : Voe() {
|
class Tubeless : Voe() {
|
||||||
override val name = "Tubeless"
|
override val name = "Tubeless"
|
||||||
|
|
@ -19,12 +21,12 @@ class Tubeless : Voe() {
|
||||||
|
|
||||||
class Simpulumlamerop : Voe() {
|
class Simpulumlamerop : Voe() {
|
||||||
override val name = "Simplum"
|
override val name = "Simplum"
|
||||||
override var mainUrl = "https://simpulumlamerop.com"
|
override val mainUrl = "https://simpulumlamerop.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
class Urochsunloath : Voe() {
|
class Urochsunloath : Voe() {
|
||||||
override val name = "Uroch"
|
override val name = "Uroch"
|
||||||
override var mainUrl = "https://urochsunloath.com"
|
override val mainUrl = "https://urochsunloath.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
class NathanFromSubject : Voe() {
|
class NathanFromSubject : Voe() {
|
||||||
|
|
@ -33,7 +35,7 @@ class NathanFromSubject : Voe() {
|
||||||
|
|
||||||
class Yipsu : Voe() {
|
class Yipsu : Voe() {
|
||||||
override val name = "Yipsu"
|
override val name = "Yipsu"
|
||||||
override var mainUrl = "https://yip.su"
|
override val mainUrl = "https://yip.su"
|
||||||
}
|
}
|
||||||
|
|
||||||
class MetaGnathTuggers : Voe() {
|
class MetaGnathTuggers : Voe() {
|
||||||
|
|
@ -59,38 +61,43 @@ open class Voe : ExtractorApi() {
|
||||||
url: String,
|
url: String,
|
||||||
referer: String?,
|
referer: String?,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
var res = app.get(url, referer = referer)
|
var res = app.get(url, referer = referer)
|
||||||
val redirectUrl = redirectRegex.find(res.document.data())?.groupValues?.get(1)
|
val redirectUrl = redirectRegex.find(res.document.data())?.groupValues?.get(1)
|
||||||
if (redirectUrl != null) {
|
if (redirectUrl != null) {
|
||||||
res = app.get(redirectUrl, referer = referer)
|
res = app.get(redirectUrl, referer = referer)
|
||||||
}
|
}
|
||||||
val encodedString = res.document.selectFirst("script[type=application/json]")?.data()?.trim()?.substringAfter("[\"")?.substringBeforeLast("\"]")
|
|
||||||
|
val encodedString = res.document.selectFirst("script[type=application/json]")
|
||||||
|
?.data()?.trim()
|
||||||
|
?.substringAfter("[\"")
|
||||||
|
?.substringBeforeLast("\"]")
|
||||||
|
|
||||||
if (encodedString == null) {
|
if (encodedString == null) {
|
||||||
println("encoded string not found.")
|
println("encoded string not found.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val decryptedJson = decryptF7(encodedString)
|
|
||||||
val m3u8 = decryptedJson.get("source")?.asString
|
|
||||||
val mp4 = decryptedJson.get("direct_access_url")?.asString
|
|
||||||
|
|
||||||
|
val decryptedJson = decryptF7(encodedString)
|
||||||
|
val m3u8 = decryptedJson?.source
|
||||||
|
val mp4 = decryptedJson?.directAccessUrl
|
||||||
if (m3u8 != null) {
|
if (m3u8 != null) {
|
||||||
M3u8Helper.generateM3u8(
|
M3u8Helper.generateM3u8(
|
||||||
name,
|
name,
|
||||||
m3u8,
|
m3u8,
|
||||||
"$mainUrl/",
|
"$mainUrl/",
|
||||||
headers = mapOf("Origin" to "$mainUrl/")
|
headers = mapOf("Origin" to "$mainUrl/"),
|
||||||
).forEach(callback)
|
).forEach(callback)
|
||||||
}
|
}
|
||||||
if (mp4!=null)
|
|
||||||
{
|
if (mp4 != null) {
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
newExtractorLink(
|
newExtractorLink(
|
||||||
source = "$name MP4",
|
source = "$name MP4",
|
||||||
name = "$name MP4",
|
name = "$name MP4",
|
||||||
url = mp4,
|
url = mp4,
|
||||||
INFER_TYPE
|
INFER_TYPE,
|
||||||
) {
|
) {
|
||||||
this.referer = url
|
this.referer = url
|
||||||
this.quality = Qualities.Unknown.value
|
this.quality = Qualities.Unknown.value
|
||||||
|
|
@ -99,20 +106,19 @@ open class Voe : ExtractorApi() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun decryptF7(p8: String): JsonObject {
|
private fun decryptF7(p8: String): VoeDecrypted? {
|
||||||
return try {
|
return try {
|
||||||
val vF = rot13(p8)
|
val vF = rot13(p8)
|
||||||
val vF2 = replacePatterns(vF)
|
val vF2 = replacePatterns(vF)
|
||||||
val vF3 = removeUnderscores(vF2)
|
val vF3 = removeUnderscores(vF2)
|
||||||
val vF4 = base64Decode(vF3)
|
val vF4 = base64Decode(vF3)
|
||||||
val vF5 = charShift(vF4, 3)
|
val vF5 = charShift(vF4, 3)
|
||||||
val vF6 = reverse(vF5)
|
val vF6 = vF5.reversed()
|
||||||
val vAtob = base64Decode(vF6)
|
val vAtob = base64Decode(vF6)
|
||||||
|
parseJson<VoeDecrypted>(vAtob)
|
||||||
JsonParser.parseString(vAtob).asJsonObject
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
println("Decryption error: ${e.message}")
|
println("Decryption error: ${e.message}")
|
||||||
JsonObject()
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,6 +145,9 @@ open class Voe : ExtractorApi() {
|
||||||
return input.map { (it.code - shift).toChar() }.joinToString("")
|
return input.map { (it.code - shift).toChar() }.joinToString("")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun reverse(input: String): String = input.reversed()
|
@Serializable
|
||||||
|
private data class VoeDecrypted(
|
||||||
|
@JsonProperty("source") @SerialName("source") val source: String? = null,
|
||||||
|
@JsonProperty("direct_access_url") @SerialName("direct_access_url") val directAccessUrl: String? = null,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue