Dislike count added

This commit is contained in:
killer069
2021-12-08 09:47:26 +05:30
parent 68f435a658
commit f5da982b58
3 changed files with 23 additions and 19 deletions

View File

@@ -55,6 +55,10 @@ interface VideoOptions {
* YouTube Video's dislikes
*/
dislikes: number;
/**
* YouTube Video's average Rating
*/
averageRating: number;
/**
* YouTube Video live status
*/
@@ -124,6 +128,10 @@ export class YouTubeVideo {
* YouTube Video's dislikes
*/
dislikes: number;
/**
* YouTube Video's average Rating
*/
averageRating: number;
/**
* YouTube Video live status
*/
@@ -155,7 +163,8 @@ export class YouTubeVideo {
this.thumbnail = new YouTubeThumbnail(data.thumbnail) || {};
this.channel = new YouTubeChannel(data.channel) || {};
this.likes = data.likes || 0;
this.dislikes = data.dislikes || 0;
this.averageRating = data.averageRating || 0;
this.dislikes = Math.floor((this.likes * (5 - this.averageRating)) / (this.averageRating - 1)) || 0;
this.live = !!data.live;
this.private = !!data.private;
this.tags = data.tags || [];
@@ -186,6 +195,7 @@ export class YouTubeVideo {
tags: this.tags,
likes: this.likes,
dislikes: this.dislikes,
averageRating: this.averageRating,
live: this.live,
private: this.private
};