Skip to content

Commit

Permalink
ca_qc_sainte_anne_de_bellevue: Squash #447 after simplifying changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Nov 11, 2024
1 parent 3083d46 commit a4770b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ca_qc_sainte_anne_de_bellevue/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

0 comments on commit a4770b7

Please sign in to comment.