1
0
Fork 0
mirror of https://codeberg.org/ashley/poke.git synced 2024-11-17 06:34:40 -05:00

Update server.js

This commit is contained in:
Ashley 2021-07-11 19:15:06 +03:00 committed by GitHub
parent 762ac9ecf5
commit 7ae2376e00

View file

@ -1,7 +1,5 @@
const path = require("path"); const path = require("path");
const templateDir = path.resolve(`${process.cwd()}${path.sep}html`); const templateDir = path.resolve(`${process.cwd()}${path.sep}html`);
var express = require("express"); var express = require("express");
var app = express(); var app = express();
app.engine("html", require("ejs").renderFile); app.engine("html", require("ejs").renderFile);
@ -16,7 +14,7 @@ const renderTemplate = async (res, req, template, data = {}) => {
app.get("/watch", function(req, res) { app.get("/watch", function(req, res) {
var url = req.query.v; var url = req.query.v;
var jth = `https://www.youtube.com/watch?v=${url}`; var uu = `https://www.youtube.com/watch?v=${url}`;
var search = require("youtube-search"); var search = require("youtube-search");
var opts = { var opts = {
@ -25,7 +23,7 @@ app.get("/watch", function(req, res) {
}; };
const fetch = require("node-fetch"); const fetch = require("node-fetch");
search(jth, opts, function(err, results) { search(uu, opts, function(err, results) {
var i = results[0].id; var i = results[0].id;
fetch(`https://poketalebot.com/api/ytdl/dowlands/fromurl/get/json?url=${i}`) fetch(`https://poketalebot.com/api/ytdl/dowlands/fromurl/get/json?url=${i}`)
.then(res => res.json()) .then(res => res.json())