detect google softcaptcha
This commit is contained in:
@@ -733,7 +733,7 @@ class google{
|
|||||||
$container = &$data["container"];
|
$container = &$data["container"];
|
||||||
|
|
||||||
//file_put_contents("scraper/google-jp.html", $html);
|
//file_put_contents("scraper/google-jp.html", $html);
|
||||||
//$html = file_get_contents("scraper/google-jp.html");
|
//$html = file_get_contents("scraper/google-softcaptcha.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = [
|
$out = [
|
||||||
@@ -754,9 +754,9 @@ class google{
|
|||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
// init
|
// init
|
||||||
$this->detect_sorry();
|
|
||||||
$this->parsestyles();
|
$this->parsestyles();
|
||||||
|
$this->detect_sorry();
|
||||||
$this->scrape_dimg($html);
|
$this->scrape_dimg($html);
|
||||||
$this->scrape_imagearr($html);
|
$this->scrape_imagearr($html);
|
||||||
|
|
||||||
@@ -1381,6 +1381,9 @@ class google{
|
|||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
// parse all <style> tags
|
||||||
|
$this->parsestyles();
|
||||||
|
|
||||||
$this->detect_sorry();
|
$this->detect_sorry();
|
||||||
|
|
||||||
// get javascript images
|
// get javascript images
|
||||||
@@ -1563,14 +1566,14 @@ class google{
|
|||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
// parse all <style> tags
|
||||||
|
$this->parsestyles();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parse web video page
|
// Parse web video page
|
||||||
//
|
//
|
||||||
$this->detect_sorry();
|
$this->detect_sorry();
|
||||||
|
|
||||||
// parse all <style> tags
|
|
||||||
$this->parsestyles();
|
|
||||||
|
|
||||||
// get javascript images
|
// get javascript images
|
||||||
$this->scrape_dimg($html);
|
$this->scrape_dimg($html);
|
||||||
|
|
||||||
@@ -1887,14 +1890,14 @@ class google{
|
|||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
// parse styles
|
||||||
|
$this->parsestyles();
|
||||||
|
|
||||||
$this->detect_sorry();
|
$this->detect_sorry();
|
||||||
|
|
||||||
// get images
|
// get images
|
||||||
$this->scrape_dimg($html);
|
$this->scrape_dimg($html);
|
||||||
|
|
||||||
// parse styles
|
|
||||||
$this->parsestyles();
|
|
||||||
|
|
||||||
$center_col =
|
$center_col =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementById(
|
->getElementById(
|
||||||
@@ -2653,6 +2656,7 @@ class google{
|
|||||||
|
|
||||||
private function detect_sorry(){
|
private function detect_sorry(){
|
||||||
|
|
||||||
|
// detect recaptcha
|
||||||
$captcha_form =
|
$captcha_form =
|
||||||
$this->fuckhtml
|
$this->fuckhtml
|
||||||
->getElementById(
|
->getElementById(
|
||||||
@@ -2682,5 +2686,29 @@ class google{
|
|||||||
|
|
||||||
throw new Exception("Google returned a JS challenge");
|
throw new Exception("Google returned a JS challenge");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// detect soft captcha
|
||||||
|
// "Verifying your request
|
||||||
|
// You'll be able to continue in a few seconds. Don't refresh this page."
|
||||||
|
|
||||||
|
// getting this mostly on mid-trust IPs
|
||||||
|
$softcaptcha =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByClassName(
|
||||||
|
$this->getstyle([
|
||||||
|
"display" => "flex",
|
||||||
|
"flex-direction" => "column",
|
||||||
|
"align-items" => "center",
|
||||||
|
"text-align" => "center",
|
||||||
|
"min-height" => "100vh",
|
||||||
|
"margin-top" => "210px",
|
||||||
|
"padding" => "20px"
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($softcaptcha) !== 0){
|
||||||
|
|
||||||
|
throw new Exception("Google returned a soft captcha");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user