From 2e822fbc68d3304e792a5d8ef8761cb757a19ef8 Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 24 Aug 2023 19:22:16 +0000 Subject: [PATCH] switch to undici :3 --- src/libpoketube/init/pages-channel-and-download.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libpoketube/init/pages-channel-and-download.js b/src/libpoketube/init/pages-channel-and-download.js index e72092aa..772cd466 100644 --- a/src/libpoketube/init/pages-channel-and-download.js +++ b/src/libpoketube/init/pages-channel-and-download.js @@ -125,6 +125,7 @@ module.exports = function (app, config, renderTemplate) { }); app.get("/channel/", async (req, res) => { + const { fetch } = await import("undici"); try { const ID = req.query.id; const tab = req.query.tab; @@ -132,7 +133,7 @@ module.exports = function (app, config, renderTemplate) { try { // about - const bout = await modules.fetch( + const bout = await fetch( config.tubeApi + `channel?id=${ID}&tab=about` ); const h = await bout.text(); @@ -154,8 +155,7 @@ module.exports = function (app, config, renderTemplate) { const getChannelData = async (url) => { try { - return await modules - .fetch(url) + return await fetch(url) .then((res) => res.text()) .then((txt) => getJson(txt)); } catch (error) { @@ -176,7 +176,7 @@ module.exports = function (app, config, renderTemplate) { `https://invid-api.poketube.fun/api/v1/channels/${ID}/` ); var cPromise = getChannelData( - `https://invid-api.poketube.fun/api/v1/channels/community/${ID}/` + `https://invid-api.poketube.fun/api/v1/channels/community/${ID}/?hl=en-US` ); var tj = await tjPromise; var shorts = await shortsPromise;