From 0fb77515b7415850189bd1409b104d98a1f611f2 Mon Sep 17 00:00:00 2001 From: lolcat Date: Thu, 23 Nov 2023 22:41:04 -0600 Subject: [PATCH] youtube update fix thing --- client.js | 95 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 78 insertions(+), 17 deletions(-) diff --git a/client.js b/client.js index 81e8e88..f9f49bc 100755 --- a/client.js +++ b/client.js @@ -8,6 +8,8 @@ const ddg = require("duckduckgo-images-api"); var mmm = require("mmmagic"); var Magic = mmm.Magic; +var http = require("http"); + const emitter = require("events"); const deek = new emitter(); @@ -21,7 +23,7 @@ var ddg_mod = true; // dont show porn in .img var global_page = 1; // .img page var raid = false; // raid? var img_headers = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/110.0", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/120.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", @@ -34,6 +36,37 @@ var headers = { Origin: "https://deek.chat" }; +// create sekrit http interface + +const http_server = http.createServer(async function(req, res){ + + res.setHeader("Content-Type", "text/html"); + + switch(req.url){ + case "/renatest": + res.writeHead(200); + setTimeout(function(){ + fs.utimesSync(__filename, Date.now(), Date.now()); + }, 1000); + res.end("Restarted piece of shit bot!!! lollllll"); + break; + + case "/": + res.writeHead(200); + res.end("Deek has a stinky penis"); + break; + + default: + res.writeHead(404); + res.end("dumbass"); + break; + } +}); + +http_server.listen(8000, "0.0.0.0", function(){ + console.log("Started http serber"); +}); + /* Helper functions */ @@ -203,6 +236,7 @@ async function handshake(name, password){ var session_id = cookie.match(/session_id=([^;]+)/); if( + api_token === null || typeof api_token[1] != "string" || typeof session_id[1] != "string" ){ @@ -247,6 +281,7 @@ async function handshake(name, password){ switch(m.type){ + case "message": case "messageEnd": for(var k=0; k")[0].substr(1); + msg.text = msg.text.split(">").splice(1).join(">").trim(); + } + switch(msg.text.toLowerCase()){ case "hello rena": @@ -510,10 +557,18 @@ deek.on("message", async function(msg, user){ var value = ""; } - switch(cmd){ + switch(cmd.toLowerCase()){ case "raid": - if(user.id !== 13){ + if( + ( + user.id === 13 || // me lol + user.id === 14 || // aves + user.id === 8 || // aves again + user.id === 30 || // eagle + user.id === 2 // deek + ) === false + ){ break; } @@ -758,22 +813,28 @@ deek.on("message", async function(msg, user){ if(value.trim() == ""){ send(msg, "You need to search for something cum licker!!!"); - return; + break; } - var res = await fetch("https://4get.ca/api/v1/videos?s=" + value); + var res = await fetch("https://4get.perennialte.ch/api/v1/videos?s=" + value); var res_get = await res.json(); + if(res_get.status != "ok"){ + + send(msg, "Shit!!!!! 4get sucks balls and returned this error: " + res_get.status); + break; + } + if(res_get.video.length === 0){ send(msg, "No results found for " + value + "!!"); - return; + break; } if(res_get.status != "ok"){ send(msg, "4get sucks!!!!! It returned ERRRO!!RRRO!!O!O!O!11\n>" + res_get.status); - return; + break; } var text = []; @@ -786,8 +847,8 @@ deek.on("message", async function(msg, user){ text.push( ">Duration: " + (new Date(res_get.video[i].duration * 1000).toISOString().slice(11, 19)) + - " • views: " + (new Intl.NumberFormat().format(res_get.video[i].views)) + - " • author: " + res_get.video[i].author.name + + " • Views: " + (new Intl.NumberFormat().format(res_get.video[i].views)) + + " • Author: " + res_get.video[i].author.name + "\n" + res_get.video[i].title + "\n▶ " + res_get.video[i].url ); @@ -837,4 +898,4 @@ deek.on("error", function(message){ }); // connect to serber -handshake(name, password); \ No newline at end of file +handshake(name, password);