From 1cde1c23ef33845f0bafbc7bd48a75f751f9cebe Mon Sep 17 00:00:00 2001 From: ashley Date: Thu, 24 Oct 2024 13:47:30 +0000 Subject: [PATCH] test --- .../init/pages-channel-and-download.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/libpoketube/init/pages-channel-and-download.js b/src/libpoketube/init/pages-channel-and-download.js index 293aa8b2..df31db7e 100644 --- a/src/libpoketube/init/pages-channel-and-download.js +++ b/src/libpoketube/init/pages-channel-and-download.js @@ -153,15 +153,17 @@ module.exports = function (app, config, renderTemplate) { try { const headers = {}; - const xmlData = await fetch( - `${config.invapi}/search?q=${encodeURIComponent( - query - )}&page=${encodeURIComponent( - continuation - )}&date=${date}&type=${type}&duration=${duration}&sort=${sort}&hl=en+gb` - ) - .then((res) => res.text()) - .then((txt) => getJson(txt)); +let searchUrl; +if (req.query.from === 'hashtag') { + searchUrl = `/hashtag/${encodeURIComponent(query)}`; +} else { + searchUrl = `${config.invapi}/search?q=${encodeURIComponent(query)}&page=${encodeURIComponent(continuation)}&date=${date}&type=${type}&duration=${duration}&sort=${sort}&hl=en+gb`; +} + +const xmlData = await fetch(searchUrl) + .then((res) => res.text()) + .then((txt) => getJson(txt)); + renderTemplate(res, req, "search.ejs", { invresults: xmlData,