mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fixed Stramsb & Voe (#470)
This commit is contained in:
parent
b115817357
commit
0d431fd508
4 changed files with 62 additions and 106 deletions
|
@ -6,6 +6,11 @@ import com.lagradost.cloudstream3.app
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
class Vidgomunimesb : StreamSB() {
|
||||||
|
override var mainUrl = "https://vidgomunimesb.xyz"
|
||||||
|
}
|
||||||
|
|
||||||
class Sbasian : StreamSB() {
|
class Sbasian : StreamSB() {
|
||||||
override var mainUrl = "https://sbasian.pro"
|
override var mainUrl = "https://sbasian.pro"
|
||||||
|
@ -100,24 +105,62 @@ class Sblongvu : StreamSB() {
|
||||||
override var mainUrl = "https://sblongvu.com"
|
override var mainUrl = "https://sblongvu.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a modified version of https://github.com/jmir1/aniyomi-extensions/blob/master/src/en/genoanime/src/eu/kanade/tachiyomi/animeextension/en/genoanime/extractors/StreamSBExtractor.kt
|
|
||||||
// The following code is under the Apache License 2.0 https://github.com/jmir1/aniyomi-extensions/blob/master/LICENSE
|
|
||||||
open class StreamSB : ExtractorApi() {
|
open class StreamSB : ExtractorApi() {
|
||||||
override var name = "StreamSB"
|
override var name = "StreamSB"
|
||||||
override var mainUrl = "https://watchsb.com"
|
override var mainUrl = "https://watchsb.com"
|
||||||
override val requiresReferer = false
|
override val requiresReferer = false
|
||||||
|
private val alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||||
|
|
||||||
private val hexArray = "0123456789ABCDEF".toCharArray()
|
override suspend fun getUrl(
|
||||||
|
url: String,
|
||||||
|
referer: String?,
|
||||||
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
|
callback: (ExtractorLink) -> Unit
|
||||||
|
) {
|
||||||
|
val regexID =
|
||||||
|
Regex("(embed-[a-zA-Z\\d]{0,8}[a-zA-Z\\d_-]+|/e/[a-zA-Z\\d]{0,8}[a-zA-Z\\d_-]+)")
|
||||||
|
val id = regexID.findAll(url).map {
|
||||||
|
it.value.replace(Regex("(embed-|/e/)"), "")
|
||||||
|
}.first()
|
||||||
|
val master = "$mainUrl/375664356a494546326c4b797c7c6e756577776778623171737/${encodeId(id)}"
|
||||||
|
val headers = mapOf(
|
||||||
|
"watchsb" to "sbstream",
|
||||||
|
)
|
||||||
|
val mapped = app.get(
|
||||||
|
master.lowercase(),
|
||||||
|
headers = headers,
|
||||||
|
referer = url,
|
||||||
|
).parsedSafe<Main>()
|
||||||
|
M3u8Helper.generateM3u8(
|
||||||
|
name,
|
||||||
|
mapped?.streamData?.file ?: return,
|
||||||
|
url,
|
||||||
|
headers = headers
|
||||||
|
).forEach(callback)
|
||||||
|
|
||||||
private fun bytesToHex(bytes: ByteArray): String {
|
mapped.streamData.subs?.map {sub ->
|
||||||
val hexChars = CharArray(bytes.size * 2)
|
subtitleCallback.invoke(
|
||||||
for (j in bytes.indices) {
|
SubtitleFile(
|
||||||
val v = bytes[j].toInt() and 0xFF
|
sub.label.toString(),
|
||||||
|
sub.file ?: return@map null,
|
||||||
hexChars[j * 2] = hexArray[v ushr 4]
|
)
|
||||||
hexChars[j * 2 + 1] = hexArray[v and 0x0F]
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun encodeId(id: String): String {
|
||||||
|
val code = "${createHashTable()}||$id||${createHashTable()}||streamsb"
|
||||||
|
return code.toCharArray().joinToString("") { char ->
|
||||||
|
char.code.toString(16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createHashTable(): String {
|
||||||
|
return buildString {
|
||||||
|
repeat(12) {
|
||||||
|
append(alphabet[Random.nextInt(alphabet.length)])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return String(hexChars)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Subs (
|
data class Subs (
|
||||||
|
@ -141,42 +184,4 @@ open class StreamSB : ExtractorApi() {
|
||||||
@JsonProperty("status_code") val statusCode: Int,
|
@JsonProperty("status_code") val statusCode: Int,
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun getUrl(
|
|
||||||
url: String,
|
|
||||||
referer: String?,
|
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
|
||||||
callback: (ExtractorLink) -> Unit
|
|
||||||
) {
|
|
||||||
val regexID =
|
|
||||||
Regex("(embed-[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+|/e/[a-zA-Z0-9]{0,8}[a-zA-Z0-9_-]+)")
|
|
||||||
val id = regexID.findAll(url).map {
|
|
||||||
it.value.replace(Regex("(embed-|/e/)"), "")
|
|
||||||
}.first()
|
|
||||||
// val master = "$mainUrl/sources48/6d6144797752744a454267617c7c${bytesToHex.lowercase()}7c7c4e61755a56456f34385243727c7c73747265616d7362/6b4a33767968506e4e71374f7c7c343837323439333133333462353935333633373836643638376337633462333634663539343137373761333635313533333835333763376333393636363133393635366136323733343435323332376137633763373337343732363536313664373336327c7c504d754478413835306633797c7c73747265616d7362"
|
|
||||||
val master = "$mainUrl/sources16/" + bytesToHex("||$id||||streamsb".toByteArray()) + "/"
|
|
||||||
val headers = mapOf(
|
|
||||||
"watchsb" to "sbstream",
|
|
||||||
)
|
|
||||||
val mapped = app.get(
|
|
||||||
master.lowercase(),
|
|
||||||
headers = headers,
|
|
||||||
referer = url,
|
|
||||||
).parsedSafe<Main>()
|
|
||||||
// val urlmain = mapped.streamData.file.substringBefore("/hls/")
|
|
||||||
M3u8Helper.generateM3u8(
|
|
||||||
name,
|
|
||||||
mapped?.streamData?.file ?: return,
|
|
||||||
url,
|
|
||||||
headers = headers
|
|
||||||
).forEach(callback)
|
|
||||||
|
|
||||||
mapped.streamData.subs?.map {sub ->
|
|
||||||
subtitleCallback.invoke(
|
|
||||||
SubtitleFile(
|
|
||||||
sub.label.toString(),
|
|
||||||
sub.file ?: return@map null,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,10 @@ import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.M3u8Helper
|
import com.lagradost.cloudstream3.utils.M3u8Helper
|
||||||
|
|
||||||
|
class Tubeless : Voe() {
|
||||||
|
override var mainUrl = "https://tubelessceliolymph.com"
|
||||||
|
}
|
||||||
|
|
||||||
open class Voe : ExtractorApi() {
|
open class Voe : ExtractorApi() {
|
||||||
override val name = "Voe"
|
override val name = "Voe"
|
||||||
override val mainUrl = "https://voe.sx"
|
override val mainUrl = "https://voe.sx"
|
||||||
|
@ -18,8 +22,8 @@ open class Voe : ExtractorApi() {
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
) {
|
) {
|
||||||
val res = app.get(url, referer = referer).document
|
val res = app.get(url, referer = referer).document
|
||||||
val link = res.select("script").find { it.data().contains("const sources") }?.data()
|
val script = res.select("script").find { it.data().contains("sources =") }?.data()
|
||||||
?.substringAfter("\"hls\": \"")?.substringBefore("\",")
|
val link = Regex("[\"']hls[\"']:\\s*[\"'](.*)[\"']").find(script ?: return)?.groupValues?.get(1)
|
||||||
|
|
||||||
M3u8Helper.generateM3u8(
|
M3u8Helper.generateM3u8(
|
||||||
name,
|
name,
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package com.lagradost.cloudstream3.extractors
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
|
||||||
import com.lagradost.cloudstream3.app
|
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
||||||
import com.lagradost.cloudstream3.utils.getQualityFromName
|
|
||||||
|
|
||||||
open class VoeExtractor : ExtractorApi() {
|
|
||||||
override val name: String = "Voe"
|
|
||||||
override val mainUrl: String = "https://voe.sx"
|
|
||||||
override val requiresReferer = false
|
|
||||||
|
|
||||||
private data class ResponseLinks(
|
|
||||||
@JsonProperty("hls") val hls: String?,
|
|
||||||
@JsonProperty("mp4") val mp4: String?,
|
|
||||||
@JsonProperty("video_height") val label: Int?
|
|
||||||
//val type: String // Mp4
|
|
||||||
)
|
|
||||||
|
|
||||||
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> {
|
|
||||||
val html = app.get(url).text
|
|
||||||
if (html.isNotBlank()) {
|
|
||||||
val src = html.substringAfter("const sources =").substringBefore(";")
|
|
||||||
// Remove last comma, it is not proper json otherwise
|
|
||||||
.replace("0,", "0")
|
|
||||||
// Make json use the proper quotes
|
|
||||||
.replace("'", "\"")
|
|
||||||
|
|
||||||
//Log.i(this.name, "Result => (src) ${src}")
|
|
||||||
parseJson<ResponseLinks?>(src)?.let { voeLink ->
|
|
||||||
//Log.i(this.name, "Result => (voeLink) ${voeLink}")
|
|
||||||
|
|
||||||
// Always defaults to the hls link, but returns the mp4 if null
|
|
||||||
val linkUrl = voeLink.hls ?: voeLink.mp4
|
|
||||||
val linkLabel = voeLink.label?.toString() ?: ""
|
|
||||||
if (!linkUrl.isNullOrEmpty()) {
|
|
||||||
return listOf(
|
|
||||||
ExtractorLink(
|
|
||||||
name = this.name,
|
|
||||||
source = this.name,
|
|
||||||
url = linkUrl,
|
|
||||||
quality = getQualityFromName(linkLabel),
|
|
||||||
referer = url,
|
|
||||||
isM3u8 = voeLink.hls != null
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -236,6 +236,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
||||||
XStreamCdn(),
|
XStreamCdn(),
|
||||||
|
|
||||||
StreamSB(),
|
StreamSB(),
|
||||||
|
Vidgomunimesb(),
|
||||||
StreamSB1(),
|
StreamSB1(),
|
||||||
StreamSB2(),
|
StreamSB2(),
|
||||||
StreamSB3(),
|
StreamSB3(),
|
||||||
|
@ -275,7 +276,6 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
||||||
Uqload2(),
|
Uqload2(),
|
||||||
Evoload(),
|
Evoload(),
|
||||||
Evoload1(),
|
Evoload1(),
|
||||||
VoeExtractor(),
|
|
||||||
UpstreamExtractor(),
|
UpstreamExtractor(),
|
||||||
|
|
||||||
Tomatomatela(),
|
Tomatomatela(),
|
||||||
|
@ -375,6 +375,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
|
||||||
Vidmoly(),
|
Vidmoly(),
|
||||||
Vidmolyme(),
|
Vidmolyme(),
|
||||||
Voe(),
|
Voe(),
|
||||||
|
Tubeless(),
|
||||||
Moviehab(),
|
Moviehab(),
|
||||||
MoviehabNet(),
|
MoviehabNet(),
|
||||||
Jeniusplay(),
|
Jeniusplay(),
|
||||||
|
|
Loading…
Reference in a new issue