mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-24 22:24:58 +05:00
Поддерка плейлистов с Youtube Music-
This commit is contained in:
parent
a88149332b
commit
08167fd3ad
1 changed files with 34 additions and 1 deletions
|
@ -137,7 +137,7 @@ module.exports = {
|
|||
return resolve({ playlist: null, info: null });
|
||||
const track = {
|
||||
title: info.video_details.title,
|
||||
duration: info.video_details.durationInSec,
|
||||
duration: info.video_details.durationInSec * 1000,
|
||||
thumbnail: info.video_details.thumbnails[0].url,
|
||||
async engine() {
|
||||
return (await playdl.stream(`https://music.youtube.com/watch?v=${info.video_details.id}`, { discordPlayerCompatibility : true })).stream;
|
||||
|
@ -175,6 +175,39 @@ module.exports = {
|
|||
};
|
||||
return resolve({ playlist: null, info: [track] });
|
||||
} else if (playdl.yt_validate(query) === "playlist") {
|
||||
if (query.includes("music.youtube")) {
|
||||
const info = await playdl.playlist_info(query, { incomplete: true });
|
||||
const trackList = await info.videos;
|
||||
const tracks = trackList.map(track => {
|
||||
return {
|
||||
title: track.title,
|
||||
duration: track.durationInSec * 1000,
|
||||
thumbnail: track.thumbnails ? track.thumbnails[0] ? track.thumbnails[0].url : null : null,
|
||||
async engine() {
|
||||
return (await playdl.stream(`https://music.youtube.com/watch?v=${track.id}`, { discordPlayerCompatibility : true })).stream;
|
||||
},
|
||||
views: track.views,
|
||||
author: track.channel.name,
|
||||
description: "",
|
||||
url: track.url,
|
||||
raw: info,
|
||||
source: "youtube-music-playlist-custom"
|
||||
};
|
||||
});
|
||||
const playlist = {
|
||||
title: info.title,
|
||||
description: "",
|
||||
thumbnail: info.thumbnail ? info.thumbnail.url : null,
|
||||
type: "playlist",
|
||||
source: "youtube-music-playlist-custom",
|
||||
author: info.channel.name,
|
||||
id: info.id,
|
||||
url: info.url,
|
||||
rawPlaylist: info
|
||||
};
|
||||
return resolve({ playlist: playlist, info: tracks });
|
||||
}
|
||||
|
||||
const info = await playdl.playlist_info(query, { incomplete: true });
|
||||
const trackList = await info.all_videos();
|
||||
const tracks = trackList.map(track => {
|
||||
|
|
Loading…
Reference in a new issue