Support YouTube shorts

This commit is contained in:
2023-04-23 19:53:44 +07:00
parent 17466ca74f
commit aa67b16418
+12
View File
@@ -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
};