diff --git a/src/libpoketube/init/pages-channel-and-download.js b/src/libpoketube/init/pages-channel-and-download.js index 9aecacc9..65fdb87e 100644 --- a/src/libpoketube/init/pages-channel-and-download.js +++ b/src/libpoketube/init/pages-channel-and-download.js @@ -162,9 +162,10 @@ module.exports = function (app, config, renderTemplate) { } }); - app.get("/web", async (req, res) => { + app.get("/im-feeling-lucky", function (req, res) { const query = req.query.query; - const tab = req.query.tab; + + const search = require("google-it"); const getRandomLinkAndRedirect = (query, res) => { search({ query: `${query}` }).then((results) => { @@ -188,12 +189,18 @@ module.exports = function (app, config, renderTemplate) { }); }; + getRandomLinkAndRedirect(query, res); + }); + + app.get("/web", async (req, res) => { + const query = req.query.query; + const tab = req.query.tab; + const search = require("google-it"); - if (req.query.lk === "true") { - getRandomLinkAndRedirect(query, res); - } - + if (req.query.lucky === 'true') { + res.redirect('/im-feeling-lucky?query=' + query) + } var uaos = req.useragent.os; var IsOldWindows;