fix marginalia failing
This commit is contained in:
@@ -196,7 +196,7 @@ class marginalia{
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function web($get){
|
public function web($get, $ss = ""){
|
||||||
|
|
||||||
$search = [$get["s"]];
|
$search = [$get["s"]];
|
||||||
if(strlen($get["s"]) === 0){
|
if(strlen($get["s"]) === 0){
|
||||||
@@ -390,28 +390,35 @@ class marginalia{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$params = [
|
|
||||||
"query" => $search
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach(["adtech", "recent", "intitle"] as $v){
|
if($ss == ""){
|
||||||
|
|
||||||
if($get[$v] == "yes"){
|
$params = [
|
||||||
|
"query" => $search
|
||||||
|
];
|
||||||
|
|
||||||
switch($v){
|
foreach(["adtech", "recent", "intitle"] as $v){
|
||||||
|
|
||||||
case "adtech": $params["adtech"] = "reduce"; break;
|
if($get[$v] == "yes"){
|
||||||
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{
|
try{
|
||||||
$html =
|
$html =
|
||||||
$this->get(
|
$this->get(
|
||||||
$proxy,
|
$proxy,
|
||||||
"https://old-search.marginalia.nu/search",
|
"https://old-search.marginalia.nu/search" . $ss,
|
||||||
$params,
|
$params,
|
||||||
//$anubis_key
|
//$anubis_key
|
||||||
);
|
);
|
||||||
@@ -423,6 +430,32 @@ class marginalia{
|
|||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
// 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>
|
||||||
|
|
||||||
|
$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 =
|
$sections =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementsByClassName(
|
->getElementsByClassName(
|
||||||
|
|||||||
Reference in New Issue
Block a user