diff options
| author | lolcat <will@lolcat.ca> | 2025-10-10 00:15:39 -0400 |
|---|---|---|
| committer | lolcat <will@lolcat.ca> | 2025-10-10 00:15:39 -0400 |
| commit | 560b9b04da68db93354e4c3da628313cae25e94f (patch) | |
| tree | a16b10d82bcf94c58b5570a2e78c58d9e9680941 /scraper | |
| parent | 56ea4811d7e86c18fc4c65b063532b05dd19e2a5 (diff) | |
handle google api no results
Diffstat (limited to 'scraper')
| -rw-r--r-- | scraper/google_api.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scraper/google_api.php b/scraper/google_api.php index 6dbc25a..bb2cacf 100644 --- a/scraper/google_api.php +++ b/scraper/google_api.php @@ -570,7 +570,7 @@ class google_api{ "video" => [], "news" => [], "related" => [] - ]; + ]; if(isset($json["error"]["message"])){ @@ -583,7 +583,8 @@ class google_api{ if(!isset($json["items"])){ - throw new Exception("Failed to access items array"); + // google just doesnt return items when theres no results + return $out; } foreach($json["items"] as $result){ |
