detect brave captcha
This commit is contained in:
@@ -383,6 +383,8 @@ class brave{
|
|||||||
// load html
|
// load html
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$this->detect_captcha($html);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get next page "token"
|
Get next page "token"
|
||||||
*/
|
*/
|
||||||
@@ -1175,6 +1177,8 @@ class brave{
|
|||||||
// load html
|
// load html
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$this->detect_captcha($html);
|
||||||
|
|
||||||
// get npt
|
// get npt
|
||||||
$out["npt"] =
|
$out["npt"] =
|
||||||
$this->generatenextpagetoken(
|
$this->generatenextpagetoken(
|
||||||
@@ -1270,6 +1274,9 @@ class brave{
|
|||||||
fclose($handle);*/
|
fclose($handle);*/
|
||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$this->detect_captcha($html);
|
||||||
|
|
||||||
$json = $this->get_js();
|
$json = $this->get_js();
|
||||||
|
|
||||||
foreach(
|
foreach(
|
||||||
@@ -1374,6 +1381,8 @@ class brave{
|
|||||||
|
|
||||||
$this->fuckhtml->load($html);
|
$this->fuckhtml->load($html);
|
||||||
|
|
||||||
|
$this->detect_captcha($html);
|
||||||
|
|
||||||
$out = [
|
$out = [
|
||||||
"status" => "ok",
|
"status" => "ok",
|
||||||
"npt" => null,
|
"npt" => null,
|
||||||
@@ -1853,4 +1862,29 @@ class brave{
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function detect_captcha(){
|
||||||
|
|
||||||
|
$title =
|
||||||
|
$this->fuckhtml
|
||||||
|
->getElementsByTagName(
|
||||||
|
"title"
|
||||||
|
);
|
||||||
|
|
||||||
|
if(count($title) === 0){
|
||||||
|
|
||||||
|
throw new Exception("Brave returned a malformed page");
|
||||||
|
}
|
||||||
|
|
||||||
|
$title =
|
||||||
|
strtolower(
|
||||||
|
$this->fuckhtml
|
||||||
|
->getTextContent($title[0])
|
||||||
|
);
|
||||||
|
|
||||||
|
if($title == "human verification"){
|
||||||
|
|
||||||
|
throw new Exception("Brave returned a Captcha");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user