parent
a26b764b71
commit
771ca7cebc
2 changed files with 12 additions and 2 deletions
|
@ -337,7 +337,17 @@ class Player extends EventEmitter {
|
||||||
trackToPlay = query
|
trackToPlay = query
|
||||||
} else if (this.util.isYTVideoLink(query)) {
|
} else if (this.util.isYTVideoLink(query)) {
|
||||||
const videoData = await ytdl.getBasicInfo(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 {
|
} else {
|
||||||
trackToPlay = await this._searchTracks(message, query)
|
trackToPlay = await this._searchTracks(message, query)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Track {
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.duration = videoData.durationFormatted ||
|
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
|
* The video description
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
|
Loading…
Reference in a new issue