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

@@ -38,6 +38,10 @@ interface VideoOptions {
* YouTube Video Uploaded Date
*/
uploadedAt?: string;
/**
* If the video is upcoming or a premiere that isn't currently live, this will contain the premiere date, for watch page playlists this will be true, it defaults to undefined
*/
upcoming?: Date | true;
/**
* YouTube Views
*/
@@ -115,6 +119,10 @@ export class YouTubeVideo {
* YouTube Video Uploaded Date
*/
uploadedAt?: string;
/**
* If the video is upcoming or a premiere that isn't currently live, this will contain the premiere date, for watch page playlists this will be true, it defaults to undefined
*/
upcoming?: Date | true;
/**
* YouTube Views
*/
@@ -166,6 +174,7 @@ export class YouTubeVideo {
this.durationRaw = data.duration_raw || '0:00';
this.durationInSec = (data.duration < 0 ? 0 : data.duration) || 0;
this.uploadedAt = data.uploadedAt || undefined;
this.upcoming = data.upcoming;
this.views = parseInt(data.views) || 0;
const thumbnails = [];
for (const thumb of data.thumbnails) {