mirror of
https://git.lolcat.ca/lolcat/4get.git
synced 2024-11-14 03:49:48 +01:00
fixed nasty brave bug
This commit is contained in:
parent
75003b6617
commit
640d1d1953
3 changed files with 9 additions and 5 deletions
|
@ -75,6 +75,7 @@ class backend{
|
|||
break;
|
||||
|
||||
case "socks5_hostname":
|
||||
case "socks5a":
|
||||
curl_setopt($curlproc, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
|
||||
curl_setopt($curlproc, CURLOPT_PROXY, $address . ":" . $port);
|
||||
break;
|
||||
|
|
|
@ -424,8 +424,6 @@ class fuckhtml{
|
|||
$escape = false;
|
||||
}
|
||||
|
||||
$lastchar = $json[$i];
|
||||
|
||||
if(
|
||||
$bracket === false &&
|
||||
$is_close_bracket === false
|
||||
|
@ -436,7 +434,6 @@ class fuckhtml{
|
|||
|
||||
case "[":
|
||||
case "{":
|
||||
// dont execute whats in "default"
|
||||
$json_out .= $json[$i];
|
||||
break;
|
||||
|
||||
|
|
|
@ -295,6 +295,7 @@ class brave{
|
|||
$html = fread($handle, filesize("scraper/brave.html"));
|
||||
fclose($handle);
|
||||
*/
|
||||
|
||||
try{
|
||||
$html =
|
||||
$this->get(
|
||||
|
@ -406,9 +407,9 @@ class brave{
|
|||
|
||||
if(!isset($grep[1])){
|
||||
|
||||
throw new Exception("Could not get data JS");
|
||||
throw new Exception("Could not grep JavaScript object");
|
||||
}
|
||||
|
||||
|
||||
$data =
|
||||
$this->fuckhtml
|
||||
->parseJsObject(
|
||||
|
@ -416,6 +417,11 @@ class brave{
|
|||
);
|
||||
unset($grep);
|
||||
|
||||
if($data === null){
|
||||
|
||||
throw new Exception("Failed to decode JavaScript object");
|
||||
}
|
||||
|
||||
$data = $data[1]["data"]["body"]["response"];
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue