From a4770b7b0ed8e15feedbb70d818e6c2cd9778fc9 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Mon, 11 Nov 2024 15:20:36 -0500 Subject: [PATCH] ca_qc_sainte_anne_de_bellevue: Squash #447 after simplifying changes --- ca_qc_sainte_anne_de_bellevue/people.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ca_qc_sainte_anne_de_bellevue/people.py b/ca_qc_sainte_anne_de_bellevue/people.py index 30d4662b..e2fb06cc 100644 --- a/ca_qc_sainte_anne_de_bellevue/people.py +++ b/ca_qc_sainte_anne_de_bellevue/people.py @@ -10,11 +10,12 @@ class SainteAnneDeBellevuePersonScraper(CanadianScraper): def scrape(self): page = self.lxmlize(COUNCIL_PAGE) - councillors = page.xpath('//div[@class="block text"]') + councillors = page.xpath('//p[a[contains(@href, "@")]]') assert len(councillors), "No councillors found" + for councillor in councillors: - name = councillor.xpath('.//div[@class="content-writable"]//strong/text()')[0] - district = councillor.xpath(".//h2/text()")[0] + name = councillor.text_content().split(" |", 1)[0] + district = councillor.xpath("./preceding-sibling::h2[1]/text()")[0] if "Maire" in district: district = "Sainte-Anne-de-Bellevue" @@ -26,6 +27,5 @@ def scrape(self): p = Person(primary_org="legislature", name=name, district=district, role=role) p.add_source(COUNCIL_PAGE) - p.image = councillor.xpath(".//@src")[0] p.add_contact("email", self.get_email(councillor)) yield p