mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
fix some issues
This commit is contained in:
parent
592f1b5648
commit
bbd021fc6d
@ -38,7 +38,7 @@ object PlaylistsHelper {
|
||||
Playlists(
|
||||
id = it.playlist.id.toString(),
|
||||
name = it.playlist.name,
|
||||
thumbnail = it.playlist.thumbnailUrl,
|
||||
thumbnail = ProxyHelper.rewriteUrl(it.playlist.thumbnailUrl),
|
||||
videos = it.videos.size.toLong()
|
||||
)
|
||||
)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.github.libretube.extensions
|
||||
|
||||
import android.util.Log
|
||||
import com.github.libretube.api.obj.StreamItem
|
||||
import com.github.libretube.api.obj.Streams
|
||||
import com.github.libretube.db.obj.LocalPlaylistItem
|
||||
@ -24,7 +23,6 @@ fun Streams.toStreamItem(videoId: String): StreamItem {
|
||||
}
|
||||
|
||||
fun LocalPlaylistItem.toStreamItem(): StreamItem {
|
||||
Log.e("thumb", ProxyHelper.rewriteUrl(thumbnailUrl).toString())
|
||||
return StreamItem(
|
||||
url = videoId,
|
||||
title = title,
|
||||
|
@ -6,6 +6,9 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import java.net.URI
|
||||
import java.net.URLDecoder
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.*
|
||||
|
||||
object ProxyHelper {
|
||||
private fun getImageProxyUrl(): String? {
|
||||
@ -35,13 +38,14 @@ object ProxyHelper {
|
||||
|
||||
runCatching {
|
||||
val originalUri = URI(url)
|
||||
return URI(
|
||||
originalUri.scheme.lowercase(),
|
||||
proxyUrl,
|
||||
val newUri = URI(
|
||||
originalUri.scheme.lowercase(Locale.US),
|
||||
URI(proxyUrl).authority,
|
||||
originalUri.path,
|
||||
originalUri.query,
|
||||
originalUri.fragment
|
||||
).toString()
|
||||
)
|
||||
return URLDecoder.decode(newUri.toString(), StandardCharsets.UTF_8.toString())
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user