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 he = require("he");
const cheerio = require("cheerio");
const ddg = require("duckduckgo-images-api");
var mmm = require("mmmagic");
var Magic = mmm.Magic;
@ -12,6 +11,8 @@ var ws_logged_in = false;
const mineflayer = require("mineflayer");
const mc_bridge_enabled = true;
const instance = "https://4get.tux.pizza";
var scraper = "ddg";
const mc_options = {
"host": "deek.chat",
@ -151,7 +152,7 @@ async function serveddg(msg, results, page){
try{
var res = await fetch(
results[page].image,
results[page].source[0].url,
{
headers: img_headers,
signal: AbortSignal.timeout(3000)
@ -167,7 +168,7 @@ async function serveddg(msg, results, page){
){
var res = await fetch(
results[page].thumbnail,
results[page].source[results[page].source.length - 1].url,
{
headers: img_headers,
signal: AbortSignal.timeout(5000)
@ -180,7 +181,7 @@ async function serveddg(msg, results, page){
}catch(err){
var res = await fetch(
results[page].thumbnail,
results[page].source[results[page].source.length - 1].url,
{
headers: img_headers,
signal: AbortSignal.timeout(5000)
@ -192,7 +193,7 @@ async function serveddg(msg, results, page){
send(
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
);
}
@ -1034,25 +1035,50 @@ deek.on("message", async function(msg, user){
global_page = 1;
ddg.image_search(
{
query: value,
moderate: ddg_mod,
iterations: 1
try{
var res = await fetch(instance + "/api/v1/images?s=" + encodeURIComponent(value) + "&nsfw" + (ddg_mod ? "no" : "yes") + "&scraper=" + scraper);
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;
}
).then(async results => {
if(res_get.image.length === 0){
is_pp_xeno = false;
results_cache = results;
if(results.length === 0){
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;
case "boobs":
@ -1157,7 +1183,7 @@ deek.on("message", async function(msg, user){
}
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();
if(res_get.status != "ok"){
@ -1171,12 +1197,6 @@ deek.on("message", async function(msg, user){
send(msg, "No results found for " + value + "!!");
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){
send(msg, "4get returned invalid response!!!!!! piece of fuckgin shit!!!11!111");