marginalia api 502
This commit is contained in:
@@ -289,8 +289,18 @@ class marginalia{
|
|||||||
throw new Exception("The API key used is rate limited. Please try again in a few minutes.");
|
throw new Exception("The API key used is rate limited. Please try again in a few minutes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strpos($json, "<title>Bad Gateway (502)</title>")){
|
||||||
|
|
||||||
|
throw new Exception("Marginalia returned a 502 error");
|
||||||
|
}
|
||||||
|
|
||||||
$json = json_decode($json, true);
|
$json = json_decode($json, true);
|
||||||
|
|
||||||
|
if($json === null){
|
||||||
|
|
||||||
|
throw new Exception("Failed to decode JSON");
|
||||||
|
}
|
||||||
|
|
||||||
foreach($json["results"] as $result){
|
foreach($json["results"] as $result){
|
||||||
|
|
||||||
$out["web"][] = [
|
$out["web"][] = [
|
||||||
|
|||||||
Reference in New Issue
Block a user