2022-08-20 07:46:57 +00:00
package com.lagradost.cloudstream3.extractors
import com.fasterxml.jackson.annotation.JsonProperty
2022-09-14 09:43:35 +00:00
import com.lagradost.cloudstream3.SubtitleFile
2022-08-20 07:46:57 +00:00
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
2022-10-26 15:38:46 +00:00
class Sbspeed : StreamSB ( ) {
override var name = " Sbspeed "
override var mainUrl = " https://sbspeed.com "
}
2022-09-14 09:43:35 +00:00
class Streamsss : StreamSB ( ) {
override var mainUrl = " https://streamsss.net "
}
2022-09-12 19:38:33 +00:00
class Sbflix : StreamSB ( ) {
override var mainUrl = " https://sbflix.xyz "
override var name = " Sbflix "
}
2022-09-02 16:19:20 +00:00
class Vidgomunime : StreamSB ( ) {
override var mainUrl = " https://vidgomunime.xyz "
}
2022-08-26 12:07:53 +00:00
class Sbthe : StreamSB ( ) {
override var mainUrl = " https://sbthe.com "
}
2022-08-20 07:46:57 +00:00
class Ssbstream : StreamSB ( ) {
override var mainUrl = " https://ssbstream.net "
}
class SBfull : StreamSB ( ) {
override var mainUrl = " https://sbfull.com "
}
class StreamSB1 : StreamSB ( ) {
override var mainUrl = " https://sbplay1.com "
}
class StreamSB2 : StreamSB ( ) {
override var mainUrl = " https://sbplay2.com "
}
class StreamSB3 : StreamSB ( ) {
override var mainUrl = " https://sbplay3.com "
}
class StreamSB4 : StreamSB ( ) {
override var mainUrl = " https://cloudemb.com "
}
class StreamSB5 : StreamSB ( ) {
override var mainUrl = " https://sbplay.org "
}
class StreamSB6 : StreamSB ( ) {
override var mainUrl = " https://embedsb.com "
}
class StreamSB7 : StreamSB ( ) {
override var mainUrl = " https://pelistop.co "
}
class StreamSB8 : StreamSB ( ) {
override var mainUrl = " https://streamsb.net "
}
class StreamSB9 : StreamSB ( ) {
override var mainUrl = " https://sbplay.one "
}
class StreamSB10 : StreamSB ( ) {
override var mainUrl = " https://sbplay2.xyz "
}
2023-02-25 21:18:48 +00:00
class StreamSB11 : StreamSB ( ) {
override var mainUrl = " https://sbbrisk.com "
}
2022-08-20 07:46:57 +00:00
// 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 ( ) {
override var name = " StreamSB "
override var mainUrl = " https://watchsb.com "
override val requiresReferer = false
private val hexArray = " 0123456789ABCDEF " . toCharArray ( )
private fun bytesToHex ( bytes : ByteArray ) : String {
val hexChars = CharArray ( bytes . size * 2 )
for ( j in bytes . indices ) {
val v = bytes [ j ] . toInt ( ) and 0xFF
hexChars [ j * 2 ] = hexArray [ v ushr 4 ]
hexChars [ j * 2 + 1 ] = hexArray [ v and 0x0F ]
}
return String ( hexChars )
}
data class Subs (
2022-10-26 15:38:46 +00:00
@JsonProperty ( " file " ) val file : String ? = null ,
@JsonProperty ( " label " ) val label : String ? = null ,
2022-08-20 07:46:57 +00:00
)
data class StreamData (
@JsonProperty ( " file " ) val file : String ,
@JsonProperty ( " cdn_img " ) val cdnImg : String ,
@JsonProperty ( " hash " ) val hash : String ,
2022-10-26 15:38:46 +00:00
@JsonProperty ( " subs " ) val subs : ArrayList < Subs > ? = arrayListOf ( ) ,
2022-08-20 07:46:57 +00:00
@JsonProperty ( " length " ) val length : String ,
@JsonProperty ( " id " ) val id : String ,
@JsonProperty ( " title " ) val title : String ,
@JsonProperty ( " backup " ) val backup : String ,
)
data class Main (
@JsonProperty ( " stream_data " ) val streamData : StreamData ,
@JsonProperty ( " status_code " ) val statusCode : Int ,
)
2022-09-14 09:43:35 +00:00
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_-]+) " )
2022-08-20 07:46:57 +00:00
val id = regexID . findAll ( url ) . map {
2022-09-14 09:43:35 +00:00
it . value . replace ( Regex ( " (embed-|/e/) " ) , " " )
2022-08-20 07:46:57 +00:00
} . first ( )
2022-09-14 09:43:35 +00:00
// val master = "$mainUrl/sources48/6d6144797752744a454267617c7c${bytesToHex.lowercase()}7c7c4e61755a56456f34385243727c7c73747265616d7362/6b4a33767968506e4e71374f7c7c343837323439333133333462353935333633373836643638376337633462333634663539343137373761333635313533333835333763376333393636363133393635366136323733343435323332376137633763373337343732363536313664373336327c7c504d754478413835306633797c7c73747265616d7362"
2023-03-29 03:12:10 +00:00
val master = " $mainUrl /sources16/ " + bytesToHex ( " || $id ||||streamsb " . toByteArray ( ) ) + " / "
2022-08-20 07:46:57 +00:00
val headers = mapOf (
2022-09-14 09:43:35 +00:00
" watchsb " to " sbstream " ,
)
val mapped = app . get (
master . lowercase ( ) ,
2022-08-20 07:46:57 +00:00
headers = headers ,
2022-09-14 09:43:35 +00:00
referer = url ,
) . parsedSafe < Main > ( )
2022-08-20 07:46:57 +00:00
// val urlmain = mapped.streamData.file.substringBefore("/hls/")
2022-09-14 09:43:35 +00:00
M3u8Helper . generateM3u8 (
name ,
mapped ?. streamData ?. file ?: return ,
url ,
headers = headers
) . forEach ( callback )
2022-10-26 15:38:46 +00:00
mapped . streamData . subs ?. map { sub ->
subtitleCallback . invoke (
SubtitleFile (
sub . label . toString ( ) ,
sub . file ?: return @map null ,
)
)
}
2022-08-20 07:46:57 +00:00
}
2023-02-18 12:15:50 +00:00
}