mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
ура
This commit is contained in:
parent
5f28f4275e
commit
1a648f2541
1 changed files with 30 additions and 32 deletions
|
@ -133,8 +133,7 @@ module.exports = {
|
||||||
if (query.startsWith("https") && playdl.yt_validate(query) === "video") {
|
if (query.startsWith("https") && playdl.yt_validate(query) === "video") {
|
||||||
if (query.includes("music.youtube")) {
|
if (query.includes("music.youtube")) {
|
||||||
const info = await playdl.video_info(query);
|
const info = await playdl.video_info(query);
|
||||||
if(!info)
|
if(!info) return resolve({ playlist: null, info: null });
|
||||||
return resolve({ playlist: null, info: null });
|
|
||||||
const track = {
|
const track = {
|
||||||
title: info.video_details.title,
|
title: info.video_details.title,
|
||||||
duration: info.video_details.durationInSec * 1000,
|
duration: info.video_details.durationInSec * 1000,
|
||||||
|
@ -155,20 +154,19 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const info = await playdl.video_info(query);
|
const info = await playdl.video_info(query);
|
||||||
if(!info)
|
if(!info) return resolve({ playlist: null, info: null });
|
||||||
return resolve({ playlist: null, info: null });
|
|
||||||
|
|
||||||
const track = {
|
const track = {
|
||||||
title: info[0].title,
|
title: info.video_details.title,
|
||||||
duration: info[0].duration,
|
duration: info.video_details.durationInSec * 1000,
|
||||||
thumbnail: info[0].thumbnail ? info[0].thumbnail.url : null,
|
thumbnail: info.video_details.thumbnails[0].url,
|
||||||
async engine() {
|
async engine() {
|
||||||
return (await playdl.stream(`https://youtu.be/${info[0].id}`, { discordPlayerCompatibility : true })).stream;
|
return (await playdl.stream(info.video_details.url, { discordPlayerCompatibility : true })).stream;
|
||||||
},
|
},
|
||||||
views: info[0].views,
|
views: info.video_details.views,
|
||||||
author: info[0].channel.name,
|
author: info.video_details.channel.name,
|
||||||
description: "",
|
description: "",
|
||||||
url: `https://youtu.be/${info[0].id}`,
|
url: info.video_details.url,
|
||||||
related_videos: info.related_videos,
|
related_videos: info.related_videos,
|
||||||
raw: info,
|
raw: info,
|
||||||
source: "youtube-custom"
|
source: "youtube-custom"
|
||||||
|
@ -182,7 +180,7 @@ module.exports = {
|
||||||
return {
|
return {
|
||||||
title: track.title,
|
title: track.title,
|
||||||
duration: track.durationInSec * 1000,
|
duration: track.durationInSec * 1000,
|
||||||
thumbnail: track.thumbnails ? track.thumbnails[0] ? track.thumbnails[0].url : null : null,
|
thumbnail: track.thumbnails[0].url,
|
||||||
async engine() {
|
async engine() {
|
||||||
return (await playdl.stream(`https://music.youtube.com/watch?v=${track.id}`, { discordPlayerCompatibility : true })).stream;
|
return (await playdl.stream(`https://music.youtube.com/watch?v=${track.id}`, { discordPlayerCompatibility : true })).stream;
|
||||||
},
|
},
|
||||||
|
@ -240,28 +238,28 @@ module.exports = {
|
||||||
return resolve({ playlist: playlist, info: tracks });
|
return resolve({ playlist: playlist, info: tracks });
|
||||||
}
|
}
|
||||||
|
|
||||||
const search = await Youtube.search(query, { limit: 5, type: "video", safeSearch: true });
|
const search = await playdl.search(query, {
|
||||||
|
limit: 1
|
||||||
|
});
|
||||||
|
|
||||||
if(search && search.length) {
|
if (search) {
|
||||||
const tracks = search.map(async track => {
|
const track = {
|
||||||
const related = (await playdl.video_info(track.url)).related_videos;
|
title: search[0].title,
|
||||||
|
duration: search[0].durationInSec * 1000,
|
||||||
|
thumbnail: search[0].thumbnails[0].url,
|
||||||
|
async engine() {
|
||||||
|
return (await playdl.stream(search[0].url, { discordPlayerCompatibility : true })).stream;
|
||||||
|
},
|
||||||
|
views: search[0].views,
|
||||||
|
author: search[0].channel.name,
|
||||||
|
description: "",
|
||||||
|
url: search[0].url,
|
||||||
|
related_videos: search[0].related_videos,
|
||||||
|
raw: search[0],
|
||||||
|
source: "youtube-custom"
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return resolve({ playlist: null, info: [track] });
|
||||||
title: track.title,
|
|
||||||
duration: track.duration,
|
|
||||||
thumbnail: track.thumbnail ? track.thumbnail.url : null,
|
|
||||||
async engine() {
|
|
||||||
return (await playdl.stream(`https://youtu.be/${track.id}`, { discordPlayerCompatibility: true })).stream;
|
|
||||||
},
|
|
||||||
views: track.views,
|
|
||||||
author: track.channel.name,
|
|
||||||
description: "",
|
|
||||||
url: `https://youtu.be/${track.id}`,
|
|
||||||
related_videos: related,
|
|
||||||
source: "youtube-custom"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
return resolve({ playlist: null, info: tracks });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolve({ playlist: null, info: null });
|
return resolve({ playlist: null, info: null });
|
||||||
|
|
Loading…
Reference in a new issue