Made source dialog fullscreen and added some Extractors

This commit is contained in:
Blatzar 2023-01-29 23:51:25 +01:00
parent fd2648df45
commit 6e9b1cb855
5 changed files with 42 additions and 18 deletions

View file

@ -1,32 +1,51 @@
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.SubtitleFile
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.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import java.net.URI
class FileMoon : Filesim() {
override val mainUrl = "https://filemoon.to"
override val name = "FileMoon"
}
open class Filesim : ExtractorApi() { open class Filesim : ExtractorApi() {
override val name = "Filesim" override val name = "Filesim"
override val mainUrl = "https://files.im" override val mainUrl = "https://files.im"
override val requiresReferer = false override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> { override suspend fun getUrl(
val sources = mutableListOf<ExtractorLink>() url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
with(app.get(url).document) { with(app.get(url).document) {
this.select("script").map { script -> this.select("script").forEach { script ->
if (script.data().contains("eval(function(p,a,c,k,e,d)")) { if (script.data().contains("eval(function(p,a,c,k,e,d)")) {
val data = getAndUnpack(script.data()).substringAfter("sources:[").substringBefore("]") val data = getAndUnpack(script.data())
tryParseJson<List<ResponseSource>>("[$data]")?.map { val foundData = Regex("""sources:\[(.*?)]""").find(data)?.groupValues?.get(1) ?: return@forEach
M3u8Helper.generateM3u8( val fixedData = foundData.replace("file:", """"file":""")
name,
it.file, parseJson<List<ResponseSource>>("[$fixedData]").forEach {
"$mainUrl/", callback.invoke(
).forEach { m3uData -> sources.add(m3uData) } ExtractorLink(
name,
name,
it.file,
"$mainUrl/",
Qualities.Unknown.value,
URI(it.file).path.endsWith(".m3u8")
)
)
} }
} }
} }
} }
return sources
} }
private data class ResponseSource( private data class ResponseSource(

View file

@ -6,6 +6,11 @@ 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.*
class Vanfem : GuardareStream() {
override var name = "Vanfem"
override var mainUrl = "https://vanfem.com/"
}
class CineGrabber : GuardareStream() { class CineGrabber : GuardareStream() {
override var name = "CineGrabber" override var name = "CineGrabber"
override var mainUrl = "https://cinegrabber.com" override var mainUrl = "https://cinegrabber.com"

View file

@ -11,9 +11,7 @@ import android.util.Log
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.inputmethod.EditorInfo
import android.widget.* import android.widget.*
import android.widget.TextView.OnEditorActionListener
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.animation.addListener import androidx.core.animation.addListener
@ -528,7 +526,7 @@ class GeneratorPlayer : FullScreenPlayer() {
} }
} }
var selectSourceDialog: AlertDialog? = null var selectSourceDialog: Dialog? = null
// var selectTracksDialog: AlertDialog? = null // var selectTracksDialog: AlertDialog? = null
override fun showMirrorsDialogue() { override fun showMirrorsDialogue() {
@ -540,10 +538,8 @@ class GeneratorPlayer : FullScreenPlayer() {
player.handleEvent(CSPlayerEvent.Pause) player.handleEvent(CSPlayerEvent.Pause)
val currentSubtitles = sortSubs(currentSubs) val currentSubtitles = sortSubs(currentSubs)
val sourceBuilder = AlertDialog.Builder(ctx, R.style.AlertDialogCustomBlack) val sourceDialog = Dialog(ctx, R.style.AlertDialogCustomBlack)
.setView(R.layout.player_select_source_and_subs) sourceDialog.setContentView(R.layout.player_select_source_and_subs)
val sourceDialog = sourceBuilder.create()
selectSourceDialog = sourceDialog selectSourceDialog = sourceDialog

View file

@ -291,6 +291,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
Supervideo(), Supervideo(),
GuardareStream(), GuardareStream(),
CineGrabber(), CineGrabber(),
Vanfem(),
// StreamSB.kt works // StreamSB.kt works
// SBPlay(), // SBPlay(),
@ -321,6 +322,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
DesuDrive(), DesuDrive(),
Filesim(), Filesim(),
FileMoon(),
Linkbox(), Linkbox(),
Acefile(), Acefile(),
SpeedoStream(), SpeedoStream(),

View file

@ -44,6 +44,7 @@
android:nextFocusLeft="@id/sort_subtitles" android:nextFocusLeft="@id/sort_subtitles"
android:nextFocusRight="@id/apply_btt" android:nextFocusRight="@id/apply_btt"
android:requiresFadingEdge="vertical" android:requiresFadingEdge="vertical"
tools:layout_height="100dp"
tools:listitem="@layout/sort_bottom_single_choice" /> tools:listitem="@layout/sort_bottom_single_choice" />
</LinearLayout> </LinearLayout>
@ -117,6 +118,7 @@
android:nextFocusLeft="@id/sort_providers" android:nextFocusLeft="@id/sort_providers"
android:nextFocusRight="@id/cancel_btt" android:nextFocusRight="@id/cancel_btt"
android:requiresFadingEdge="vertical" android:requiresFadingEdge="vertical"
tools:layout_height="200dp"
tools:listfooter="@layout/sort_bottom_footer_add_choice" tools:listfooter="@layout/sort_bottom_footer_add_choice"
tools:listitem="@layout/sort_bottom_single_choice" /> tools:listitem="@layout/sort_bottom_single_choice" />
</LinearLayout> </LinearLayout>