Fix Toonitalia + extractors (#1331)

* Update extractors

* Add more streamsb links

* StreamSB fix
This commit is contained in:
Secozzi
2023-02-25 12:20:27 +01:00
committed by GitHub
parent 6a191b0638
commit 5dc5646302
6 changed files with 15 additions and 151 deletions

View File

@ -8,6 +8,7 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
class StreamSBExtractor(private val client: OkHttpClient) {
@ -26,11 +27,13 @@ class StreamSBExtractor(private val client: OkHttpClient) {
// animension, asianload and dramacool uses "common = false"
private fun fixUrl(url: String, common: Boolean): String {
val sbUrl = url.substringBefore("/e/").substringBefore("/embed-")
val id = url.substringAfter("/e/")
val sbUrl = "https://${url.toHttpUrl().host}"
val id = url.substringAfter("${url.toHttpUrl().host}")
.substringAfter("/e/")
.substringAfter("/embed-")
.substringBefore("?")
.substringBefore(".html")
.substringAfter("/")
return if (common) {
val hexBytes = bytesToHex(id.toByteArray())
"$sbUrl/sources51/625a364258615242766475327c7c${hexBytes}7c7c4761574550654f7461566d347c7c73747265616d7362"