diff --git a/src/cogs/election.py b/src/cogs/election.py index 06ed705..b556d5d 100644 --- a/src/cogs/election.py +++ b/src/cogs/election.py @@ -100,7 +100,6 @@ class ElectionCog(commands.Cog): ) self.log.debug("Sent countdown message") - def process_soup(self, soup: BeautifulSoup) -> dict[str, list[int]] | None: good_soups = list(soup.find_all(attrs={"data-testid": "election-banner-results-bar"})) if not good_soups: @@ -109,13 +108,13 @@ class ElectionCog(commands.Cog): results: dict[str, list[int]] = {} for child_li in good_soup.children: + span = list(child_li.children)[-1] try: - party, extra = child_li.get_text().strip().split(":", 1) + party, extra = span.get_text().strip().split(":", 1) seats, extra = extra.split(",", 1) - seats = int(seats.split()[0]) - change = -1 + seats = change = int(seats.split()[0]) except ValueError: - self.log.error("failed to parse %r", child_li) + self.log.error("failed to parse %r", span) continue results[party] = [seats, change, 0] # if not span: