mirror of
https://codeberg.org/ashley/poke.git
synced 2024-12-28 15:28:49 +01:00
Update server.js
This commit is contained in:
parent
309d64ecb7
commit
e902edc730
1 changed files with 2 additions and 4 deletions
|
@ -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())
|
||||||
|
|
Loading…
Reference in a new issue