Skip to content

Commit

Permalink
fix(lib/playlist-utils): Revert #3032 (#3039)
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudemirovsky authored Mar 10, 2024
1 parent fba3cd4 commit e924e0a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import okhttp3.internal.commonEmptyHeaders
Expand Down Expand Up @@ -106,8 +105,9 @@ class PlaylistUtils(private val client: OkHttpClient, private val headers: Heade
val masterUrlBasePath = playlistHttpUrl.newBuilder().apply {
removePathSegment(playlistHttpUrl.pathSize - 1)
addPathSegment("")
query(null)
fragment(null)
}.build()
}.build().toString()

// Get subtitles
val subtitleTracks = subtitleList + SUBTITLE_REGEX.findAll(masterPlaylist).mapNotNull {
Expand Down Expand Up @@ -146,14 +146,14 @@ class PlaylistUtils(private val client: OkHttpClient, private val headers: Heade
}
}

private fun getAbsoluteUrl(url: String, playlistUrl: String, masterBase: HttpUrl): String? {
private fun getAbsoluteUrl(url: String, playlistUrl: String, masterBase: String): String? {
return when {
url.isEmpty() -> null
url.startsWith("http") -> url
url.startsWith("//") -> "https:$url"
url.startsWith("/") -> playlistUrl.toHttpUrl().newBuilder().encodedPath("/").build().toString()
.substringBeforeLast("/") + url
else -> masterBase.newBuilder().addEncodedPathSegments(url).build().toString()
else -> masterBase + url
}
}

Expand Down

0 comments on commit e924e0a

Please sign in to comment.