From e21d8eb086cc34f5d11a349a93193f2178b47dda Mon Sep 17 00:00:00 2001 From: Brighten Zhang Date: Wed, 30 Oct 2024 15:37:21 -0400 Subject: [PATCH 1/2] cleanup --- ca_bc_victoria/people.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ca_bc_victoria/people.py b/ca_bc_victoria/people.py index 9796b6ca..12a70505 100644 --- a/ca_bc_victoria/people.py +++ b/ca_bc_victoria/people.py @@ -36,7 +36,10 @@ def scrape(self): '//ul[@class="menu menu--level-0"]//a[contains(., "Mayor") and not(contains(., "Council"))]/@href' )[0] page = self.lxmlize(mayor_url) - role, name = page.xpath("//h1/span")[0].text_content().split(" ", 1) + role = "Mayor" + role, name = page.xpath( + '//ul[@class="menu menu--level-0"]//a[contains(., "Mayor") and not(contains(., "Council"))]/text()' + )[0].split(" ", 1) photo = councillor.xpath('//div[@class="field__item"]/img/@src')[0] email = self.get_email(page) phone = self.get_phone(page) From cb9b28ab604082fb36f547f4a1c915fb6f70a8eb Mon Sep 17 00:00:00 2001 From: Brighten Zhang Date: Thu, 31 Oct 2024 10:53:45 -0400 Subject: [PATCH 2/2] remove --- ca_bc_victoria/people.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ca_bc_victoria/people.py b/ca_bc_victoria/people.py index 12a70505..8e35d5d9 100644 --- a/ca_bc_victoria/people.py +++ b/ca_bc_victoria/people.py @@ -36,7 +36,6 @@ def scrape(self): '//ul[@class="menu menu--level-0"]//a[contains(., "Mayor") and not(contains(., "Council"))]/@href' )[0] page = self.lxmlize(mayor_url) - role = "Mayor" role, name = page.xpath( '//ul[@class="menu menu--level-0"]//a[contains(., "Mayor") and not(contains(., "Council"))]/text()' )[0].split(" ", 1)