From aa67b164186bd418a54249852b12963ff65357a5 Mon Sep 17 00:00:00 2001 From: Yuzu Date: Sun, 23 Apr 2023 19:50:43 +0700 Subject: [PATCH] Support YouTube shorts --- src/providers/DiscordMusicPlayer.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/providers/DiscordMusicPlayer.ts b/src/providers/DiscordMusicPlayer.ts index 37c0db8..5f9eac4 100644 --- a/src/providers/DiscordMusicPlayer.ts +++ b/src/providers/DiscordMusicPlayer.ts @@ -683,6 +683,18 @@ class DiscordMusicPlayer { if (!videoId) throw new Error('YouTube link is invalid'); if (query.split('/')[4]) throw new Error('YouTube link is invalid'); + return { + videoId: videoId + }; + } else if ( + query.startsWith('https://www.youtube.com/shorts/') || + query.startsWith('http://www.youtube.com/shorts/') + ) { + let videoId = query.split('/')[4]; + + if (!videoId) throw new Error('YouTube link is invalid'); + if (query.split('/')[5]) throw new Error('YouTube link is invalid'); + return { videoId: videoId };