Fix #49
This commit is contained in:
parent
f7a6481323
commit
6c15889360
|
@ -481,7 +481,7 @@ object YouTube {
|
|||
info = Info(
|
||||
name = renderer
|
||||
.title
|
||||
.text,
|
||||
?.text ?: return@let null,
|
||||
endpoint = renderer
|
||||
.navigationEndpoint
|
||||
.watchEndpoint
|
||||
|
@ -504,7 +504,7 @@ object YouTube {
|
|||
.getOrNull(0),
|
||||
durationText = renderer
|
||||
.lengthText
|
||||
.text
|
||||
?.text
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -592,12 +592,12 @@ object YouTube {
|
|||
?.playlistPanelRenderer
|
||||
?.contents
|
||||
?.mapNotNull { it.playlistPanelVideoRenderer }
|
||||
?.map { renderer ->
|
||||
?.mapNotNull { renderer ->
|
||||
Item.Song(
|
||||
info = Info(
|
||||
name = renderer
|
||||
.title
|
||||
.text,
|
||||
?.text ?: return@mapNotNull null,
|
||||
endpoint = renderer
|
||||
.navigationEndpoint
|
||||
.watchEndpoint
|
||||
|
@ -620,7 +620,7 @@ object YouTube {
|
|||
.firstOrNull(),
|
||||
durationText = renderer
|
||||
.lengthText
|
||||
.text
|
||||
?.text
|
||||
)
|
||||
},
|
||||
lyrics = NextResult.Lyrics(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue