From 50d6e88365a4060e241dcf81eebe10e2c6bc1546 Mon Sep 17 00:00:00 2001 From: ngn Date: Sat, 5 Apr 2025 01:37:14 +0300 Subject: [PATCH] multiple patches from upstream https://git.lolcat.ca/lolcat/4get/commit/3e2c3fc5d90a0b0f859358d1c5b2614ab26905a4 https://git.lolcat.ca/lolcat/4get/commit/49ddd1a216d3d885081f28d57e32dc6abac3f7ff https://git.lolcat.ca/lolcat/4get/commit/81ca8eaddc35f7f86e63eed356ef3199f0c78f86 Signed-off-by: ngn --- src/scraper/ddg.php | 22 +- src/scraper/google.php | 931 +++++----------------- src/scraper/yandex.php | 5 +- src/static/themes/Gore's shitty theme.css | 117 ++- 4 files changed, 290 insertions(+), 785 deletions(-) diff --git a/src/scraper/ddg.php b/src/scraper/ddg.php index 76dfe0c..9e5cbd4 100644 --- a/src/scraper/ddg.php +++ b/src/scraper/ddg.php @@ -202,6 +202,7 @@ class ddg{ "display" => "NSFW", "option" => [ "yes" => "Yes", + "maybe" => "Maybe", "no" => "No" ] ], @@ -285,6 +286,7 @@ class ddg{ "display" => "NSFW", "option" => [ "yes" => "Yes", + "maybe" => "Maybe", "no" => "No" ] ], @@ -1344,10 +1346,10 @@ class ddg{ $get_filters["iaf"] = $filters; } - - $nsfw = $get["nsfw"] == "yes" ? "-2" : "-1"; + + $nsfw = $get["nsfw"] == "yes" ? "-1" : "1"; $get_filters["kp"] = $nsfw; - + try{ $html = $this->get( @@ -1497,12 +1499,16 @@ class ddg{ "iax" => "videos", "ia" => "videos" ]; - - $nsfw = $get["nsfw"] == "yes" ? "-2" : "-1"; - $get_filters["kp"] = $nsfw; - + + switch($get["nsfw"]){ + + case "yes": $nsfw = "-2"; break; + case "maybe": $nsfw = "-1"; break; + case "no": $nsfw = "1"; break; + } + $filters = []; - + if($get["date"] != "any"){ $filters[] = "publishedAfter:{$date}"; } if($get["resolution"] != "any"){ $filters[] = "videoDefinition:{$resolution}"; } if($get["duration"] != "any"){ $filters[] = "videoDuration:{$duration}"; } diff --git a/src/scraper/google.php b/src/scraper/google.php index 53590bc..d5202fe 100644 --- a/src/scraper/google.php +++ b/src/scraper/google.php @@ -578,699 +578,8 @@ class google{ } - private function parsepage($html, $pagetype, $search, $proxy, $params){ - - $out = [ - "status" => "ok", - "spelling" => [ - "type" => "no_correction", - "using" => null, - "correction" => null - ], - "npt" => null, - "answer" => [], - "web" => [], - "image" => [], - "video" => [], - "news" => [], - "related" => [] - ]; - - $this->fuckhtml->load($html); - - $this->detect_sorry(); - - // parse all