mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-10 04:01:37 +02:00
parent
4bce011b0c
commit
fcbff53a7a
3 changed files with 21 additions and 3 deletions
|
@ -34,7 +34,16 @@ export default class {
|
|||
|
||||
async youtubeVideo(url: string): Promise<QueuedSong|null> {
|
||||
try {
|
||||
const videoDetails = await this.youtube.videos.get(url);
|
||||
// Clean URL
|
||||
const u = new URL(url);
|
||||
|
||||
for (const [name] of u.searchParams) {
|
||||
if (name !== 'v') {
|
||||
u.searchParams.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
const videoDetails = await this.youtube.videos.get(u.toString());
|
||||
|
||||
return {
|
||||
title: videoDetails.snippet.title,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue