From dca71e3ed1d36bcbf708ac2c5cdadae4e5ff9c79 Mon Sep 17 00:00:00 2001 From: vdbhb59 Date: Sat, 1 Nov 2025 10:05:27 +0530 Subject: [PATCH] Synced Update qwant search engine. (https://github.com/Ahwxorg/LibreY/commit/f8b0d94468bdfd2260bbe0af260e72af277360d0) && (https://github.com/Ahwxorg/LibreY/commit/2c6b577f5b9902bf0115a3773485c0a56f573dbe) chore: merge pull request 227 from davidovski/main Update image.php --- engines/qwant/image.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/engines/qwant/image.php b/engines/qwant/image.php index 7762333..4dc9838 100644 --- a/engines/qwant/image.php +++ b/engines/qwant/image.php @@ -3,7 +3,12 @@ public function get_request_url() { $offset = $this->page * 5; // load 50 images per page $query = urlencode($this->query); - return "https://api.qwant.com/v3/search/images?q=$query&t=images&count=50&locale=en_us&offset=$offset&device=desktop&tgp=3&safesearch=1"; + $url = "https://api.qwant.com/v3/search/images?q=$query&t=images&count=50&locale=en_us&offset=$offset&device=desktop&tgp=3"; + + if (isset($_COOKIE["safe_search"])) + $url .= "&safesearch=1"; + + return $url; } public function parse_results($response) { @@ -18,7 +23,7 @@ for ($i = 0; $i < $imgCount; $i++) { - array_push($results, + array_push($results, array ( "thumbnail" => htmlspecialchars($imgs[$i]["thumbnail"]), "alt" => htmlspecialchars($imgs[$i]["title"]), @@ -35,7 +40,7 @@ foreach($results as $result) { - if (!$result + if (!$result || !array_key_exists("url", $result) || !array_key_exists("alt", $result)) continue; @@ -52,4 +57,4 @@ echo ""; } } -?> +?> \ No newline at end of file