use undici instead :3

This commit is contained in:
Ashley 2023-11-01 15:53:37 +00:00
parent 7774ba67dd
commit 4e586e9cbd

View file

@ -65,6 +65,7 @@ module.exports = function (app, config, renderTemplate) {
app.get("/search", async (req, res) => {
const query = req.query.query;
const tab = req.query.tab;
const { fetch } = await import("undici");
const search = require("google-it");
@ -107,11 +108,9 @@ module.exports = function (app, config, renderTemplate) {
const searchUrl = `https://inner-api.poketube.fun/api/search?query=${encodeURIComponent(
query
)}&continuation=${encodeURIComponent(continuation)}`;
const { data } = await curly.get(searchUrl, {
httpHeader: Object.entries(headers).map(([k, v]) => `${k}: ${v}`),
});
const searchText = modules.toJson(data);
const searchJson = getJson(searchText);
const player = await fetch(searchUrl);
const xmlData = await player.text();
const searchJson = JSON.parse(modules.toJson(xmlData));
let didYouMean;
if (