From 9301aec0df8edd7bb14f569298cc455a1133e24e Mon Sep 17 00:00:00 2001 From: hexated Date: Wed, 24 Aug 2022 07:23:52 +0700 Subject: [PATCH] Added Zorofile (extractor) --- .../cloudstream3/extractors/StreamSB.kt | 4 + .../cloudstream3/extractors/Zorofile.kt | 77 +++++++++++++++++++ .../cloudstream3/utils/ExtractorApi.kt | 2 + 3 files changed, 83 insertions(+) create mode 100644 app/src/main/java/com/lagradost/cloudstream3/extractors/Zorofile.kt diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/StreamSB.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/StreamSB.kt index da3ef278..8cd68587 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/StreamSB.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/StreamSB.kt @@ -7,6 +7,10 @@ import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.M3u8Helper +class Sbthe : StreamSB() { + override var mainUrl = "https://sbthe.com" +} + class Ssbstream : StreamSB() { override var mainUrl = "https://ssbstream.net" } diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Zorofile.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Zorofile.kt new file mode 100644 index 00000000..b0a22c03 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Zorofile.kt @@ -0,0 +1,77 @@ +package com.lagradost.cloudstream3.extractors + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.APIHolder +import com.lagradost.cloudstream3.ErrorLoadingException +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.AppUtils +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.M3u8Helper + +class Zorofile : ExtractorApi() { + override val name = "Zorofile" + override val mainUrl = "https://zorofile.com" + override val requiresReferer = true + + override suspend fun getUrl(url: String, referer: String?): List { + val id = url.split("?").first().split("/").last() + val token = app.get( + url, + referer = referer + ).document.select("button.g-recaptcha").attr("data-sitekey").let { captchaKey -> + APIHolder.getCaptchaToken( + url, + captchaKey, + referer = referer + ) + } ?: throw ErrorLoadingException("can't bypass captcha") + + val sources = mutableListOf() + + val data = app.post( + "$mainUrl/dl", + data = mapOf( + "op" to "embed", + "file_code" to id, + "auto" to "1", + "referer" to "$referer/", + "g-recaptcha-response" to token + ), + referer = url, + headers = mapOf( + "Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", +// "Accept-Encoding" to "gzip, deflate, br", +// "Accept-Language" to "en-US,en;q=0.5", +// "Connection" to "keep-alive", + "Content-Length" to "626", + "Content-Type" to "application/x-www-form-urlencoded", + "Origin" to mainUrl, + "Sec-Fetch-Dest" to "iframe", + "Sec-Fetch-Mode" to "navigate", + "Sec-Fetch-Site" to "same-origin", + "Sec-Fetch-User" to "?1", + "Upgrade-Insecure-Requests" to "1", + ) + ).document.select("script").find { it.data().contains("var holaplayer;") }?.data() + ?.substringAfter("sources: [")?.substringBefore("],")?.replace("src", "\"src\"") + ?.replace("type", "\"type\"") + + AppUtils.tryParseJson("$data")?.let { res -> + M3u8Helper.generateM3u8( + name, + res.src ?: return@let, + "$mainUrl/", + headers = mapOf( + "Origin" to mainUrl, + ) + ).forEach { m3uData -> sources.add(m3uData) } + } + return sources + } + + private data class Sources( + @JsonProperty("src") val src: String? = null, + @JsonProperty("type") val type: String? = null, + ) +} \ 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 de3c013a..217837c9 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -234,6 +234,7 @@ val extractorApis: MutableList = arrayListOf( // Streamhub(), cause Streamhub2() works Streamhub2(), Ssbstream(), + Sbthe(), Fastream(), @@ -312,6 +313,7 @@ val extractorApis: MutableList = arrayListOf( Linkbox(), Acefile(), SpeedoStream(), + Zorofile(), YoutubeExtractor(), YoutubeShortLinkExtractor(),