This commit is contained in:
vfsfitvnm
2022-06-19 11:24:11 +02:00
parent f7a6481323
commit 6c15889360
4 changed files with 11 additions and 19 deletions

View File

@@ -30,10 +30,10 @@ data class NextResponse(
) {
@Serializable
data class PlaylistPanelVideoRenderer(
val title: Runs,
val title: Runs?,
val longBylineText: Runs?,
val shortBylineText: Runs,
val lengthText: Runs,
val shortBylineText: Runs?,
val lengthText: Runs?,
val navigationEndpoint: NavigationEndpoint,
val thumbnail: ThumbnailRenderer.MusicThumbnailRenderer.Thumbnail,
val videoId: String,

View File

@@ -8,7 +8,7 @@ data class PlayerResponse(
val playabilityStatus: PlayabilityStatus,
val playerConfig: PlayerConfig?,
val streamingData: StreamingData?,
val videoDetails: VideoDetails,
val videoDetails: VideoDetails?,
) {
@Serializable
data class PlayabilityStatus(

View File

@@ -20,20 +20,12 @@ data class ThumbnailRenderer(
@Serializable
data class Thumbnail(
val url: String,
val height: Int,
val width: Int
val height: Int?,
val width: Int?
) {
val isResizable: Boolean
get() = !url.startsWith("https://i.ytimg.com")
fun width(width: Int): String {
return when {
url.startsWith("https://lh3.googleusercontent.com") -> "$url-w$width-h${width * height / this.width}"
url.startsWith("https://yt3.ggpht.com") -> "$url-s$width"
else -> url
}
}
fun size(size: Int): String {
return when {
url.startsWith("https://lh3.googleusercontent.com") -> "$url-w$size-h$size"