mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
streamsb fix (#800)
This commit is contained in:
parent
a0f3620ae8
commit
8b4c9e3593
2 changed files with 11 additions and 29 deletions
|
@ -44,6 +44,10 @@ class StreamSB9 : StreamSB() {
|
|||
override var mainUrl = "https://sbplay.one"
|
||||
}
|
||||
|
||||
class StreamSB10 : StreamSB() {
|
||||
override var mainUrl = "https://sbplay2.xyz"
|
||||
}
|
||||
|
||||
// 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() {
|
||||
|
@ -88,53 +92,30 @@ open class StreamSB : ExtractorApi() {
|
|||
}.first()
|
||||
val bytes = id.toByteArray()
|
||||
val bytesToHex = bytesToHex(bytes)
|
||||
val master = "$mainUrl/sources41/566d337678566f743674494a7c7c${bytesToHex}7c7c346b6767586d6934774855537c7c73747265616d7362/6565417268755339773461447c7c346133383438333436313335376136323337373433383634376337633465366534393338373136643732373736343735373237613763376334363733353737303533366236333463353333363534366137633763373337343732363536313664373336327c7c6b586c3163614468645a47617c7c73747265616d7362"
|
||||
val master = "$mainUrl/sources41/6d6144797752744a454267617c7c${bytesToHex.lowercase()}7c7c4e61755a56456f34385243727c7c73747265616d7362/6b4a33767968506e4e71374f7c7c343837323439333133333462353935333633373836643638376337633462333634663539343137373761333635313533333835333763376333393636363133393635366136323733343435323332376137633763373337343732363536313664373336327c7c504d754478413835306633797c7c73747265616d7362"
|
||||
val headers = mapOf(
|
||||
"Host" to url.substringAfter("https://").substringBefore("/"),
|
||||
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0",
|
||||
"Accept" to "application/json, text/plain, */*",
|
||||
"Accept-Language" to "en-US,en;q=0.5",
|
||||
"Referer" to url,
|
||||
"watchsb" to "streamsb",
|
||||
"DNT" to "1",
|
||||
"Connection" to "keep-alive",
|
||||
"Sec-Fetch-Dest" to "empty",
|
||||
"Sec-Fetch-Mode" to "no-cors",
|
||||
"Sec-Fetch-Site" to "same-origin",
|
||||
"TE" to "trailers",
|
||||
"Pragma" to "no-cache",
|
||||
"Cache-Control" to "no-cache",)
|
||||
)
|
||||
val urltext = app.get(master,
|
||||
headers = headers,
|
||||
allowRedirects = false
|
||||
).text
|
||||
val mapped = urltext.let { parseJson<Main>(it) }
|
||||
val testurl = app.get(mapped.streamData.file, headers = headers).text
|
||||
val urlmain = mapped.streamData.file.substringBefore("/hls/")
|
||||
// val urlmain = mapped.streamData.file.substringBefore("/hls/")
|
||||
if (urltext.contains("m3u8") && testurl.contains("EXTM3U")) return M3u8Helper().m3u8Generation(
|
||||
M3u8Helper.M3u8Stream(
|
||||
mapped.streamData.file,
|
||||
headers = mapOf(
|
||||
"User-Agent" to USER_AGENT,
|
||||
"Accept" to "*/*",
|
||||
"Accept-Language" to "en-US,en;q=0.5",
|
||||
"Accept-Encoding" to "gzip, deflate, br",
|
||||
"Origin" to mainUrl,
|
||||
"DNT" to "1",
|
||||
"Connection" to "keep-alive",
|
||||
"Referer" to "$mainUrl/",
|
||||
"Sec-Fetch-Dest" to "empty",
|
||||
"Sec-Fetch-Mode" to "cors",
|
||||
"Sec-Fetch-Site" to "cross-site",),
|
||||
headers = headers
|
||||
), true
|
||||
)
|
||||
.map { stream ->
|
||||
val cleanstreamurl = stream.streamUrl.replace(Regex("https://.*/hls/"), "$urlmain/hls/")
|
||||
// val cleanstreamurl = stream.streamUrl.replace(Regex("https://.*/hls/"), "$urlmain/hls/")
|
||||
val qualityString = if ((stream.quality ?: 0) == 0) "" else "${stream.quality}p"
|
||||
ExtractorLink(
|
||||
name,
|
||||
"$name $qualityString",
|
||||
cleanstreamurl,
|
||||
stream.streamUrl,
|
||||
url,
|
||||
getQualityFromName(stream.quality.toString()),
|
||||
true
|
||||
|
|
|
@ -112,6 +112,7 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
|
|||
StreamSB7(),
|
||||
StreamSB8(),
|
||||
StreamSB9(),
|
||||
StreamSB10(),
|
||||
// Streamhub(), cause Streamhub2() works
|
||||
Streamhub2(),
|
||||
|
||||
|
|
Loading…
Reference in a new issue