diff options
author | lolcat <will@lolcat.ca> | 2024-06-24 17:15:54 -0400 |
---|---|---|
committer | lolcat <will@lolcat.ca> | 2024-06-24 17:15:54 -0400 |
commit | 640d1d1953669115dc67dfdaf86998401a9bfac4 (patch) | |
tree | e3098adba86d9868b96f43ec6be4d81c7a387f60 /scraper | |
parent | 75003b6617c1a828fb871c3f76da415b3ce0b455 (diff) |
fixed nasty brave bug
Diffstat (limited to 'scraper')
-rw-r--r-- | scraper/brave.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scraper/brave.php b/scraper/brave.php index 8be55ac..3e6c449 100644 --- a/scraper/brave.php +++ b/scraper/brave.php @@ -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"]; /* |