diff --git a/src/Player.ts b/src/Player.ts index 69d9a7c..b966d53 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -488,7 +488,7 @@ export class Player extends EventEmitter { if (typeof query === 'string') query = query.replace(/<(.+)>/g, '$1'); let track; - if (query instanceof Track) track = query; + if (query instanceof Track) query = query.url; else { for (const [_, extractor] of this.Extractors) { if (extractor.validate(query)) { @@ -513,28 +513,7 @@ export class Player extends EventEmitter { } } - if (!track && ytdl.validateURL(query)) { - const info = await ytdl.getBasicInfo(query).catch(() => {}); - if (!info) return void this.emit(PlayerEvents.NO_RESULTS, message, query); - if (info.videoDetails.isLiveContent && !this.options.enableLive) return void this.emit(PlayerEvents.ERROR, PlayerErrorEventCodes.LIVE_VIDEO, message, new PlayerError('Live video is not enabled!')); - const lastThumbnail = info.videoDetails.thumbnails[info.videoDetails.thumbnails.length - 1]; - - track = new Track(this, { - title: info.videoDetails.title, - description: info.videoDetails.description, - author: info.videoDetails.author.name, - url: info.videoDetails.video_url, - thumbnail: lastThumbnail.url, - duration: Util.buildTimeCode(Util.parseMS(parseInt(info.videoDetails.lengthSeconds) * 1000)), - views: parseInt(info.videoDetails.viewCount), - requestedBy: message.author, - fromPlaylist: false, - source: 'youtube', - live: Boolean(info.videoDetails.isLiveContent) - }); - } else { - if (!track) track = await this._searchTracks(message, query, firstResult); - } + if (!track) track = await this._searchTracks(message, query, firstResult); } if (track) {