From a66a3a9198a28870ea5d4efa7c0b60186bbdadfd Mon Sep 17 00:00:00 2001 From: Bingus_Violet Date: Tue, 13 Feb 2024 13:21:53 -0600 Subject: [PATCH] Moving stuff --- index.js | 15 ++++++++++++++- pageUpdater.js | 15 +-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/index.js b/index.js index 645bdef..2361b03 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ const express = require('express'), path = require('path'), fs = require('fs'), - pageUpdater = require('./pageUpdater.js') + pageUpdater = require('./pageUpdater.js'), + ytjs = require("youtubei.js") var app = express() @@ -9,6 +10,7 @@ const PORT = process.env.PORT || 8080 const staticpath = path.join(__dirname, 'static') +var mostRecentVideo = undefined var lanyardData = undefined var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json'))) @@ -22,6 +24,17 @@ function getThumbor() { return thumborInstances[thumbCount % thumborInstances.length] + "unsafe" } +async function getMostRecentVid() { + innertube = await ytjs.Innertube.create() + var video = await (await (await ytjs.Innertube.create()).getChannel('UChcrBJNJLZucy3TPyGyAY2g')) + video = video.current_tab.content.contents[1].contents[0].content.items[0] + + mostRecentVideo = video.endpoint.payload.videoId + console.log(mostRecentVideo) +} + +getMostRecentVid() + app.listen(PORT, () => { console.log("Violet's Purgatory is now listening on port: " + PORT) }) diff --git a/pageUpdater.js b/pageUpdater.js index 1a6f710..3ec5451 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -1,8 +1,7 @@ const path = require('path'), fs = require('fs'), WebSocket = require('ws'), - minify = require('minify-html'), - ytjs = require('youtubei.js') + minify = require('minify-html') var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json'))) @@ -10,24 +9,12 @@ var highlightedWords = config.highlightedWords var quotes = config.quotes var titles = config.titles -var mostRecentVideo = undefined - var commitCount = "300+" var lanyardData = undefined var uptime = Date.now() -async function getMostRecentVid() { - innertube = await ytjs.Innertube.create() - var video = await (await (await ytjs.Innertube.create()).getChannel('UChcrBJNJLZucy3TPyGyAY2g')) - video = video.current_tab.content.contents[1].contents[0].content.items[0] - - mostRecentVideo = video -} - -getMostRecentVid() - function converter(html) { if (lanyardData) { var statusData = config.discStatuses[lanyardData.discord_status]