chore: bump ytdl-core and fix warnings (#199)

This commit is contained in:
Casper 2020-12-22 10:06:54 +01:00 committed by GitHub
parent b1c9db3956
commit c46a7282bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -37,7 +37,7 @@
"soundcloud-scraper": "^4.0.0", "soundcloud-scraper": "^4.0.0",
"spotify-url-info": "^2.2.0", "spotify-url-info": "^2.2.0",
"youtube-sr": "^2.0.1", "youtube-sr": "^2.0.1",
"ytdl-core": "^4.0.6" "ytdl-core": "^4.2.1"
}, },
"devDependencies": { "devDependencies": {
"@discordjs/opus": "^0.3.2", "@discordjs/opus": "^0.3.2",

View file

@ -327,13 +327,14 @@ 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)
const lastThumbnail = videoData.videoDetails.thumbnails.length - 1 /* get the highest quality thumbnail */
trackToPlay = new Track({ trackToPlay = new Track({
title: videoData.videoDetails.title, title: videoData.videoDetails.title,
url: videoData.videoDetails.video_url, url: videoData.videoDetails.video_url,
views: videoData.videoDetails.viewCount, views: videoData.videoDetails.viewCount,
thumbnail: videoData.videoDetails.thumbnail.thumbnails[0], thumbnail: videoData.videoDetails.thumbnails[lastThumbnail],
lengthSeconds: videoData.videoDetails.lengthSeconds, lengthSeconds: videoData.videoDetails.lengthSeconds,
description: videoData.videoDetails.shortDescription, description: videoData.videoDetails.description,
author: { author: {
name: videoData.videoDetails.author.name name: videoData.videoDetails.author.name
} }