music: fix youtube

This commit is contained in:
Cynthia Foxwell 2023-05-22 20:15:25 -06:00
parent 373ad3e604
commit 45ab537a59

View file

@ -1,5 +1,6 @@
const {Collection} = require("@projectdysnomia/dysnomia"); const {Collection} = require("@projectdysnomia/dysnomia");
const {Readable} = require("node:stream");
const {Innertube} = require("youtubei.js"); const {Innertube} = require("youtubei.js");
let yt; let yt;
Innertube.create({ Innertube.create({
@ -229,7 +230,9 @@ async function enqueue({
.replace("vi_webp", "vi") .replace("vi_webp", "vi")
.replace(".webp", ".jpg"); .replace(".webp", ".jpg");
media = await yt.download(id, {type: "audio", quality: "best"}); media = Readable.from(
await yt.download(id, {type: "audio", quality: "best"})
);
} 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/");