music: hopefully fix youtube cutoff from expiring urls

This commit is contained in:
Cynthia Foxwell 2023-05-12 16:06:14 -06:00
parent 9462411e56
commit 9f6d2e95ed

View file

@ -206,8 +206,8 @@ async function enqueue({
if (type == "yt") {
let info;
let id = url;
try {
let id = url;
if (/^https?:\/\//.test(url)) {
const uri = new URL(url);
if (uri.hostname == "youtu.be") {
@ -229,9 +229,7 @@ async function enqueue({
.replace("vi_webp", "vi")
.replace(".webp", ".jpg");
media = info
?.chooseFormat({type: "audio", quality: "best"})
?.decipher(yt.session.player);
media = await yt.download(id, {type: "audio", quality: "best"});
} else if (type == "sc") {
if (url?.startsWith("sc:"))
url = url.replace(/^sc:/, "https://soundcloud.com/");