aboutsummaryrefslogtreecommitdiffstats
path: root/scraper
diff options
context:
space:
mode:
authorlolcat <will@lolcat.ca>2026-06-14 16:01:56 -0400
committerPinapelz <yukais@pinapelz.com>2026-06-21 14:54:20 -0700
commitcc84112decb77d1f0f5de2cc43a5bc6ec709fad4 (patch)
tree08867d83c8983e1391a1fa2fb8e071e0a19e62cc /scraper
parent0a487e128c0db215c1c2b3103ff741cb8fc9d3b5 (diff)
handle marginalia internal error
Diffstat (limited to 'scraper')
-rw-r--r--scraper/marginalia.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/scraper/marginalia.php b/scraper/marginalia.php
index f5be5e1..90b7f4c 100644
--- a/scraper/marginalia.php
+++ b/scraper/marginalia.php
@@ -490,6 +490,37 @@ class marginalia{
return $this->web($get, $redirect);
}
+ // detect internal error
+ $infobox =
+ $this->fuckhtml
+ ->getElementsByClassName("infobox");
+
+ if(count($infobox) !== 0){
+
+ foreach($infobox as $i){
+
+ $this->fuckhtml->load($i);
+
+ $h2 =
+ $this->fuckhtml
+ ->getElementsByTagName("h2");
+
+ if(
+ count($h2) !== 0 &&
+ $this->fuckhtml
+ ->getTextContent(
+ $h2[0]
+ ) == "Internal error"
+ ){
+
+ throw new Exception("Marginalia returned an internal server error");
+ }
+ }
+
+ // reset
+ $this->fuckhtml->load($html);
+ }
+
$sections =
$this->fuckhtml
->getElementsByClassName(
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage