From 6ef3ad9a106c8405044dd53ed31db2685b4596ad Mon Sep 17 00:00:00 2001 From: b4byhuey <60543438+b4byhuey@users.noreply.github.com> Date: Sun, 11 Aug 2024 02:51:06 +0800 Subject: [PATCH] Update StreamWishExtractor.kt --- .../extractors/StreamWishExtractor.kt | 182 +++++++++++++++--- 1 file changed, 151 insertions(+), 31 deletions(-) diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamWishExtractor.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamWishExtractor.kt index 551d1ef6..a9489433 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamWishExtractor.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamWishExtractor.kt @@ -1,28 +1,137 @@ package com.lagradost.cloudstream3.extractors import com.lagradost.cloudstream3.SubtitleFile +import com.lagradost.cloudstream3.USER_AGENT import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink -import com.lagradost.cloudstream3.utils.getQualityFromName +import com.lagradost.cloudstream3.utils.M3u8Helper +import com.lagradost.cloudstream3.utils.getAndUnpack +import com.lagradost.cloudstream3.utils.getPacked +class Mwish : StreamwishExt() { + override val name = "Mwish" + override val mainUrl = "https://mwish.pro" +} -class WishembedPro : StreamWishExtractor() { +class Dwish : StreamwishExt() { + override val name = "Dwish" + override val mainUrl = "https://dwish.pro" +} + +class Ewish : StreamwishExt() { + override val name = "Embedwish" + override val mainUrl = "https://embedwish.com" +} + +class Wishembed : StreamwishExt() { + override val name = "Wishembed" override val mainUrl = "https://wishembed.pro" } -class CdnwishCom : StreamWishExtractor() { - override val mainUrl = "https://cdnwish.com" + +class Kswplayer : StreamwishExt() { + override val name = "Kswplayer" + override val mainUrl = "https://kswplayer.info" } -class FlaswishCom : StreamWishExtractor() { - override val mainUrl = "https://flaswish.com" + +class Wishfast: StreamwishExt() { + override val name = "Wishfast" + override val mainUrl = "https://wishfast.top" } -class SfastwishCom : StreamWishExtractor() { + +class Streamwish2 : StreamwishExt() { + override val mainUrl = "https://streamwish.site" +} + +class Sfastwish : StreamwishExt() { + override val name = "Sfastwish" override val mainUrl = "https://sfastwish.com" } -open class StreamWishExtractor : ExtractorApi() { - override var name = "StreamWish" + +class Strwish : StreamwishExt() { + override val name = "Strwish" + override val mainUrl = "https://strwish.xyz" +} + +class Strwish2 : StreamwishExt() { + override val name = "Strwish" + override val mainUrl = "https://strwish.com" +} + +class Flaswish : StreamwishExt() { + override val name = "Flaswish" + override val mainUrl = "https://flaswish.com" +} + +class Awish : StreamwishExt() { + override val name = "Awish" + override val mainUrl = "https://awish.pro" +} + +class Obeywish : StreamwishExt() { + override val name = "Obeywish" + override val mainUrl = "https://obeywish.com" +} + +class Jodwish : StreamwishExt() { + override val name = "Jodwish" + override val mainUrl = "https://jodwish.com" +} + +class Swhoi : StreamwishExt() { + override val name = "Swhoi" + override val mainUrl = "https://swhoi.com" +} + +class Multimovies : StreamwishExt() { + override val name = "Multimovies" + override val mainUrl = "https://multimovies.cloud" +} + +class UqloadsXyz : StreamwishExt() { + override val name = "Uqloads" + override val mainUrl = "https://uqloads.xyz" +} + +class Doodporn : StreamwishExt() { + override val name = "Doodporn" + override val mainUrl = "https://doodporn.xyz" +} + +class Cdnwish : StreamwishExt() { + override val name = "Cdnwish" + override val mainUrl = "https://cdnwish.com" +} + +class Asnwish : StreamwishExt() { + override val name = "Asnwish" + override val mainUrl = "https://asnwish.com" +} + +class Nekowish : StreamwishExt() { + override val name = "Nekowish" + override val mainUrl = "https://nekowish.my.id" +} + +class Nekostream : StreamwishExt() { + override val name = "Nekostream" + override val mainUrl = "https://neko-stream.click" +} + +class Swdyu : StreamwishExt() { + override val name = "Swdyu" + override val mainUrl = "https://swdyu.com" +} + +class Wishonly : StreamwishExt() { + override val name = "Wishonly" + override val mainUrl = "https://wishonly.site" +} + +open class StreamwishExt : ExtractorApi() { + override val name = "Streamwish" override val mainUrl = "https://streamwish.to" - override val requiresReferer = false + override val requiresReferer = true override suspend fun getUrl( url: String, @@ -30,27 +139,38 @@ open class StreamWishExtractor : ExtractorApi() { subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ) { - val doc = app.get( - url, - referer = referer, - allowRedirects = false - ).document - var script = doc.select("script").find { - it.html().contains("jwplayer(\"vplayer\").setup(") + val headers = mapOf( + "Accept" to "*/*", + "Connection" to "keep-alive", + "Sec-Fetch-Dest" to "empty", + "Sec-Fetch-Mode" to "cors", + "Sec-Fetch-Site" to "cross-site", + "Origin" to "$mainUrl/", + "User-Agent" to USER_AGENT + ) + val response = app.get(getEmbedUrl(url), referer = referer) + val script = if (!getPacked(response.text).isNullOrEmpty()) { + getAndUnpack(response.text) + } else { + response.document.selectFirst("script:containsData(sources:)")?.data() } - var scriptContent = script?.html() - val extractedurl = Regex("""sources: \[\{file:"(.*?)"""").find(scriptContent ?: "")?.groupValues?.get(1) - if (!extractedurl.isNullOrBlank()) { - callback( - ExtractorLink( - this.name, - this.name, - extractedurl, - referer ?: "$mainUrl/", - getQualityFromName(""), - extractedurl.contains("m3u8") - ) - ) + val m3u8 = + Regex("file:\\s*\"(.*?m3u8.*?)\"").find(script ?: return)?.groupValues?.getOrNull(1) + M3u8Helper.generateM3u8( + name, + m3u8 ?: return, + mainUrl, + headers = headers + ).forEach(callback) + } + + private fun getEmbedUrl(url: String): String { + return if (url.contains("/f/")) { + val videoId = url.substringAfter("/f/") + "$mainUrl/$videoId" + } else { + url } } -} \ No newline at end of file + +}