mirror of
https://git.lolcat.ca/lolcat/4get.git
synced 2024-11-08 17:43:07 -05:00
google fixes
This commit is contained in:
parent
b7f58a1421
commit
e82e908ece
2 changed files with 29 additions and 2 deletions
2
data/proxies/.gitignore
vendored
2
data/proxies/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
*
|
*
|
||||||
!.gitignore
|
!.gitignore
|
||||||
!onion.txt
|
!onion.txt
|
||||||
|
|
|
@ -559,6 +559,7 @@ class google{
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_close($curlproc);
|
curl_close($curlproc);
|
||||||
|
echo $data;
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,6 +978,11 @@ class google{
|
||||||
"related" => []
|
"related" => []
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if($this->detect_sorry($html)){
|
||||||
|
|
||||||
|
throw new Exception("Google blocked this 4get instance. Please set up a proxy!");
|
||||||
|
}
|
||||||
|
|
||||||
$this->parsejavascript($html);
|
$this->parsejavascript($html);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -2795,7 +2801,10 @@ class google{
|
||||||
throw new Exception("Failed to get search page");
|
throw new Exception("Failed to get search page");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->fuckhtml->load($html);
|
if($this->detect_sorry($html)){
|
||||||
|
|
||||||
|
throw new Exception("Google blocked this 4get instance. Please set up a proxy!");
|
||||||
|
}
|
||||||
|
|
||||||
$out = [
|
$out = [
|
||||||
"status" => "ok",
|
"status" => "ok",
|
||||||
|
@ -3609,4 +3618,22 @@ class google{
|
||||||
|
|
||||||
return rtrim($title, ". \t\n\r\0\x0B");
|
return rtrim($title, ". \t\n\r\0\x0B");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function detect_sorry($html){
|
||||||
|
|
||||||
|
$this->fuckhtml->load($html);
|
||||||
|
$detect_sorry =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName("title");
|
||||||
|
|
||||||
|
if(
|
||||||
|
isset($detect_sorry[0]) &&
|
||||||
|
$detect_sorry[0]["innerHTML"] == "302 Moved"
|
||||||
|
){
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue