From 771ca7cebc8531e4bab7e60fb96f3f05a86a461f Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Tue, 10 Nov 2020 17:46:14 +0100 Subject: [PATCH] :bug: Fix videoDetails stuff Closes #143 --- src/Player.js | 12 +++++++++++- src/Track.js | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Player.js b/src/Player.js index a106773..5559d72 100644 --- a/src/Player.js +++ b/src/Player.js @@ -337,7 +337,17 @@ class Player extends EventEmitter { trackToPlay = query } else if (this.util.isYTVideoLink(query)) { const videoData = await ytdl.getBasicInfo(query) - trackToPlay = new Track(videoData, message.author) + trackToPlay = new Track({ + title: videoData.videoDetails.title, + url: videoData.videoDetails.video_url, + views: videoData.videoDetails.viewCount, + thumbnail: videoData.videoDetails.thumbnail.thumbnails[0], + lengthSeconds: videoData.videoDetails.lengthSeconds, + description: videoData.videoDetails.shortDescription, + author: { + name: videoData.videoDetails.author.name + } + }, message.author, this) } else { trackToPlay = await this._searchTracks(message, query) } diff --git a/src/Track.js b/src/Track.js index 3983042..8708c8f 100644 --- a/src/Track.js +++ b/src/Track.js @@ -32,7 +32,7 @@ class Track { * @type {string} */ this.duration = videoData.durationFormatted || - `${Math.floor(parseInt(videoData.videoDetails.lengthSeconds) / 60)}:${parseInt(videoData.videoDetails.lengthSeconds) % 60}` + `${Math.floor(parseInt(videoData.lengthSeconds) / 60)}:${parseInt(videoData.lengthSeconds) % 60}` /** * The video description * @type {string}