Skip to content

Commit

Permalink
made improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
msrezaie committed Dec 13, 2024
1 parent f8d8b6c commit c36258f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions city_scrapers/spiders/atconj_County_Commission.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,21 @@ def _parse_end(self, item):
return dateparse(item["endDate"]).astimezone(tz=None).replace(tzinfo=None)

def _parse_location(self, item):
location = item["location"]
if not location["address"] or not location["name"]:
location = item.get("location")
if not location.get("address") or not location.get("name"):
return self.default_location
return {"name": location["name"], "address": location["address"]}
return {"name": location.get("name"), "address": location.get("address")}

def _parse_links(self, item):
links = []

item = Selector(text=item)
agenda = item.css("td.event_agenda a").get()
minutes = item.css("td.event_minutes a").get()
if agenda:
agenda = agenda.split('href="')[1].split('"')[0]
links.append({"href": self.original_url + agenda, "title": "Agenda"})
if minutes:
minutes = minutes.split('href="')[1].split('"')[0]
links.append({"href": self.original_url + minutes, "title": "Minutes"})
agenda_url = item.css("td.event_agenda a").get()
minutes_url = item.css("td.event_minutes a").get()
if agenda_url:
agenda_url = agenda_url.split('href="')[1].split('"')[0]
links.append({"href": self.original_url + agenda_url, "title": "Agenda"})
if minutes_url:
minutes_url = minutes_url.split('href="')[1].split('"')[0]
links.append({"href": self.original_url + minutes_url, "title": "Minutes"})
return links

0 comments on commit c36258f

Please sign in to comment.