streamsb fix (#800)

This commit is contained in:
Stormunblessed 2022-03-16 20:11:14 +00:00 committed by GitHub
parent a0f3620ae8
commit 8b4c9e3593
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 29 deletions

View file

@ -44,6 +44,10 @@ class StreamSB9 : StreamSB() {
override var mainUrl = "https://sbplay.one" 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 // 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 // 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() {
@ -88,53 +92,30 @@ open class StreamSB : ExtractorApi() {
}.first() }.first()
val bytes = id.toByteArray() val bytes = id.toByteArray()
val bytesToHex = bytesToHex(bytes) val bytesToHex = bytesToHex(bytes)
val master = "$mainUrl/sources41/566d337678566f743674494a7c7c${bytesToHex}7c7c346b6767586d6934774855537c7c73747265616d7362/6565417268755339773461447c7c346133383438333436313335376136323337373433383634376337633465366534393338373136643732373736343735373237613763376334363733353737303533366236333463353333363534366137633763373337343732363536313664373336327c7c6b586c3163614468645a47617c7c73747265616d7362" val master = "$mainUrl/sources41/6d6144797752744a454267617c7c${bytesToHex.lowercase()}7c7c4e61755a56456f34385243727c7c73747265616d7362/6b4a33767968506e4e71374f7c7c343837323439333133333462353935333633373836643638376337633462333634663539343137373761333635313533333835333763376333393636363133393635366136323733343435323332376137633763373337343732363536313664373336327c7c504d754478413835306633797c7c73747265616d7362"
val headers = mapOf( 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", "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, val urltext = app.get(master,
headers = headers, headers = headers,
allowRedirects = false allowRedirects = false
).text ).text
val mapped = urltext.let { parseJson<Main>(it) } val mapped = urltext.let { parseJson<Main>(it) }
val testurl = app.get(mapped.streamData.file, headers = headers).text 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( if (urltext.contains("m3u8") && testurl.contains("EXTM3U")) return M3u8Helper().m3u8Generation(
M3u8Helper.M3u8Stream( M3u8Helper.M3u8Stream(
mapped.streamData.file, mapped.streamData.file,
headers = mapOf( headers = headers
"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",),
), true ), true
) )
.map { stream -> .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" val qualityString = if ((stream.quality ?: 0) == 0) "" else "${stream.quality}p"
ExtractorLink( ExtractorLink(
name, name,
"$name $qualityString", "$name $qualityString",
cleanstreamurl, stream.streamUrl,
url, url,
getQualityFromName(stream.quality.toString()), getQualityFromName(stream.quality.toString()),
true true

View file

@ -112,6 +112,7 @@ val extractorApis: Array<ExtractorApi> = arrayOf(
StreamSB7(), StreamSB7(),
StreamSB8(), StreamSB8(),
StreamSB9(), StreamSB9(),
StreamSB10(),
// Streamhub(), cause Streamhub2() works // Streamhub(), cause Streamhub2() works
Streamhub2(), Streamhub2(),