Add support for upcoming videos, adding the upcoming property to YouTubeVideo

This commit is contained in:
absidue
2022-01-26 19:34:49 +01:00
parent 2c7e94402c
commit 285465a1c6
4 changed files with 53 additions and 11 deletions

View File

@@ -146,6 +146,9 @@ export function parseVideo(data?: any): YouTubeVideo {
artist: Boolean(badge?.includes('artist'))
},
uploadedAt: data.videoRenderer.publishedTimeText?.simpleText ?? null,
upcoming: data.videoRenderer.upcomingEventData?.startTime
? new Date(parseInt(data.videoRenderer.upcomingEventData.startTime) * 1000)
: undefined,
views: data.videoRenderer.viewCountText?.simpleText?.replace(/\D/g, '') ?? 0,
live: durationText ? false : true
});