From 18c87c93617a2e83498208c2988eea31afbf6ba6 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 8 Apr 2025 21:57:34 +0200 Subject: [PATCH] feat: add earnvids extractors based on vidhide and fix vidhide (#1651) --- .../cloudstream3/extractors/VidHidePro.kt | 32 ++++++++++++++----- .../extractors/VidhideExtractor.kt | 32 +------------------ .../cloudstream3/utils/ExtractorApi.kt | 6 ++++ 3 files changed, 31 insertions(+), 39 deletions(-) diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VidHidePro.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VidHidePro.kt index 1f15fc5c6..cff6e9d54 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VidHidePro.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VidHidePro.kt @@ -30,6 +30,20 @@ class VidHidePro6 : VidHidePro() { override val mainUrl = "https://vidhidepre.com" } +class Smoothpre: VidHidePro() { + override var name = "EarnVids" + override var mainUrl = "https://smoothpre.com" +} + +class Dhtpre: VidHidePro() { + override var name = "EarnVids" + override var mainUrl = "https://dhtpre.com" +} + +class Peytonepre : VidHidePro() { + override var name = "EarnVids" + override var mainUrl = "https://peytonepre.com" +} open class VidHidePro : ExtractorApi() { override val name = "VidHidePro" @@ -57,15 +71,17 @@ open class VidHidePro : ExtractorApi() { getAndUnpack(response.text) } else { response.document.selectFirst("script:containsData(sources:)")?.data() + } ?: return + + // m3u8 urls could be prefixed by 'file:', 'hls2:' or 'hls4:', so we just match ':' + Regex(":\\s*\"(.*?m3u8.*?)\"").findAll(script).forEach { m3u8Match -> + generateM3u8( + name, + m3u8Match.groupValues[1], + mainUrl, + headers = headers + ).forEach(callback) } - val m3u8 = - Regex("file:\\s*\"(.*?m3u8.*?)\"").find(script ?: return)?.groupValues?.getOrNull(1) - generateM3u8( - name, - m3u8 ?: return, - mainUrl, - headers = headers - ).forEach(callback) } private fun getEmbedUrl(url: String): String { diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VidhideExtractor.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VidhideExtractor.kt index 63f71f00e..8c48f4467 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VidhideExtractor.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VidhideExtractor.kt @@ -1,37 +1,7 @@ package com.lagradost.cloudstream3.extractors -import com.lagradost.cloudstream3.app -import com.lagradost.cloudstream3.network.WebViewResolver -import com.lagradost.cloudstream3.utils.ExtractorApi -import com.lagradost.cloudstream3.utils.ExtractorLink -import com.lagradost.cloudstream3.utils.ExtractorLinkType -import com.lagradost.cloudstream3.utils.Qualities -import com.lagradost.cloudstream3.utils.newExtractorLink - -open class VidhideExtractor : ExtractorApi() { +open class VidhideExtractor : VidHidePro() { override var name = "VidHide" override var mainUrl = "https://vidhide.com" override val requiresReferer = false - - override suspend fun getUrl(url: String, referer: String?): List? { - val response = app.get( - url, referer = referer ?: "$mainUrl/", interceptor = WebViewResolver( - Regex("""master\.m3u8""") - ) - ) - val sources = mutableListOf() - if (response.url.contains("m3u8")) - sources.add( - newExtractorLink( - source = name, - name = name, - url = response.url, - type = ExtractorLinkType.M3U8 - ) { - this.referer = referer ?: "$mainUrl/" - this.quality = Qualities.Unknown.value - } - ) - return sources - } } \ No newline at end of file diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt index 0ff7705fe..ce92fad20 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -38,6 +38,7 @@ import com.lagradost.cloudstream3.extractors.DesuArcg import com.lagradost.cloudstream3.extractors.DesuDrive import com.lagradost.cloudstream3.extractors.DesuOdchan import com.lagradost.cloudstream3.extractors.DesuOdvip +import com.lagradost.cloudstream3.extractors.Dhtpre import com.lagradost.cloudstream3.extractors.Dokicloud import com.lagradost.cloudstream3.extractors.DoodCxExtractor import com.lagradost.cloudstream3.extractors.DoodLaExtractor @@ -152,6 +153,7 @@ import com.lagradost.cloudstream3.extractors.OkRuHTTP import com.lagradost.cloudstream3.extractors.OkRuSSL import com.lagradost.cloudstream3.extractors.Okrulink import com.lagradost.cloudstream3.extractors.PeaceMakerst +import com.lagradost.cloudstream3.extractors.Peytonepre import com.lagradost.cloudstream3.extractors.Pichive import com.lagradost.cloudstream3.extractors.PixelDrain import com.lagradost.cloudstream3.extractors.PlayLtXyz @@ -178,6 +180,7 @@ import com.lagradost.cloudstream3.extractors.SfastwishCom import com.lagradost.cloudstream3.extractors.ShaveTape import com.lagradost.cloudstream3.extractors.SibNet import com.lagradost.cloudstream3.extractors.Simpulumlamerop +import com.lagradost.cloudstream3.extractors.Smoothpre import com.lagradost.cloudstream3.extractors.Sobreatsesuyp import com.lagradost.cloudstream3.extractors.Solidfiles import com.lagradost.cloudstream3.extractors.Ssbstream @@ -1136,6 +1139,9 @@ val extractorApis: MutableList = arrayListOf( VidHidePro4(), VidHidePro5(), VidHidePro6(), + Dhtpre(), + Smoothpre(), + Peytonepre(), LuluStream(), Lulustream1(), Lulustream2(),