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