fuck you duckduckgo

This commit is contained in:
lolcat 2024-11-08 00:19:01 -05:00
parent 4a5ccbd262
commit 388b992bd3
1 changed files with 46 additions and 26 deletions

View File

@ -4,7 +4,6 @@ const fetch = require("node-fetch");
const formdata = require("form-data"); const formdata = require("form-data");
const he = require("he"); const he = require("he");
const cheerio = require("cheerio"); const cheerio = require("cheerio");
const ddg = require("duckduckgo-images-api");
var mmm = require("mmmagic"); var mmm = require("mmmagic");
var Magic = mmm.Magic; var Magic = mmm.Magic;
@ -12,6 +11,8 @@ var ws_logged_in = false;
const mineflayer = require("mineflayer"); const mineflayer = require("mineflayer");
const mc_bridge_enabled = true; const mc_bridge_enabled = true;
const instance = "https://4get.tux.pizza";
var scraper = "ddg";
const mc_options = { const mc_options = {
"host": "deek.chat", "host": "deek.chat",
@ -151,7 +152,7 @@ async function serveddg(msg, results, page){
try{ try{
var res = await fetch( var res = await fetch(
results[page].image, results[page].source[0].url,
{ {
headers: img_headers, headers: img_headers,
signal: AbortSignal.timeout(3000) signal: AbortSignal.timeout(3000)
@ -167,7 +168,7 @@ async function serveddg(msg, results, page){
){ ){
var res = await fetch( var res = await fetch(
results[page].thumbnail, results[page].source[results[page].source.length - 1].url,
{ {
headers: img_headers, headers: img_headers,
signal: AbortSignal.timeout(5000) signal: AbortSignal.timeout(5000)
@ -180,7 +181,7 @@ async function serveddg(msg, results, page){
}catch(err){ }catch(err){
var res = await fetch( var res = await fetch(
results[page].thumbnail, results[page].source[results[page].source.length - 1].url,
{ {
headers: img_headers, headers: img_headers,
signal: AbortSignal.timeout(5000) signal: AbortSignal.timeout(5000)
@ -192,7 +193,7 @@ async function serveddg(msg, results, page){
send( send(
msg, msg,
"Page " + (page + 1) + "/" + (results.length) + "\n[" + results[page].width + "x" + results[page].height + "] " + results[page].title + "\n" + results[page].url, "Page " + (page + 1) + "/" + (results.length) + "\n[" + results[page].source[0].width + "x" + results[page].source[0].height + "] " + results[page].title + "\n" + results[page].source[0].url,
res_get res_get
); );
} }
@ -1034,25 +1035,50 @@ deek.on("message", async function(msg, user){
global_page = 1; global_page = 1;
ddg.image_search( try{
{ var res = await fetch(instance + "/api/v1/images?s=" + encodeURIComponent(value) + "&nsfw" + (ddg_mod ? "no" : "yes") + "&scraper=" + scraper);
query: value, var res_get = await res.json();
moderate: ddg_mod,
iterations: 1 if(res_get.status != "ok"){
send(msg, "Shit!!!!! 4get sucks balls and returned this error: " + res_get.status);
break;
} }
).then(async results => {
is_pp_xeno = false; if(res_get.image.length === 0){
results_cache = results;
if(results.length === 0){
send(msg, "No results found for " + value + "!!"); send(msg, "No results found for " + value + "!!");
return; break;
} }
}catch(error){
await serveddg(msg, results, 1); send(msg, "4get returned invalid response!!!!!! piece of fuckgin shit!!!11!111");
}); }
results_cache = res_get.image;
is_pp_xeno = false;
await serveddg(msg, res_get.image, 1);
break;
case "scraper":
switch(value.toLowerCase()){
case "ddg":
case "yandex":
case "brave":
case "google":
case "google_cse":
case "imgur":
case "ftm":
scraper = value.toLowerCase();
send(msg, "Scraper set to " + scraper + "!!");
break;
default:
send(msg, "Choices are: ddg, yandex, brave, google, google_cse, imgur, ftm");
break;
}
break; break;
case "boobs": case "boobs":
@ -1157,7 +1183,7 @@ deek.on("message", async function(msg, user){
} }
try{ try{
var res = await fetch("https://4get.zzls.xyz/api/v1/videos?s=" + encodeURIComponent(value)); var res = await fetch(instance + "/api/v1/videos?s=" + encodeURIComponent(value));
var res_get = await res.json(); var res_get = await res.json();
if(res_get.status != "ok"){ if(res_get.status != "ok"){
@ -1171,12 +1197,6 @@ deek.on("message", async function(msg, user){
send(msg, "No results found for " + value + "!!"); send(msg, "No results found for " + value + "!!");
break; break;
} }
if(res_get.status != "ok"){
send(msg, "4get sucks!!!!! It returned ERRRO!!RRRO!!O!O!O!11\n>" + res_get.status);
break;
}
}catch(error){ }catch(error){
send(msg, "4get returned invalid response!!!!!! piece of fuckgin shit!!!11!111"); send(msg, "4get returned invalid response!!!!!! piece of fuckgin shit!!!11!111");