mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
Попытки фикса автовоспроизведения
ненавижу discord-player
This commit is contained in:
parent
35e4faf411
commit
a88149332b
1 changed files with 11 additions and 3 deletions
|
@ -146,14 +146,16 @@ module.exports = {
|
||||||
author: info.video_details.channel.name,
|
author: info.video_details.channel.name,
|
||||||
description: "",
|
description: "",
|
||||||
url: `https://music.youtube.com/watch?v=${info.video_details.id}`,
|
url: `https://music.youtube.com/watch?v=${info.video_details.id}`,
|
||||||
|
related_videos: info.related_videos,
|
||||||
|
raw: info,
|
||||||
source: "youtube-music-custom"
|
source: "youtube-music-custom"
|
||||||
};
|
};
|
||||||
|
|
||||||
return resolve({ playlist: null, info: [track] });
|
return resolve({ playlist: null, info: [track] });
|
||||||
}
|
}
|
||||||
|
|
||||||
const info = await Youtube.search(query, { limit: 1, type: "video", safeSearch: true });
|
const info = await playdl.video_info(query);
|
||||||
if(!info || !info.length)
|
if(!info)
|
||||||
return resolve({ playlist: null, info: null });
|
return resolve({ playlist: null, info: null });
|
||||||
|
|
||||||
const track = {
|
const track = {
|
||||||
|
@ -167,6 +169,8 @@ module.exports = {
|
||||||
author: info[0].channel.name,
|
author: info[0].channel.name,
|
||||||
description: "",
|
description: "",
|
||||||
url: `https://youtu.be/${info[0].id}`,
|
url: `https://youtu.be/${info[0].id}`,
|
||||||
|
related_videos: info.related_videos,
|
||||||
|
raw: info,
|
||||||
source: "youtube-custom"
|
source: "youtube-custom"
|
||||||
};
|
};
|
||||||
return resolve({ playlist: null, info: [track] });
|
return resolve({ playlist: null, info: [track] });
|
||||||
|
@ -185,6 +189,7 @@ module.exports = {
|
||||||
author: track.channel.name,
|
author: track.channel.name,
|
||||||
description: "",
|
description: "",
|
||||||
url: track.url,
|
url: track.url,
|
||||||
|
raw: info,
|
||||||
source: "youtube-custom"
|
source: "youtube-custom"
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -205,7 +210,9 @@ module.exports = {
|
||||||
const search = await Youtube.search(query, { limit: 5, type: "video", safeSearch: true });
|
const search = await Youtube.search(query, { limit: 5, type: "video", safeSearch: true });
|
||||||
|
|
||||||
if(search && search.length) {
|
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 {
|
return {
|
||||||
title: track.title,
|
title: track.title,
|
||||||
duration: track.duration,
|
duration: track.duration,
|
||||||
|
@ -217,6 +224,7 @@ module.exports = {
|
||||||
author: track.channel.name,
|
author: track.channel.name,
|
||||||
description: "",
|
description: "",
|
||||||
url: `https://youtu.be/${track.id}`,
|
url: `https://youtu.be/${track.id}`,
|
||||||
|
related_videos: related,
|
||||||
source: "youtube-custom"
|
source: "youtube-custom"
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue