From fd83ae49f1cfb47e0ed23ae6a76310757cd3198f Mon Sep 17 00:00:00 2001 From: Gianfranco Rossi Date: Thu, 25 Jan 2024 11:29:40 -0500 Subject: [PATCH] fix(hawapp): skip record if docket cell has no tag Solves: #871 Problem was a result row for hawapp where the docket cell had no tag, causing an IndexError --- juriscraper/opinions/united_states/state/haw.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/juriscraper/opinions/united_states/state/haw.py b/juriscraper/opinions/united_states/state/haw.py index 5d131dcad..38da10d5d 100644 --- a/juriscraper/opinions/united_states/state/haw.py +++ b/juriscraper/opinions/united_states/state/haw.py @@ -15,15 +15,23 @@ def __init__(self, *args, **kwargs): self.court_code = "S.Ct" self.status = "Published" - def _process_html(self): + def _process_html(self) -> None: + """Parse HTML into case objects + + :return: None + """ for row in self.html.xpath("//tr[@class='row-']"): date, court, docket, name, lower_court, citation = row.xpath( ".//td" ) - name = name.text_content().split("(")[0] court = court.text_content() if court != self.court_code: continue + + if not docket.xpath(".//a"): + continue + + name = name.text_content().split("(")[0] self.cases.append( { "date": date.text_content(),