From cdf9164113a3cef01b4f26f6e02887a3e3c91267 Mon Sep 17 00:00:00 2001 From: lolcat Date: Tue, 24 Feb 2026 17:53:38 -0500 Subject: [PATCH] stop fucking changing how you redirect people you piece of shit --- scraper/marginalia.php | 64 ++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/scraper/marginalia.php b/scraper/marginalia.php index c40ab85..f5be5e1 100644 --- a/scraper/marginalia.php +++ b/scraper/marginalia.php @@ -431,29 +431,63 @@ 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 = + $title = $this->fuckhtml - ->getElementsByAttributeValue( - "http-equiv", - "refresh", - "meta" + ->getElementsByTagName( + "title" ); - if(count($metas) !== 0){ + if( + count($title) !== 0 && + $this->fuckhtml + ->getTextContent( + $title[0] + ) == "Error" + ){ - preg_match( - '/^([0-9]+).*URL=\'([^\']*)/', + // redirect detected + + // get timeout + $timeout = + $this->fuckhtml + ->getElementById( + "countdown", + "b" + ); + + if(count($timeout) === null){ + + throw new Exception("Failed to find timeout value"); + } + + $timeout = $this->fuckhtml ->getTextContent( - $metas[0]["attributes"]["content"] - ), - $rules + $timeout + ); + + preg_match( + '/location\.replace\(\'([^\']+)\'\)/', + $html, + $redirect ); - sleep((int)$rules[1]); - return $this->web($get, $rules[2]); + if(!isset($redirect[1])){ + + throw new Exception("Failed to grep redirect value"); + } + + $one = 1; + $redirect = + str_replace( + "/search", + "", + $redirect[1], + $one + ); + + sleep((int)$timeout); + return $this->web($get, $redirect); } $sections =