From d6df24eff2d425fc79e52b94a1fe600f857ec19a Mon Sep 17 00:00:00 2001 From: Stormunblessed <86633626+Stormunblessed@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:05:42 -0600 Subject: [PATCH] Fixes on filesim and added filemoon, ztreamhub (#397) * fix fastream, tomatomatela, and added okrulink * forgot this * sendvid extractor * sendvid extractor * fixes * Filesim fix, added filemoon and ztreamhub --- .../cloudstream3/extractors/Filesim.kt | 45 +++++++++---------- .../cloudstream3/utils/ExtractorApi.kt | 1 + 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Filesim.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Filesim.kt index 382ca756..84fd0552 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Filesim.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Filesim.kt @@ -1,13 +1,15 @@ 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 +import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8 + +class Ztreamhub : Filesim() { + override val mainUrl: String = "https://ztreamhub.com" //Here 'cause works + override val name = "Zstreamhub" +} class FileMoon : Filesim() { override val mainUrl = "https://filemoon.to" override val name = "FileMoon" @@ -29,34 +31,27 @@ open class Filesim : ExtractorApi() { subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ) { - with(app.get(url).document) { - this.select("script").forEach { script -> - if (script.data().contains("eval(function(p,a,c,k,e,d)")) { - val data = getAndUnpack(script.data()) - val foundData = Regex("""sources:\[(.*?)]""").find(data)?.groupValues?.get(1) ?: return@forEach - val fixedData = foundData.replace("file:", """"file":""") - - parseJson>("[$fixedData]").forEach { - callback.invoke( - ExtractorLink( - name, - name, - it.file, - "$mainUrl/", - Qualities.Unknown.value, - URI(it.file).path.endsWith(".m3u8") - ) - ) - } + val response = app.get(url, referer = mainUrl).document + response.select("script[type=text/javascript]").map { script -> + if (script.data().contains(Regex("eval\\(function\\(p,a,c,k,e,[rd]"))) { + val unpackedscript = getAndUnpack(script.data()) + val m3u8Regex = Regex("file.\\\"(.*?m3u8.*?)\\\"") + val m3u8 = m3u8Regex.find(unpackedscript)?.destructured?.component1() ?: "" + if (m3u8.isNotEmpty()) { + generateM3u8( + name, + m3u8, + mainUrl + ).forEach(callback) } } } } - private data class ResponseSource( + /* private data class ResponseSource( @JsonProperty("file") val file: String, @JsonProperty("type") val type: String?, @JsonProperty("label") val label: String? - ) + ) */ } \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index 6540b8c4..0bced6b2 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -370,6 +370,7 @@ val extractorApis: MutableList = arrayListOf( Cda(), Dailymotion(), ByteShare(), + Ztreamhub() )