music: more yt fixes
This commit is contained in:
parent
046b49666d
commit
a68d11f89b
1 changed files with 13 additions and 3 deletions
|
@ -4,7 +4,11 @@ const playdl = require("play-dl");
|
||||||
const ffprobe = require("node-ffprobe");
|
const ffprobe = require("node-ffprobe");
|
||||||
|
|
||||||
const Command = require("../lib/command.js");
|
const Command = require("../lib/command.js");
|
||||||
const {formatTime, selectionMessage, parseHtmlEntities} = require("../lib/utils.js");
|
const {
|
||||||
|
formatTime,
|
||||||
|
selectionMessage,
|
||||||
|
parseHtmlEntities,
|
||||||
|
} = require("../lib/utils.js");
|
||||||
|
|
||||||
const REGEX_YOUTUBE = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/;
|
const REGEX_YOUTUBE = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/;
|
||||||
const REGEX_YOUTUBE_PLAYLIST =
|
const REGEX_YOUTUBE_PLAYLIST =
|
||||||
|
@ -214,8 +218,11 @@ async function enqueue({
|
||||||
.replace("vi_webp", "vi")
|
.replace("vi_webp", "vi")
|
||||||
.replace(".webp", ".jpg");
|
.replace(".webp", ".jpg");
|
||||||
|
|
||||||
const formats = info?.format;
|
let formats = info?.format;
|
||||||
if (formats) {
|
if (formats) {
|
||||||
|
formats = formats.filter(
|
||||||
|
(obj) => obj.audioQuality != null && obj.container == "webm"
|
||||||
|
);
|
||||||
formats.sort((a, b) => b.bitrate - a.bitrate);
|
formats.sort((a, b) => b.bitrate - a.bitrate);
|
||||||
media = formats[0].url;
|
media = formats[0].url;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +302,10 @@ async function enqueue({
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "Title",
|
name: "Title",
|
||||||
value: (title && title != url ? `[${title}](${url})` : url).substring(0, 1024),
|
value: (title && title != url
|
||||||
|
? `[${title}](${url})`
|
||||||
|
: url
|
||||||
|
).substring(0, 1024),
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue