🐛 Fix videoDetails stuff

Closes #143
This commit is contained in:
Androz2091 2020-11-10 17:46:14 +01:00
parent a26b764b71
commit 771ca7cebc
2 changed files with 12 additions and 2 deletions

View file

@ -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)
}

View file

@ -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}