stop fucking changing how you redirect people you piece of shit
This commit is contained in:
@@ -431,29 +431,63 @@ class marginalia{
|
|||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
// detect meta redirect
|
// detect meta redirect
|
||||||
// <html lang="en-US"> <head> <title>Error</title> <link rel="stylesheet" href="/serp.css"> <meta http-equiv="refresh" content="3; URL='?query=asmr&sst=S-873f5da96e8b60'"> </head> <body> <div class="infobox"> <h1>Wait For A Moment</h1> <p>The search engine is currently barraged by queries from bots</p> <p>Please wait for <b id="countdown" data-tr="3">3</b> seconds. If your browser supports it, it will refresh on its own. Otherwise, you can use <a href="?query=asmr&sst=S-873f5da96e8b60">this link</a> to manually proceed. </div> </body> <script lang="javascript"> window.setInterval(()=>{ const cd = document.getElementById('countdown'); var tr = cd.getAttribute('data-tr'); tr--; cd.setAttribute('data-tr', tr); cd.innerHTML=tr; }, 1000); </script> </html>
|
$title =
|
||||||
|
|
||||||
$metas =
|
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByAttributeValue(
|
->getElementsByTagName(
|
||||||
"http-equiv",
|
"title"
|
||||||
"refresh",
|
|
||||||
"meta"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if(count($metas) !== 0){
|
if(
|
||||||
|
count($title) !== 0 &&
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent(
|
||||||
|
$title[0]
|
||||||
|
) == "Error"
|
||||||
|
){
|
||||||
|
|
||||||
preg_match(
|
// redirect detected
|
||||||
'/^([0-9]+).*URL=\'([^\']*)/',
|
|
||||||
|
// get timeout
|
||||||
|
$timeout =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementById(
|
||||||
|
"countdown",
|
||||||
|
"b"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($timeout) === null){
|
||||||
|
|
||||||
|
throw new Exception("Failed to find timeout value");
|
||||||
|
}
|
||||||
|
|
||||||
|
$timeout =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getTextContent(
|
->getTextContent(
|
||||||
$metas[0]["attributes"]["content"]
|
$timeout
|
||||||
),
|
);
|
||||||
$rules
|
|
||||||
|
preg_match(
|
||||||
|
'/location\.replace\(\'([^\']+)\'\)/',
|
||||||
|
$html,
|
||||||
|
$redirect
|
||||||
);
|
);
|
||||||
|
|
||||||
sleep((int)$rules[1]);
|
if(!isset($redirect[1])){
|
||||||
return $this->web($get, $rules[2]);
|
|
||||||
|
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 =
|
$sections =
|
||||||
|
|||||||
Reference in New Issue
Block a user