Fix YouTubeVideo JSON serialisation
This commit is contained in:
parent
4c8162ecdd
commit
9c002e210c
@ -15,11 +15,7 @@ interface VideoOptions {
|
|||||||
height: number | undefined;
|
height: number | undefined;
|
||||||
url: string | undefined;
|
url: string | undefined;
|
||||||
};
|
};
|
||||||
channel?: {
|
channel?: any;
|
||||||
name: string;
|
|
||||||
id: string;
|
|
||||||
icon: string;
|
|
||||||
};
|
|
||||||
type: string;
|
type: string;
|
||||||
ratings: {
|
ratings: {
|
||||||
likes: number;
|
likes: number;
|
||||||
@ -68,7 +64,7 @@ export class YouTubeVideo {
|
|||||||
this.uploadedAt = data.uploadedAt || undefined;
|
this.uploadedAt = data.uploadedAt || undefined;
|
||||||
this.views = parseInt(data.views) || 0;
|
this.views = parseInt(data.views) || 0;
|
||||||
this.thumbnail = data.thumbnail || {};
|
this.thumbnail = data.thumbnail || {};
|
||||||
this.channel = data.channel || {};
|
this.channel = new YouTubeChannel(data.channel) || {};
|
||||||
this.likes = (data.ratings?.likes as number) || 0;
|
this.likes = (data.ratings?.likes as number) || 0;
|
||||||
this.dislikes = data.ratings?.dislikes || 0;
|
this.dislikes = data.ratings?.dislikes || 0;
|
||||||
this.live = !!data.live;
|
this.live = !!data.live;
|
||||||
@ -90,11 +86,7 @@ export class YouTubeVideo {
|
|||||||
durationRaw: this.durationRaw,
|
durationRaw: this.durationRaw,
|
||||||
uploadedAt: this.uploadedAt,
|
uploadedAt: this.uploadedAt,
|
||||||
thumbnail: this.thumbnail,
|
thumbnail: this.thumbnail,
|
||||||
channel: {
|
channel: this.channel,
|
||||||
name: this.channel?.name as string,
|
|
||||||
id: this.channel?.id as string,
|
|
||||||
icon: this.channel?.iconURL() as string
|
|
||||||
},
|
|
||||||
views: this.views,
|
views: this.views,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
tags: this.tags,
|
tags: this.tags,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user