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
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.*
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
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() {
override val name = "Filesim"
override val mainUrl = "https://files.im"
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
val sources = mutableListOf<ExtractorLink>()
override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
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)")) {
val data = getAndUnpack(script.data()).substringAfter("sources:[").substringBefore("]")
tryParseJson<List<ResponseSource>>("[$data]")?.map {
M3u8Helper.generateM3u8(
val data = getAndUnpack(script.data())
val foundData = Regex("""sources:\[(.*?)]""").find(data)?.groupValues?.get(1) ?: return@forEach
val fixedData = foundData.replace("file:", """"file":""")
parseJson<List<ResponseSource>>("[$fixedData]").forEach {
callback.invoke(
ExtractorLink(
name,
name,
it.file,
"$mainUrl/",
).forEach { m3uData -> sources.add(m3uData) }
Qualities.Unknown.value,
URI(it.file).path.endsWith(".m3u8")
)
)
}
}
}
}
return sources
}
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.utils.*
class Vanfem : GuardareStream() {
override var name = "Vanfem"
override var mainUrl = "https://vanfem.com/"
}
class CineGrabber : GuardareStream() {
override var name = "CineGrabber"
override var mainUrl = "https://cinegrabber.com"

View file

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

View file

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

View file

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