diff --git a/library/api/jvm/library.api b/library/api/jvm/library.api index 71939de56ea..389c8e83f32 100644 --- a/library/api/jvm/library.api +++ b/library/api/jvm/library.api @@ -8072,8 +8072,6 @@ public class com/lagradost/cloudstream3/utils/AtomicList : java/util/List, kotli public fun add (Ljava/lang/Object;)Z public fun addAll (ILjava/util/Collection;)Z public fun addAll (Ljava/util/Collection;)Z - public fun addFirst (Ljava/lang/Object;)V - public fun addLast (Ljava/lang/Object;)V public fun clear ()V public fun contains (Ljava/lang/Object;)Z public fun containsAll (Ljava/util/Collection;)Z @@ -8092,8 +8090,6 @@ public class com/lagradost/cloudstream3/utils/AtomicList : java/util/List, kotli public fun remove (I)Ljava/lang/Object; public fun remove (Ljava/lang/Object;)Z public fun removeAll (Ljava/util/Collection;)Z - public fun removeFirst ()Ljava/lang/Object; - public fun removeLast ()Ljava/lang/Object; public fun replaceAll (Ljava/util/function/UnaryOperator;)V public fun retainAll (Ljava/util/Collection;)Z public fun set (ILjava/lang/Object;)Ljava/lang/Object; diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamRuby.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamRuby.kt new file mode 100644 index 00000000000..86475aa3e45 --- /dev/null +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/StreamRuby.kt @@ -0,0 +1,86 @@ +package com.lagradost.cloudstream3.extractors + +import com.lagradost.cloudstream3.Prerelease +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.ExtractorLinkType +import com.lagradost.cloudstream3.utils.JsUnpacker +import com.lagradost.cloudstream3.utils.Qualities.Unknown +import com.lagradost.cloudstream3.utils.newExtractorLink + +@Prerelease +class StreamRubyCom : StreamRuby() { + override var mainUrl = "https://streamruby.com" +} + +@Prerelease +open class StreamRuby : ExtractorApi() { + override var name = "StreamRuby" + override open var mainUrl = "https://rubyvidhub.com" + override val requiresReferer = true + + override suspend fun getUrl( + url: String, + referer: String?, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ) { + val embedUrl = url.trim().trimEnd('/') + val fileCode = embedUrl.substringAfterLast("/") + .removeSuffix(".html") + .substringAfterLast("-") + if (fileCode.isBlank()) return + + try { + app.get(embedUrl, referer = referer ?: mainUrl) + } catch (_: Exception) { + return + } + + val dlText = try { + app.post( + "$mainUrl/dl", + data = mapOf( + "op" to "embed", + "file_code" to fileCode, + "auto" to "1", + "referer" to embedUrl, + ), + headers = mapOf("User-Agent" to USER_AGENT, "Referer" to embedUrl), + referer = embedUrl + ).text + } catch (_: Exception) { + return + } + + val unpacked = JsUnpacker(dlText).unpack() ?: dlText + + val streamUrl = Regex("""file:\s*["']([^"']+\.m3u8[^"']*)["']""") + .find(unpacked)?.groupValues?.get(1) + ?: Regex("""file:\s*["']([^"']+)["']""") + .find(unpacked)?.groupValues?.get(1) + ?.takeIf { it.contains("/hls") || it.endsWith(".mp4") } + + if (streamUrl.isNullOrBlank()) return + + callback.invoke( + newExtractorLink( + source = name, + name = name, + url = streamUrl, + type = ExtractorLinkType.M3U8 + ) { + this.referer = "$mainUrl/" + this.quality = Unknown.value + this.headers = mapOf( + "User-Agent" to USER_AGENT, + "Origin" to mainUrl, + "Referer" to "$mainUrl/" + ) + } + ) + } +} \ 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 faf498024ad..fb37d6be60a 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -239,6 +239,8 @@ import com.lagradost.cloudstream3.extractors.Streamhub2 import com.lagradost.cloudstream3.extractors.Streamlare import com.lagradost.cloudstream3.extractors.StreamoUpload import com.lagradost.cloudstream3.extractors.Streamplay +import com.lagradost.cloudstream3.extractors.StreamRuby +import com.lagradost.cloudstream3.extractors.StreamRubyCom import com.lagradost.cloudstream3.extractors.Streamsss import com.lagradost.cloudstream3.extractors.Streamwish2 import com.lagradost.cloudstream3.extractors.Strwish @@ -1346,6 +1348,8 @@ val extractorApis: AtomicMutableList = atomicListOf( Vids(), Playmate(), Hexload(), + StreamRuby(), + StreamRubyCom(), )