From 08167fd3ad9b0f8bf7dce3730e3d7dbe41ef6f9f Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Sat, 6 Aug 2022 22:26:53 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=BB=D0=B5=D0=B9=D0=BB=D0=B8=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=20=D1=81=20Youtube=20Music-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helpers/extractor.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/helpers/extractor.js b/helpers/extractor.js index d2ea5cd0..2f1fdb9d 100644 --- a/helpers/extractor.js +++ b/helpers/extractor.js @@ -137,7 +137,7 @@ module.exports = { return resolve({ playlist: null, info: null }); const track = { title: info.video_details.title, - duration: info.video_details.durationInSec, + duration: info.video_details.durationInSec * 1000, thumbnail: info.video_details.thumbnails[0].url, async engine() { return (await playdl.stream(`https://music.youtube.com/watch?v=${info.video_details.id}`, { discordPlayerCompatibility : true })).stream; @@ -175,6 +175,39 @@ module.exports = { }; return resolve({ playlist: null, info: [track] }); } else if (playdl.yt_validate(query) === "playlist") { + if (query.includes("music.youtube")) { + const info = await playdl.playlist_info(query, { incomplete: true }); + const trackList = await info.videos; + const tracks = trackList.map(track => { + return { + title: track.title, + duration: track.durationInSec * 1000, + thumbnail: track.thumbnails ? track.thumbnails[0] ? track.thumbnails[0].url : null : null, + async engine() { + return (await playdl.stream(`https://music.youtube.com/watch?v=${track.id}`, { discordPlayerCompatibility : true })).stream; + }, + views: track.views, + author: track.channel.name, + description: "", + url: track.url, + raw: info, + source: "youtube-music-playlist-custom" + }; + }); + const playlist = { + title: info.title, + description: "", + thumbnail: info.thumbnail ? info.thumbnail.url : null, + type: "playlist", + source: "youtube-music-playlist-custom", + author: info.channel.name, + id: info.id, + url: info.url, + rawPlaylist: info + }; + return resolve({ playlist: playlist, info: tracks }); + } + const info = await playdl.playlist_info(query, { incomplete: true }); const trackList = await info.all_videos(); const tracks = trackList.map(track => {