From 5a7cecef11d4b728ba202e1a80f5a77b7aee88fe Mon Sep 17 00:00:00 2001 From: lolcat Date: Sun, 14 Jun 2026 16:07:33 -0400 Subject: [PATCH] marginalia api 502 --- scraper/marginalia.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scraper/marginalia.php b/scraper/marginalia.php index 90b7f4c..ee18cc0 100644 --- a/scraper/marginalia.php +++ b/scraper/marginalia.php @@ -289,8 +289,18 @@ class marginalia{ throw new Exception("The API key used is rate limited. Please try again in a few minutes."); } + if(strpos($json, "Bad Gateway (502)")){ + + throw new Exception("Marginalia returned a 502 error"); + } + $json = json_decode($json, true); + if($json === null){ + + throw new Exception("Failed to decode JSON"); + } + foreach($json["results"] as $result){ $out["web"][] = [