music: format no s

This commit is contained in:
Cynthia Foxwell 2023-01-23 18:10:06 -07:00
parent f049e6f8fe
commit ad141377e7

View file

@ -4,7 +4,7 @@ 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} = 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 =
@ -206,14 +206,14 @@ async function enqueue({
}); });
} }
title = info?.video_details?.title; title = parseHtmlEntities(info?.video_details?.title);
length = info?.video_details?.durationInSec * 1000; length = info?.video_details?.durationInSec * 1000;
thumbnail = info?.video_details?.thumbnails?.[ thumbnail = info?.video_details?.thumbnails?.[
info.video_details.thumbnails.length - 1 info.video_details.thumbnails.length - 1
].url ].url
.replace("vi_webp", "vi") .replace("vi_webp", "vi")
.replace(".webp", ".jpg"); .replace(".webp", ".jpg");
media = {url: info?.formats.sort((a, b) => b.bitrate - a.bitrate)[0].url}; media = {url: info?.format.sort((a, b) => b.bitrate - a.bitrate)[0].url};
} else if (type == "sc") { } else if (type == "sc") {
if (url?.startsWith("sc:")) if (url?.startsWith("sc:"))
url = url.replace(/^sc:/, "https://soundcloud.com/"); url = url.replace(/^sc:/, "https://soundcloud.com/");