Skip to content

Commit

Permalink
ca_qc_montreal_est: Make changes closer to original
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Nov 7, 2024
1 parent 29c7f83 commit 3083d46
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions ca_qc_montreal_est/people.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from utils import CanadianPerson as Person
from utils import CanadianScraper

COUNCIL_PAGE = "http://ville.montreal-est.qc.ca/vie-democratique/conseil-municipal/"
COUNCIL_PAGE = "https://ville.montreal-est.qc.ca/vie-democratique/conseil-municipal/"


class MontrealEstPersonScraper(CanadianScraper):
Expand All @@ -12,19 +12,16 @@ def scrape(self):
)
assert len(councillors), "No councillors found"
for councillor in councillors:
name = councillor.xpath('.//div[@class="bg-trans-gris"]/span/text()')[0]
name, role_district = councillor.xpath('.//div[@class="bg-trans-gris"]/span/text()')[0].split(" – ", 1)

if "Maire" in name or "Mairesse" in name:
name = name.split(" ", 2)[:2]
name = " ".join(name)
if "Maire" in role_district or "Mairesse" in role_district:
district = "Montréal-Est"
role = "Maire"
else:
name, district = name.split(" ", 2)[:2], "District " + name.split(" ")[-1]
name = " ".join(name)
district = f"District {role_district[-1]}"
role = "Conseiller"

p = Person(primary_org="legislature", name=name, district=district, role=role)
p = Person(primary_org="legislature", name=name.strip(), district=district, role=role)
p.image = councillor.xpath(".//div[not(@id)]/img//@src")[0]
p.add_contact("email", self.get_email(councillor))
p.add_source(COUNCIL_PAGE)
Expand Down

0 comments on commit 3083d46

Please sign in to comment.