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
This commit is contained in:
Stormunblessed 2023-02-27 14:05:42 -06:00 committed by GitHub
parent e5834d485b
commit d6df24eff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 25 deletions

View file

@ -1,13 +1,15 @@
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 com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.M3u8Helper.Companion.generateM3u8
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import java.net.URI
class Ztreamhub : Filesim() {
override val mainUrl: String = "https://ztreamhub.com" //Here 'cause works
override val name = "Zstreamhub"
}
class FileMoon : Filesim() { class FileMoon : Filesim() {
override val mainUrl = "https://filemoon.to" override val mainUrl = "https://filemoon.to"
override val name = "FileMoon" override val name = "FileMoon"
@ -29,34 +31,27 @@ open class Filesim : ExtractorApi() {
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
with(app.get(url).document) { val response = app.get(url, referer = mainUrl).document
this.select("script").forEach { script -> response.select("script[type=text/javascript]").map { script ->
if (script.data().contains("eval(function(p,a,c,k,e,d)")) { if (script.data().contains(Regex("eval\\(function\\(p,a,c,k,e,[rd]"))) {
val data = getAndUnpack(script.data()) val unpackedscript = getAndUnpack(script.data())
val foundData = Regex("""sources:\[(.*?)]""").find(data)?.groupValues?.get(1) ?: return@forEach val m3u8Regex = Regex("file.\\\"(.*?m3u8.*?)\\\"")
val fixedData = foundData.replace("file:", """"file":""") val m3u8 = m3u8Regex.find(unpackedscript)?.destructured?.component1() ?: ""
if (m3u8.isNotEmpty()) {
parseJson<List<ResponseSource>>("[$fixedData]").forEach { generateM3u8(
callback.invoke(
ExtractorLink(
name, name,
name, m3u8,
it.file, mainUrl
"$mainUrl/", ).forEach(callback)
Qualities.Unknown.value,
URI(it.file).path.endsWith(".m3u8")
)
)
}
} }
} }
} }
} }
private data class ResponseSource( /* private data class ResponseSource(
@JsonProperty("file") val file: String, @JsonProperty("file") val file: String,
@JsonProperty("type") val type: String?, @JsonProperty("type") val type: String?,
@JsonProperty("label") val label: String? @JsonProperty("label") val label: String?
) ) */
} }

View file

@ -370,6 +370,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
Cda(), Cda(),
Dailymotion(), Dailymotion(),
ByteShare(), ByteShare(),
Ztreamhub()
) )