From c42e62cb09c9fc16f627c96b8b5e1cbc9bac6937 Mon Sep 17 00:00:00 2001 From: lolcat Date: Tue, 24 Feb 2026 00:35:21 -0500 Subject: [PATCH] fix marginalia failing --- scraper/marginalia.php | 55 +++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/scraper/marginalia.php b/scraper/marginalia.php index 8fcd9fc..c40ab85 100644 --- a/scraper/marginalia.php +++ b/scraper/marginalia.php @@ -196,7 +196,7 @@ class marginalia{ return $data; } - public function web($get){ + public function web($get, $ss = ""){ $search = [$get["s"]]; if(strlen($get["s"]) === 0){ @@ -390,28 +390,35 @@ class marginalia{ } }else{ - $params = [ - "query" => $search - ]; - foreach(["adtech", "recent", "intitle"] as $v){ + if($ss == ""){ - if($get[$v] == "yes"){ + $params = [ + "query" => $search + ]; + + foreach(["adtech", "recent", "intitle"] as $v){ - switch($v){ + if($get[$v] == "yes"){ - case "adtech": $params["adtech"] = "reduce"; break; - case "recent": $params["recent"] = "recent"; break; - case "adtech": $params["searchTitle"] = "title"; break; + switch($v){ + + case "adtech": $params["adtech"] = "reduce"; break; + case "recent": $params["recent"] = "recent"; break; + case "adtech": $params["searchTitle"] = "title"; break; + } } } + }else{ + + $params = []; } try{ $html = $this->get( $proxy, - "https://old-search.marginalia.nu/search", + "https://old-search.marginalia.nu/search" . $ss, $params, //$anubis_key ); @@ -423,6 +430,32 @@ class marginalia{ $this->fuckhtml->load($html); + // detect meta redirect + // Error

Wait For A Moment

The search engine is currently barraged by queries from bots

Please wait for 3 seconds. If your browser supports it, it will refresh on its own. Otherwise, you can use this link to manually proceed.

+ + $metas = + $this->fuckhtml + ->getElementsByAttributeValue( + "http-equiv", + "refresh", + "meta" + ); + + if(count($metas) !== 0){ + + preg_match( + '/^([0-9]+).*URL=\'([^\']*)/', + $this->fuckhtml + ->getTextContent( + $metas[0]["attributes"]["content"] + ), + $rules + ); + + sleep((int)$rules[1]); + return $this->web($get, $rules[2]); + } + $sections = $this->fuckhtml ->getElementsByClassName(