From a88149332b0b95435e26e7268b445bfed108d824 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Sat, 6 Aug 2022 21:51:42 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B8=20?= =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=D0=B0=20=D0=B0=D0=B2=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D1=81=D0=BF=D1=80=D0=BE=D0=B8=D0=B7=D0=B2=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B5=D0=BD=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=B6=D1=83=20discord-player?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helpers/extractor.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/helpers/extractor.js b/helpers/extractor.js index debe4071..d2ea5cd0 100644 --- a/helpers/extractor.js +++ b/helpers/extractor.js @@ -146,14 +146,16 @@ module.exports = { author: info.video_details.channel.name, description: "", url: `https://music.youtube.com/watch?v=${info.video_details.id}`, + related_videos: info.related_videos, + raw: info, source: "youtube-music-custom" }; return resolve({ playlist: null, info: [track] }); } - const info = await Youtube.search(query, { limit: 1, type: "video", safeSearch: true }); - if(!info || !info.length) + const info = await playdl.video_info(query); + if(!info) return resolve({ playlist: null, info: null }); const track = { @@ -167,6 +169,8 @@ module.exports = { author: info[0].channel.name, description: "", url: `https://youtu.be/${info[0].id}`, + related_videos: info.related_videos, + raw: info, source: "youtube-custom" }; return resolve({ playlist: null, info: [track] }); @@ -185,6 +189,7 @@ module.exports = { author: track.channel.name, description: "", url: track.url, + raw: info, source: "youtube-custom" }; }); @@ -205,7 +210,9 @@ module.exports = { const search = await Youtube.search(query, { limit: 5, type: "video", safeSearch: true }); if(search && search.length) { - const tracks = search.map(track => { + const tracks = search.map(async track => { + const related = (await playdl.video_info(track.url)).related_videos; + return { title: track.title, duration: track.duration, @@ -217,6 +224,7 @@ module.exports = { author: track.channel.name, description: "", url: `https://youtu.be/${track.id}`, + related_videos: related, source: "youtube-custom" }; });