From f6054b16830e24e706a0dc8ace33e07c122e8c07 Mon Sep 17 00:00:00 2001 From: vdbhb59 Date: Thu, 7 Aug 2025 17:04:09 +0530 Subject: [PATCH] Synced fix ddg returning weird reresults when no match is found (https://git.lolcat.ca/lolcat/4get/commit/1e52982cb98130bc4c63e92b882e3940bced3be9) fix ddg answer image 404 (https://git.lolcat.ca/lolcat/4get/commit/27b8509ac0ce0bb0162afa6739b84b4efbed9705) (https://git.lolcat.ca/lolcat/4get/commit/f33f02e816cfdd2b717973772ece4df4b98ea9bb) --- scraper/ddg.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scraper/ddg.php b/scraper/ddg.php index 9ef50c8..6924087 100644 --- a/scraper/ddg.php +++ b/scraper/ddg.php @@ -525,6 +525,15 @@ class ddg{ if(isset($item["c"])){ + if( + !isset($item["s"]) && + isset($item["t"]) && + $item["t"] == "DEEP_ERROR_NO_RESULTS" + ){ + + return $out; + } + $table = []; // get youtube video information @@ -1049,8 +1058,8 @@ class ddg{ "description" => $description, "url" => $json["AbstractURL"], "thumb" => - (isset($json["Image"]) && $json["Image"]) !== null ? - "https://duckduckgo.com" . $json["Image"] : null, + (!isset($json["Image"]) || $json["Image"] == "" || $json["Image"] === null) ? + null : "https://duckduckgo.com" . $json["Image"], "table" => $table, "sublink" => $sublinks ];