use undici instead :3

This commit is contained in:
Ashley 2023-09-17 19:43:43 +00:00
parent cbc4cbd1b5
commit d9846a4a6c

View file

@ -64,13 +64,15 @@ module.exports = function (app, config, renderTemplate) {
}); });
app.get("/api/subtitles", async (req, res) => { app.get("/api/subtitles", async (req, res) => {
const { fetch } = await import("undici");
const id = req.query.v; const id = req.query.v;
const l = req.query.h; const l = req.query.h;
try { try {
let url = `https://invid-api.poketube.fun/api/v1/captions/${id}?label=${l}`; let url = `https://invid-api.poketube.fun/api/v1/captions/${id}?label=${l}`;
let f = await modules.fetch(url); let f = await fetch(url);
const body = await f.text(); const body = await f.text();
res.send(body); res.send(body);